This question was

migrated

from Stack Overflow because it can be answered on Cross Validated.

Migrated 3 days ago

.

I am doing some psychometric analysis of a measure. Based on parallel analysis and my own theoretical interpretation, it seems like extracting two factors is the ideal solution for this measure; however, I observed a Heywood case on one of the items in this factor solution. To fix this, I conducted a regularized EFA using regsem following the first example in this tutorial. This produces a cvregsem class object which I can extract loadings from. See code below:

ATSPPHEFAmod = efaModel(nFactors = 2, variables =colnames(ATSPPHItems))

regsem_mod = sem(ATSPPHEFAmod, data = ATSPPHItems,int.ov.free = FALSE,int.lv.free = FALSE, std.lv = TRUE,std.ov = TRUE,auto.fix.single = FALSE, se = "none")

Loadings = extractMatrices(regsem_mod)$A[extractMatrices(regsem_mod)$A>0]

Cors =unique(extractMatrices(regsem_mod)$S[grepl("f",colnames(extractMatrices(regsem_mod)$S)) &extractMatrices(regsem_mod)$S>0])

results_loadings = cv_regsem(model = regsem_mod,#
                             pars_pen = "loadings",
                             mult.start = TRUE,
                             multi.iter = 10, 
                             metric = "BIC",
                             n.lambda = 200, 
                             type = "lasso", 
                             jump = 10^-5,
                             lambda.start = 0.0001)

results_both = cv_regsem(model = regsem_mod,pars_pen = c(Loadings, Cors),mult.start = TRUE, multi.iter = 10,metric = "BIC",n.lambda = 200, type = "lasso", jump = 10^-5,lambda.start = 0.0001, verbose = FALSE)

# loading parameters of best solution
loads_best = results_both$final_pars[Loadings]
loads_best

However, I also need factor scores calculated with the new penalized model to use as predictors in regressions. results_both does not seem to contain them and I don't think I can use methods like lavaanPredict() due to the object class. How can I calculate the factor scores in this case?