Learn R Programming

regsem (version 0.1.2)

cv_regsem: The main function that ties together and runs the models.

Description

The main function that ties together and runs the models.

Usage

cv_regsem(model, n.lambda = 100, mult.start = TRUE, multi.iter = 100,
  jump = 0.002, type = "none", fit.ret = c("rmsea", "BIC"),
  fit.ret2 = c("train", "test"), data = NULL, optMethod = "nlminb",
  gradFun = "ram", hessFun = "none", parallel = "no", Start = "default",
  subOpt = "nlminb", longMod = F, optNL = "NLOPT_LN_NEWUOA_BOUND",
  fac.type = "cfa", matrices = "extractMatrices", pars_pen = NULL,
  diff_par = NULL, LB = -Inf, UB = Inf, calc = "normal", tol = 1e-10,
  max.iter = 50000, missing = "listwise", ...)

Arguments

model
lavaan output object.
n.lambda
number of penalization values to test.
mult.start
Logical. Whether to use multi_optim() (TRUE) or regsem() (FALSE).
multi.iter
number of random starts for multi_optim
jump
Amount to increase penalization each iteration.
type
penalty type.
fit.ret
Fit indices to return.
fit.ret2
Return fits from just train sample?
data
Optional dataframe. Only required for missing="fiml".
optMethod
solver to use.
gradFun
gradient function to use.
hessFun
hessian function to use.
parallel
whether to parallelize the processes?
Start
type of starting values to use.
subOpt
type of optimization to use in the optimx package.
longMod
longitudinal model?
optNL
type of optimization to use in the NLopt package.
fac.type
using cfa or efa type of model.
matrices
function to use for extracting RAM matrices.
pars_pen
parameter indicators to penalize.
diff_par
parameter values to deviate from.
LB
lower bound vector.
UB
upper bound vector
calc
type of calc function to use with means or not.
tol
absolute tolerance for convergence.
max.iter
max iterations for optimization.
missing
How to handle missing data. Current options are "listwise" and "fiml".
...
Any additional arguments to pass to regsem() or multi_optim().

Examples

Run this code
library(lavaan)
HS <- data.frame(scale(HolzingerSwineford1939[,7:15]))
mod <- '
f =~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9
'
outt = cfa(mod,HS)

cv.out = cv_regsem(outt,type="ridge",gradFun="none",n.lambda=100)

Run the code above in your browser using DataLab