| Type: | Package |
| Title: | Profile Analysis via Multidimensional Scaling |
| Version: | 0.2.0 |
| Date: | 2026-10-05 |
| Description: | Implements Profile Analysis via Multidimensional Scaling (PAMS) for the identification of population-level core response profiles from cross-sectional and longitudinal person-score data. Each person profile is decomposed into a level component (the person mean) and a pattern component (ipsatized subscores). PAMS uses nonmetric multidimensional scaling via the SMACOF algorithm to identify a small number of core profiles that represent the central response patterns in a sample of any size. Bootstrap standard errors and bias-corrected and accelerated (BCa) confidence intervals for individual core profile coordinates are estimated, enabling significance testing of coordinates that is not available in other profile analysis methods such as cluster profile analysis or latent profile analysis. Person-level weights, R-squared values, and partial correlations with core profiles are also estimated, allowing individual profiles to be interpreted in terms of the core profile structure. PAMS can be applied to both cross-sectional data and longitudinal data, where core trajectory profiles describe how response patterns change over time. Methods are described in Kim and Kim (2024) <doi:10.20982/tqmp.20.3.p230>, de Leeuw and Mair (2009) <doi:10.18637/jss.v031.i03>, and Kruskal (1964) <doi:10.1007/BF02289565>. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/sekangakim/pams |
| BugReports: | https://github.com/sekangakim/pams/issues |
| Depends: | R (≥ 4.0.0) |
| Imports: | smacof (≥ 2.1.0) |
| Suggests: | knitr, lmtest (≥ 0.9.40), rmarkdown, testthat (≥ 3.0.0), tibble |
| VignetteBuilder: | knitr |
| Encoding: | UTF-8 |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Config/roxygen2/version: | 8.1.0 |
| Packaged: | 2026-10-06 01:00:45 UTC; sekangkim |
| Author: | Se-Kang Kim |
| Maintainer: | Se-Kang Kim <sekangandroid@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-10-06 22:00:09 UTC |
Profile Analysis via Multidimensional Scaling
Description
Identifies population-level core response profiles from cross-sectional or
longitudinal person-score data using nonmetric multidimensional scaling
(SMACOF algorithm). Each person profile is decomposed into a level
component (person mean) and a pattern component (ipsatized subscores).
BootSmacof fits a nonmetric MDS solution to the J \times J
inter-variable distance matrix, bootstraps the solution to generate
empirical sampling distributions of core profile coordinates, and computes
bias-corrected and accelerated (BCa) confidence intervals for each
coordinate. Person-level weights, R-squared values, and partial correlations with
core profiles are estimated for all participants, with optional bootstrap
confidence intervals for a selected subset.
Usage
BootSmacof(
testdata,
participant = NULL,
mds = c("smacof", "classical"),
type = c("ordinal", "interval", "ratio", "mspline"),
distance = c("euclid", "sqeuclid"),
scale = FALSE,
nprofile = 3,
direction = rep(1, nprofile),
cl = 0.95,
nBoot = 2000,
testname = NULL,
file = NULL
)
Arguments
testdata |
A data frame or matrix of persons (rows) by subscales (columns). Subscores are assumed to be related and continuous. For longitudinal data, columns should be ordered as all subscales at Time 1 followed by all subscales at Time 2, and so on. |
participant |
An integer vector of row indices identifying persons for
whom individual bootstrap confidence intervals on weights and partial
correlations are computed. If |
mds |
Character string specifying the MDS algorithm. Either
|
type |
Character string specifying the optimal scaling transformation
passed to |
distance |
Character string specifying the distance measure used to
compute the |
scale |
Logical. If |
nprofile |
A positive integer specifying the number of core profiles
(MDS dimensions) to extract. Choose by inspecting stress values across
2-, 3-, and 4-dimensional solutions; Kruskal's (1964) criterion of
stress |
direction |
An integer vector of length |
cl |
Numeric confidence level for BCa intervals. Default is
|
nBoot |
A positive integer specifying the number of bootstrap
samples. A minimum of |
testname |
An optional character vector of length equal to the number
of columns in |
file |
An optional character string giving a file path stem. If
supplied, two CSV files are always written: |
Value
A named list with the following components:
MDSThe MDS fit object for the original data. When
mds = "smacof"this is the full object returned bysmacofSym, including$conf(core profile coordinate matrix,J \times K) and$stress. Whenmds = "classical"this is a minimal list with$confonly.MDSsummaryA list of
nprofiledata frames, one per core profile. Each data frame has rows corresponding to subscales and columns:Ori(original coordinate),Mean(bootstrap mean),SE(bootstrap standard error),LowerandUpper(percentile CI bounds),BCaLowerandBCaUpper(BCa CI bounds). Coordinates whose pointwise BCa CI does not include zero are statistically significant at the stated coordinate-wise level; these intervals are not adjusted for multiplicity.MDSprofileA list of
nprofilematrices, each of dimensionnBoot\timesJ, containing the full bootstrap distribution of core profile coordinates.stresssummaryA one-row data frame with bootstrap summary statistics for the smacof stress value:
Ori,Mean,SE,Lower,Upper,BCaLower,BCaUpper.NULLwhenmds = "classical".stressprofileA numeric vector of length
nBootcontaining bootstrap stress values.NULLwhenmds = "classical".MDSR2A numeric vector of length
nprofilecontaining the R-squared values from regressing each core profile dimension on the remaining dimensions. Low values confirm that the core profiles are not collinear.WeightA matrix of dimension
I \times (2K + 2)containing, for every person: raw weights (w1, ...,wK), level estimate, R-squared value, and partial correlations with each core profile (corDim1, ...,corDimK). The raw weights are unstandardized no-intercept OLS coefficients from regressing the person's ipsatized pattern on the retained coordinate vectors. EachcorDimvalue is the correlation between the residualized person pattern and residualized focal core profile after controlling for the other profiles. Row names are"#1","#2", ...WeightmeanR2The mean R-squared value across all
Ipersons, summarising how well thenprofilecore profiles account for pattern variance in the sample.WeightBA matrix of bootstrap summary statistics (original estimate, mean, SE, lower and upper CI bounds) for the weights of each person in
participant.NULLifparticipantisNULL.PcorrBA matrix of bootstrap summary statistics for the partial correlations of each person in
participant.NULLifparticipantisNULL.nprofileThe number of core profiles extracted.
nBootThe number of bootstrap samples used.
scaleLogical; whether columns were standardised.
testnameCharacter vector of subscale names used.
The returned list has class "pams_fit", while retaining direct
access to every component listed above.
Sign indeterminacy and alignment
MDS coordinate signs are arbitrary. For each bootstrap and jackknife
sample, BootSmacof() aligns each dimension to its original-sample
counterpart by its correlation sign and then reports the orientation
selected through direction. This is sign alignment only: the method
does not perform general rotational alignment or dimension-permutation
matching. Coordinate-wise inference should therefore be interpreted
cautiously when dimensions are weak or nearly interchangeable. A sign
reversal changes only the reported orientation; it does not change
interpoint distances, stress, model fit, or interval exclusion of zero.
References
Davison, M. L. (1996). Multidimensional scaling interest and aptitude profiles: Idiographic dimensions, nomothetic factors. Presidential address to Division 5, American Psychological Association, Toronto.
de Leeuw, J., & Mair, P. (2009). Multidimensional scaling using majorization: SMACOF in R. Journal of Statistical Software, 31(3), 1–30. doi:10.18637/jss.v031.i03
Efron, B., & Tibshirani, R. J. (1993). An introduction to the bootstrap. Chapman & Hall.
Kim, S.-K., & Kim, D. (2024). Utility of profile analysis via multidimensional scaling in R for the study of person response profiles in cross-sectional and longitudinal data. The Quantitative Methods for Psychology, 20(3), 230–247. doi:10.20982/tqmp.20.3.p230
Kruskal, J. B. (1964). Multidimensional scaling by optimizing goodness of fit to a nonmetric hypothesis. Psychometrika, 29, 1–27. doi:10.1007/BF02289565
See Also
smacofSym for the underlying MDS
algorithm.
Examples
# Small toy example (runs automatically)
set.seed(42)
toy_data <- as.data.frame(matrix(rnorm(8 * 4, mean = 10, sd = 2),
nrow = 8, ncol = 4))
colnames(toy_data) <- paste0("S", 1:4)
result <- suppressWarnings(BootSmacof(
testdata = toy_data,
participant = NULL,
mds = "smacof",
type = "ordinal",
distance = "euclid",
nprofile = 2,
direction = c(1, 1),
cl = 0.95,
nBoot = 10,
testname = colnames(toy_data)
))
result$MDS$stress
round(result$WeightmeanR2, 2)
round(result$MDSsummary[[1]], 3)
Plot fitted PAMS core profiles
Description
Displays selected core-profile coordinates and, optionally, their pointwise percentile or BCa confidence limits.
Usage
## S3 method for class 'pams_fit'
plot(
x,
profiles = seq_len(x$nprofile),
interval = c("BCa", "percentile", "none"),
layout = NULL,
labels = TRUE,
label.cex = 0.75,
type = "b",
pch = 19,
col = "black",
ci.col = "steelblue",
ci.lty = 2,
zero.line = TRUE,
zero.col = "grey60",
xlab = "Variable",
ylab = "Coordinate",
main = NULL,
ylim = NULL,
xaxt = if (labels) "n" else "s",
...
)
Arguments
x |
A fitted object returned by [BootSmacof()]. |
profiles |
Integer vector identifying the profiles to display. |
interval |
Confidence limits to draw: '"BCa"' (default), '"percentile"', or '"none"'. |
layout |
Optional integer vector of length two giving the rows and columns of the plotting layout. |
labels |
Logical; show variable names on the horizontal axis. |
label.cex |
Character expansion used for variable labels. |
type, pch, col |
Standard graphical controls for the estimated profile. |
ci.col, ci.lty |
Color and line type for confidence limits. |
zero.line |
Logical; draw a horizontal reference line at zero. |
zero.col |
Color of the zero reference line. |
xlab, ylab |
Axis labels. |
main |
Optional plot title or character vector of titles. |
ylim |
Optional common vertical-axis limits. By default each panel includes its estimate and selected confidence limits. |
xaxt |
Axis annotation setting passed to [graphics::plot()]. |
... |
Additional graphical arguments passed to [graphics::plot()]. |
Value
The fitted object, invisibly.
Examples
set.seed(42)
x <- matrix(rnorm(32), nrow = 8, ncol = 4)
fit <- suppressWarnings(BootSmacof(x, nprofile = 2, nBoot = 10))
plot(fit, profiles = 1:2)
Summarize a fitted PAMS model
Description
Summarize a fitted PAMS model
Usage
## S3 method for class 'pams_fit'
summary(object, digits = 3L, ...)
## S3 method for class 'summary.pams_fit'
print(x, ...)
## S3 method for class 'pams_fit'
print(x, ...)
Arguments
object |
A fitted object returned by [BootSmacof()]. |
digits |
Number of digits retained when the summary is printed. |
... |
Additional arguments passed to or from methods. |
x |
An object returned by 'summary.pams_fit()' or [BootSmacof()]. |
Value
'summary.pams_fit()' returns an object of class 'summary.pams_fit' containing the analysis settings, stress, fit indices, and the number of coordinates whose pointwise BCa interval excludes zero.
Examples
set.seed(42)
x <- matrix(rnorm(32), nrow = 8, ncol = 4)
fit <- suppressWarnings(BootSmacof(x, nprofile = 2, nBoot = 10))
summary(fit)