stabsel: Stability selection

View source: R/stabsel.R

stabselR Documentation

Stability selection

Description

Stability selection

Usage

stabsel(
  data,
  model,
  det.range = FALSE,
  from,
  to,
  times = 50,
  jump = 0.01,
  detr.nlambda = 20,
  n.lambda = 40,
  n.boot = 100,
  det.thr = FALSE,
  p = 0.8,
  p.from = 0.5,
  p.to = 1,
  p.jump = 0.05,
  p.method = "aic",
  type = "lasso",
  pars_pen = "regressions",
  ...
)

Arguments

data

data frame

model

lavaan syntax model.

det.range

Whether to determine the range of penalization values for stability selection through bootstrapping. Default is FALSE, from and to arguments are then needed. If set to TRUE, then jump, times and detr.nlambda arguments will be needed.

from

Minimum value of penalization values for stability selection.

to

Maximum value of penalization values for stability selection.

times

Number of bootstrapping sample used to determine the range. Default is 50.

jump

Amount to increase penalization each iteration. Default is 0.01

detr.nlambda

Number of penalization values to test for determining range.

n.lambda

Number of penalization values to test for stability selection.

n.boot

Number of bootstrap samples needed for stability selection.

det.thr

Whether to determine the probability threshold value. Default is FALSE, p is then needed. If set to TRUE, p.from, p.to, p.method arguments will be needed.

p

Probability threshold: above which selection probability is the path kept in the modle. Default value is 0.8.

p.from

Lower bound of probability threshold to test. Default is 0.5.

p.to

Upper bound of probability threshold to test. Default is 1.

p.jump

Amount to increase threshold each iteration. Default is 0.05.

p.method

Which fit index to use to choose a final model?

type

Penalty type

pars_pen

Parameter indicators to penalize.

...

Any additional arguments to pass to regsem() or cv_regsem().

Examples


library(regsem)
# put variables on same scale for regsem
HS <- data.frame(scale(HolzingerSwineford1939[,7:15]))
mod <- '
f =~ 1*x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9
x1 ~~ r1*x2;x1 ~~ r2*x3;x1 ~~ r3*x4;x1 ~~ r4*x5
'
outt = cfa(mod, HS)

stabsel.out = stabsel(data=HS,model=mod,det.range=TRUE,detr.nlambda=20,n.lambda=5,
                    n.boot=10,p=0.9,type="alasso", p.method="aic",
                    pars_pen=c("r1","r2","r3","r4"))
stabsel.out$selection_results



Rjacobucci/regsem documentation built on June 3, 2023, 5:20 a.m.