stress {optiscale}R Documentation

Stress coefficients for opscale

Description

Calculates stress coefficients summarizing lack of fit between two vectors.

Usage

stress(x, ...)

calc.stress(quant, os, rescale = FALSE, 
   os.raw.mean = mean(os, na.rm = TRUE), 
   os.raw.sd = sd(os, na.rm = TRUE))

Arguments

x

Object of class opscale

quant

Data vector.

os

Vector of optimally-scaled data

rescale

If TRUE, the optimally-scaled data have been rescaled to the mean and standard deviation of the original qualitative data vector that was used in the optimal scaling transformation.

os.raw.mean

User-specified mean for optimally-scaled data, defaults to mean of os. Only needed if rescale = TRUE.

os.raw.sd

User-specified standard deviation for optimally-scaled data, defaults to standard deviation of os. Only needed if rescale = TRUE.

...

Ignored

Value

stress() and calc.stress() both produce a vector with three elements:

stress1

Kruskals Stress 1 coefficient

stress2

Kruskals Stress 2 coefficient

raw.stress

Sum of squared residuals between quant and os

Warning

If using calc.stress(), the stress coefficients must be created using "raw" optimally scaled values. That is, the OS values should NOT be rescaled to the mean and standard deviation of the original qualitative data.

Examples

  ###   x1 is vector of qualitative data
  ###   x2 is vector of quantitative values
            x1 <- c(1,1,1,1,2,2,2,3,3,3,3,3,3)     
            x2 <- c(3,2,2,2,1,2,3,4,5,2,6,6,4)     
  ###   Optimal scaling, specifying that x1
  ###   is ordinal-discrete, optimally scaled 
  ###   values are not rescaled
     op.scaled <- opscale(x.qual=x1, x.quant=x2,   
                  level=2, process=1,
                  rescale=FALSE)              
  ###  Calculate stress coefficients
    stress(op.scaled)
  ###   Same results can be obtained with:
    calc.stress(op.scaled$quant, op.scaled$os)                               

[Package optiscale version 1.2.3 Index]