Learn R Programming

lavaSearch2 (version 1.0.0)

compareSearch: Compare Methods to Identify Missing Local Dependencies in a LVM

Description

Compare methods to identify missing local dependencies in a LVM

Usage

compareSearch(object, alpha = 0.05, method.p.adjust, statistic, trace = 1,
  ...)

Arguments

object

a lvm model.

alpha

the significance level.

method.p.adjust

the method used to adjust the p.values for multiple comparisons. Ignored when using the max statistic. Can be any method that is valid for the stats::p.adjust function (e.g. "fdr").

statistic

statistic used to perform the test. Can the likelihood ratio test ("LR"), the score ("score") or the max statistic ("max").

trace

should the execution be traced?

...

additional arguments to be passed to findNewLink and .modelsearch2, see details.

Value

a latent variable model

Details

Argument link:

  • lvmfit object: when not specified all possible additional links are considered.

  • other objects: this argument must be specified.

Argument ... passed to findNewLink, see the documentation of this function:

  • exclude.var

  • rm.latent_latent

  • rm.endo_endo

  • rm.latent_endo

Argument ... passed to modelsearch2:

  • alpha: the significance threshold for retaining a new link.

  • method.max: the method used to compute the distribution of the max statistic. See lava.options()$search.calcMaxDist.

  • ncpus: the number of cpus that can be used for the computations.

  • nStep: the maximum number of links that can be added to the model.

  • na.omit: should model leading to NA for the test statistic be ignored. Otherwise this will stop the selection process.

Examples

Run this code
# NOT RUN {
mSim <- lvm(Y~G+X1+X2)
addvar(mSim) <- ~Z1+Z2+Z3+Z4+Z5+Z6
df.data <- lava::sim(mSim, 1e2)

mBase <- lvm(Y~G)
addvar(mBase) <- ~X1+X2+Z1+Z2+Z3+Z4+Z5+Z6
e.lvm <- estimate(mBase, data = df.data)

# }
# NOT RUN {
res <- compareSearch(e.lvm, statistic = c("score","Wald"),
                     method.p.adjust = c("holm","fdr","max"))
res
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab