stress | R Documentation |
opscale
Calculates stress coefficients summarizing lack of fit between two vectors.
stress(x, ...)
calc.stress(quant, os, rescale = FALSE,
os.raw.mean = mean(os, na.rm = TRUE),
os.raw.sd = sd(os, na.rm = TRUE))
x |
Object of class |
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.raw.sd |
User-specified standard deviation for optimally-scaled data, defaults to
standard deviation of |
... |
Ignored |
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 |
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.
### 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.