Description Usage Arguments Details Value References See Also Examples

View source: R/smacofConstraint.R

SMACOF with internal constraints on the configurations.

1 2 3 4 5 6 7 | ```
smacofConstraint(delta, constraint = "unrestricted", external, ndim = 2,
type = c("ratio", "interval", "ordinal", "mspline"), weightmat = NULL,
init = NULL, ties = "primary", verbose = FALSE, modulus = 1,
itmax = 1000, eps = 1e-6, spline.intKnots = 4, spline.degree = 2,
constraint.type = c("ratio", "interval", "ordinal", "spline",
"mspline"), constraint.ties = "primary",
constraint.spline.intKnots = 2, constraint.spline.degree = 2)
``` |

`delta` |
Either a symmetric dissimilarity matrix or an object of class |

`constraint` |
Type of constraint: |

`external` |
Data frame or matrix with external covariates, or list for simplex and circumplex (see details) |

`ndim` |
Number of dimensions |

`type` |
MDS type: |

`weightmat` |
Optional matrix with dissimilarity weights |

`init` |
Optional matrix with starting values for configurations. If |

`ties` |
Tie specification for non-metric MDS only: |

`verbose` |
If |

`modulus` |
Number of smacof iterations per monotone regression call |

`itmax` |
Maximum number of iterations |

`eps` |
Convergence criterion |

`spline.degree` |
Degree of the spline for |

`spline.intKnots` |
Number of interior knots of the spline for |

`constraint.type` |
Transformation for |

`constraint.ties` |
Tie specification for |

`constraint.spline.intKnots` |
Number of interior knots for |

`constraint.spline.degree` |
Degree of the spline for |

The argument `external`

is mandatory to specify and requires a data frame (or matrix) of dimension (n x q). Alternatively, for simplex fitting the user can specify a list of the following structure: `external = list("simplex", dim2)`

with `dim2`

denoting the dimension of the simplex with dim2 < n. For a circumplex fitting, the list has to be of the following form: `external = list("circumplex", dim2, k1, k2)`

with *1 ≤q k1 ≤q k2 ≤q n* (see also examples section). k1 and k2 denote the circumplex width.

In constraint smacof, the configuration matrix *X* is subject to a constraint based on the external scales (predictors *Z* specified using `external`

) of the following linear form: *X = ZC*. The type of constraint in *C* can be specified using the `constraint`

argument. We provide the following standard setting:

For `constraint = "unrestricted"`

, *C* is unrestricted. Note that `"linear"`

still works as well for backward compatibility.

The same for `constraint = "diagonal"`

where *X* needs to be of dimension *(n x q)* where *q* is the number of columns of the external scale matrix (and thus number of dimensions). Here, *C* is restricted to be diagonal.

For `constraint = "unrestricted"`

or `"diagonal"`

, the external covariates *Z* can be optimally transformed as specified by `constraint.type`

. Choosing the number of covariates equal to the number of dimensions together with `constraint.type = "ordinal"`

, `constraint.ties = "primary"`

will effectively restrict the configuration to parallel regions defined by the categories of the covariates. Note that missing values of the covariates are estimated by the model.

For `constraint = "unique"`

we get the Bentler-Weeks uniqueness model. Hence *X* is of dimension *(n x (n + p))*. This implies that we fit a certain number of dimensions p and, in addition we extract n additional dimensions where each object is scored on a separate dimension. More technical details can be found in the corresponding JSS article (reference see below).

In addition, the user can specify his own constraint function with the following arguments: configuration matrix with starting values (`init`

) (mandatory in this case), matrix *V* (`weightmat`

; based on the weight matrix, see package vignette), external scale matrix (`external`

). The function must return a matrix of resulting configurations.

If no starting configuration is provided, a random starting solution is used. In most applications, this is not a good idea in order to find a well fitting model. The user can fit an exploratory MDS using `mds()`

first, and use the resulting configurations as starting configuration for `smacofConstraint()`

. Alternatively, if the user has starting configurations determined by some underlying theory, they can be used as well.

`delta` |
Observed dissimilarities |

`obsdiss` |
Observed dissimilarities, normalized |

`confdist` |
Configuration dissimilarities |

`conf` |
Matrix of final configurations |

`C` |
Matrix with restrictions |

`stress` |
Stress-1 value |

`spp` |
Stress per point |

`resmat` |
Matrix with squared residuals |

`rss` |
Residual sum-of-squares |

`weightmat` |
Weight matrix |

`ndim` |
Number of dimensions |

`extvars` |
List for each external covariate with a list of class |

`init` |
Starting configuration |

`model` |
Type of smacof model |

`niter` |
Number of iterations |

`nobj` |
Number of objects |

De Leeuw, J. & Mair, P. (2009). Multidimensional scaling using majorization: The R package smacof. Journal of Statistical Software, 31(3), 1-30, https://www.jstatsoft.org/v31/i03/

Mair, P., Groenen, P. J. F., & De Leeuw, J. (2020). More on multidimensional scaling and unfolding in R: smacof version 2. Journal of Statistical Software, Forthcoming.

De Leeuw, J., & Heiser, W. (1980). Multidimensional scaling with restrictions on the configurations. In P. R. Krishnaiah (eds.), Multivariate Analysis V, pp. 501-522. North-Holland.

Borg, I., & Lingoes, J. C. (1980). A model and algorithm for multidimensional scaling with external constraints on the distances. Psychometrika, 45, 25-38.

`smacofSym`

, `smacofRect`

, `smacofIndDiff`

, `smacofSphere`

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 | ```
## theoretical grid restrictions (rectangles; keep covariate ties tied)
fit.rect1 <- mds(rectangles, type = "ordinal", init = rect_constr)
fit.rect2 <- smacofConstraint(rectangles, type = "ordinal", ties = "secondary",
constraint = "diagonal", init = fit.rect1$conf,
external = rect_constr, constraint.type = "ordinal")
plot(fit.rect2)
## regional restrictions morse code data (signal length, strength)
fitMorse1 <- mds(morse, type = "ordinal")
fitMorse1
fitMorse2 <- smacofConstraint(morse, type = "ordinal", constraint = "unrestricted",
external = morsescales[,2:3],
constraint.type = "ordinal",
init = fitMorse1$conf)
fitMorse2
plot(fitMorse2)
## facial expression data I (axial restriction, C diagonal)
Delta <- FaceExp
attr(Delta, "Labels") <- NULL
fitFace <- mds(Delta, type = "ordinal") ## starting solution
Z <- FaceScale[, c(1,3)] ## external variables
fitFaceC1 <- smacofConstraint(Delta, type = "ordinal",
constraint = "diagonal", external = Z, constraint.type = "ordinal",
init = fitFace$conf)
fitFaceC1$C
plot(fitFaceC1, xlab = "Pleasant-Unpleasant", ylab = "Tension-Sleep",
main = "Face Expression (Diagonal Restriction)")
## facial expression data II (C unrestricted)
fitFaceC3 <- smacofConstraint(Delta, type = "ordinal",
constraint = "unrestricted", external = Z, constraint.type = "ordinal",
init = fitFace$conf)
fitFaceC3$C
plot(fitFaceC3, main = "Face Expression (C Unrestricted, Ordinal Transformation)")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.