Learn R Programming

lavaSearch2 (version 1.3.5)

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

[numeric 0-1] the significance cutoff for the p-values. When the p-value is below, the corresponding link will be added to the model and the search will continue. Otherwise the search will stop.

method.p.adjust

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

statistic

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

trace

[logical] should the execution of the function be traced?

...

arguments passed to modelsearch2.

Value

A list containing:

  • newlink: a list containing for each statistic-method.p.adjust the local dependencies.

  • table.coef: a data.frame object containing for each statistic-method.p.adjust the estimated coefficients.

  • ls.search: a list containing for each statistic-method.p.adjust a modelsearch2 object.

Details

This function calls the modelsearch2 function to find the local dependencies.

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
# }

Run the code above in your browser using DataLab