View source: R/methods_psych.R
model_parameters.PCA | R Documentation |
Format structural models from the psych or FactoMineR packages.
## S3 method for class 'PCA'
model_parameters(
model,
sort = FALSE,
threshold = NULL,
labels = NULL,
verbose = TRUE,
...
)
## S3 method for class 'lavaan'
model_parameters(
model,
ci = 0.95,
standardize = FALSE,
component = c("regression", "correlation", "loading", "defined"),
keep = NULL,
drop = NULL,
verbose = TRUE,
...
)
## S3 method for class 'principal'
model_parameters(
model,
sort = FALSE,
threshold = NULL,
labels = NULL,
verbose = TRUE,
...
)
model |
Model object. |
sort |
Sort the loadings. |
threshold |
A value between 0 and 1 indicates which (absolute) values
from the loadings should be removed. An integer higher than 1 indicates the
n strongest loadings to retain. Can also be |
labels |
A character vector containing labels to be added to the loadings data. Usually, the question related to the item. |
verbose |
Toggle warnings and messages. |
... |
Arguments passed to or from other methods. |
ci |
Confidence Interval (CI) level. Default to |
standardize |
Return standardized parameters (standardized coefficients).
Can be |
component |
What type of links to return. Can be |
keep |
Character containing a regular expression pattern that
describes the parameters that should be included (for |
drop |
See |
For the structural models obtained with psych, the following indices are present:
Complexity (Hoffman's, 1978; Pettersson and Turkheimer, 2010) represents the number of latent components needed to account for the observed variables. Whereas a perfect simple structure solution has a complexity of 1 in that each item would only load on one factor, a solution with evenly distributed items has a complexity greater than 1.
Uniqueness represents the variance that is 'unique' to the
variable and not shared with other variables. It is equal to 1 – communality
(variance that is shared with other variables). A uniqueness
of 0.20
suggests that 20%
or that variable's variance is not shared
with other variables in the overall factor model. The greater 'uniqueness'
the lower the relevance of the variable in the factor model.
MSA represents the Kaiser-Meyer-Olkin Measure of Sampling Adequacy (Kaiser and Rice, 1974) for each item. It indicates whether there is enough data for each factor give reliable results for the PCA. The value should be > 0.6, and desirable values are > 0.8 (Tabachnick and Fidell, 2013).
A data frame of indices or loadings.
There is also a
plot()
-method
for lavaan
models implemented in the
see-package.
Kaiser, H.F. and Rice. J. (1974). Little jiffy, mark iv. Educational and Psychological Measurement, 34(1):111–117
Pettersson, E., and Turkheimer, E. (2010). Item selection, evaluation, and simple structure in personality data. Journal of research in personality, 44(4), 407-420.
Revelle, W. (2016). How To: Use the psych package for Factor Analysis and data reduction.
Tabachnick, B. G., and Fidell, L. S. (2013). Using multivariate statistics (6th ed.). Boston: Pearson Education.
Rosseel Y (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36.
Merkle EC , Rosseel Y (2018). blavaan: Bayesian Structural Equation Models via Parameter Expansion. Journal of Statistical Software, 85(4), 1-30. http://www.jstatsoft.org/v85/i04/
library(parameters)
if (require("psych", quietly = TRUE)) {
# Principal Component Analysis (PCA) ---------
pca <- psych::principal(attitude)
model_parameters(pca)
pca <- psych::principal(attitude, nfactors = 3, rotate = "none")
model_parameters(pca, sort = TRUE, threshold = 0.2)
principal_components(attitude, n = 3, sort = TRUE, threshold = 0.2)
# Exploratory Factor Analysis (EFA) ---------
efa <- psych::fa(attitude, nfactors = 3)
model_parameters(efa,
threshold = "max", sort = TRUE,
labels = as.character(1:ncol(attitude))
)
# Omega ---------
omega <- psych::omega(mtcars, nfactors = 3)
params <- model_parameters(omega)
params
summary(params)
}
# lavaan
library(parameters)
# lavaan -------------------------------------
if (require("lavaan", quietly = TRUE)) {
# Confirmatory Factor Analysis (CFA) ---------
structure <- " visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 "
model <- lavaan::cfa(structure, data = HolzingerSwineford1939)
model_parameters(model)
model_parameters(model, standardize = TRUE)
# filter parameters
model_parameters(
model,
parameters = list(
To = "^(?!visual)",
From = "^(?!(x7|x8))"
)
)
# Structural Equation Model (SEM) ------------
structure <- "
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + a*y2 + b*y3 + c*y4
dem65 =~ y5 + a*y6 + b*y7 + c*y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8
"
model <- lavaan::sem(structure, data = PoliticalDemocracy)
model_parameters(model)
model_parameters(model, standardize = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.