The penfaPredict
function estimates the factor scores
from a fitted penalized factor model. The factor scores are the estimated
values ("predictions") of the common factors.
penfaPredict( object, newdata = NULL, method = "regression", label = TRUE, append.data = FALSE, assemble = FALSE )
object | An object of class |
---|---|
newdata | An optional data frame containing the same variables as the
ones appearing in the original data frame used for fitting the model in
|
method | Character indicating the method for computing the factor
scores. Possible options are |
label | Logical. If |
append.data | Logical. If |
assemble | Logical. If |
A matrix with the factor scores from a fitted penfa
model.
Geminiani E. (2020), "A penalized likelihood-based framework for single and multiple-group factor analysis models" (Doctoral dissertation, University of Bologna). Available at http://amsdottorato.unibo.it/9355/.
data(ccdata) syntax = 'help =~ h1 + h2 + h3 + h4 + h5 + h6 + h7 + 0*v1 + v2 + v3 + v4 + v5 voice =~ 0*h1 + h2 + h3 + h4 + h5 + h6 + h7 + v1 + v2 + v3 + v4 + v5' alasso_fit <- penfa(## factor model model = syntax, data = ccdata, std.lv = TRUE, ## penalization pen.shrink = "alasso", eta = list(shrink = c("lambda" = 0.01), diff = c("none" = 0)), ## automatic procedure strategy = "auto", gamma = 4)#> Computing weights for alasso (ML estimates)... done. #> #> Automatic procedure: #> Iteration 1 : 0.00298271 #> Iteration 2 : 0.00452604 #> #> Largest absolute gradient value: 12.76355181 #> Fisher information matrix is positive definite #> Eigenvalue range: [180.2917, 9189645] #> Trust region iterations: 15 #> Factor solution: admissible #> Effective degrees of freedom: 27.12936fscores <- penfaPredict(alasso_fit)