smacofConstraint: SMACOF Constraint

View source: R/smacofConstraint.R

smacofConstraintR Documentation

SMACOF Constraint

Description

SMACOF with internal constraints on the configurations.

Usage

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)

Arguments

delta

Either a symmetric dissimilarity matrix or an object of class "dist"

constraint

Type of constraint: "unrestricted", "unique", "diagonal", or a user-specified function (see details)

external

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

ndim

Number of dimensions

type

MDS type: "interval", "ratio", "ordinal" (nonmetric MDS), or "mspline"

weightmat

Optional matrix with dissimilarity weights

init

Optional matrix with starting values for configurations. If NULL random starts are used (see details).

ties

Tie specification for non-metric MDS only: "primary", "secondary", or "tertiary"

verbose

If TRUE, intermediate stress is printed out

modulus

Number of smacof iterations per monotone regression call

itmax

Maximum number of iterations

eps

Convergence criterion

spline.degree

Degree of the spline for "mspline" MDS type

spline.intKnots

Number of interior knots of the spline for "mspline" MDS type

constraint.type

Transformation for external covariates: "ratio", "interval", "ordinal", "spline", or "mspline")

constraint.ties

Tie specification for external covariates with constraint.type = "ordinal": "primary", "secondary", or "tertiary"

constraint.spline.intKnots

Number of interior knots for external covariates with constraint.type = "spline" or "mspline"

constraint.spline.degree

Degree of the spline for external covariates with constraint.type = "spline" or "mspline"

Details

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.

Value

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 "optscal"

init

Starting configuration

model

Type of smacof model

niter

Number of iterations

nobj

Number of objects

References

De Leeuw, J. & Mair, P. (2009). Multidimensional scaling using majorization: The R package smacof. Journal of Statistical Software, 31(3), 1-30, doi: 10.18637/jss.v031.i03

Mair, P., Groenen, P. J. F., De Leeuw, J. (2022). More on multidimensional scaling in R: smacof version 2. Journal of Statistical Software, 102(10), 1-47. doi: 10.18637/jss.v102.i10

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.

See Also

smacofSym, smacofRect, smacofIndDiff, smacofSphere

Examples



## 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)")

smacof documentation built on May 6, 2022, 9:05 a.m.