# dissWeights: Create Weights for Uniform Weighted Distribution In smacof: Multidimensional Scaling

## Description

Compute weights as a function of the dissimilarities.

## Usage

 ```1 2``` ```dissWeights(delta, type = c("unif", "knn", "power", "unifpower"), k = NULL, power = 0) ```

## Arguments

 `delta` Either a symmetric dissimilarity matrix or an object of class `"dist"` `type` One of `"unif"` (default), `"knn"`, `"power"`, `"unifpower"`. See details for a description of the various options. `k` The number of smallest dissimilarities per row for which the weights need to be set to 1. The default `k = NULL` makes `k` to be set to use the 25% smallest dissimilarities per row. `power` power to which the dissimilarities need to be raised as weights. Default is 0, so that all weights are 1.

## Details

The weights are computed as a function of the dissimilarities depending on `type`.

- `"unif"` Compute weights such that the weighted empirical distribution (histogram) of the dissimilarities is uniform. Particularly if the number of objects is large, the dissimilarities that occuur most often will start to dominate the solution. This option de-emphasizes often occuring dissimilarities such that the weighted empirical distribution (the weighted histogram) becomes approximately uniform.

- `"knn"` Per row of the dissimilarity matrix the `k` smallest dissimilarities obtain a weight of 1 and the others a 0.

- `"power"` The weights are set to the `delta^power`. If `power` is small (e.g., `power = -5`) then the smaller dissimilarities will be better fitted. If `power` is large (e.g., `power = 5`) then the larger dissimilarities will be better fitted.

- `"unifpower"` First weights are determined by the `"unif"` option and then multiplied by the weights obtained by the `"power"` option. If the dissimilarity matrix is large, then this option is needed to see an effect of the `"power"` option on the MDS solution.

## Value

 `weightmat` the weight matrix

Patrick Groenen

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42``` ```## mds solution for kinship data with uniform weights res <- mds(kinshipdelta, weightmat = dissWeights(kinshipdelta, type = "unif")) par(mfrow = c(2,2)) plot(res, main = "uniform weights") plot(res, plot.type = "Shepard") plot(res, plot.type = "histogram") ## mds solution for kinship data with knn weights res <- mds(kinshipdelta, weightmat = dissWeights(kinshipdelta, type = "knn", k = 5)) par(mfrow = c(1,2)) plot(res, main = "knn weights with k=5") plot(res, plot.type = "Shepard") ## mds solution for kinship data with power weights emphasizing large dissimilarities res <- mds(kinshipdelta, weightmat = dissWeights(kinshipdelta, type = "power", power = 5)) par(mfrow = c(2,2)) plot(res, main = "Power = 5 weights") plot(res, plot.type = "Shepard") plot(res, plot.type = "histogram") ## mds solution for kinship data with power weights emphasizing small dissimilarities res <- mds(kinshipdelta, weightmat = dissWeights(kinshipdelta, type = "power", power = -5)) par(mfrow = c(2,2)) plot(res, main = "Power = -5 weights") plot(res, plot.type = "Shepard") plot(res, plot.type = "histogram") ## mds solution for kinship data with power weights emphasizing large dissimilarities ## while correcting for nonuniform dissimilarities res <- mds(kinshipdelta, weightmat = dissWeights(kinshipdelta, type = "unifpower", power = 5)) par(mfrow = c(2,2)) plot(res, main = "Uniform power = 5 weights") plot(res, plot.type = "Shepard") plot(res, plot.type = "histogram") ## mds solution for kinship data with power weights emphasizing small dissimilarities ## while correcting for nonuniform dissimilarities res <- mds(kinshipdelta, weightmat = dissWeights(kinshipdelta, type = "unifpower", power = -5)) par(mfrow = c(2,2)) plot(res, main = "Uniform power = -5 weights") plot(res, plot.type = "Shepard") plot(res, plot.type = "histogram") ```

smacof documentation built on July 21, 2021, 3 a.m.