Performs Wald or score tests

modelsearch(x, k = 1, dir = "forward", type = "all", ...)

Arguments

x

lvmfit-object

k

Number of parameters to test simultaneously. For equivalence the number of additional associations to be added instead of rel.

dir

Direction to do model search. "forward" := add associations/arrows to model/graph (score tests), "backward" := remove associations/arrows from model/graph (wald test)

type

If equal to 'correlation' only consider score tests for covariance parameters. If equal to 'regression' go through direct effects only (default 'all' is to do both)

...

Additional arguments to be passed to the low level functions

Value

Matrix of test-statistics and p-values

See also

Author

Klaus K. Holst

Examples


m <- lvm();
regression(m) <- c(y1,y2,y3) ~ eta; latent(m) <- ~eta
regression(m) <- eta ~ x
m0 <- m; regression(m0) <- y2 ~ x
dd <- sim(m0,100)[,manifest(m0)]
e <- estimate(m,dd);
modelsearch(e,messages=0)
#>  Score: S P(S>s)   Index  holm      BH       
#>  3.152    0.07584  y3~~x  0.5065    0.07584  
#>  3.152    0.07584  y3~x   0.5065    0.07584  
#>  3.152    0.07584  x~y3   0.5065    0.07584  
#>  3.152    0.07584  y1~~y2 0.5065    0.07584  
#>  3.152    0.07584  y1~y2  0.5065    0.07584  
#>  3.152    0.07584  y2~y1  0.5065    0.07584  
#>  4.127    0.04221  y1~~x  0.5065    0.06332  
#>  4.127    0.04221  y1~x   0.5065    0.06332  
#>  4.127    0.04221  x~y1   0.5065    0.06332  
#>  4.127    0.04221  y2~~y3 0.5065    0.06332  
#>  4.127    0.04221  y2~y3  0.5065    0.06332  
#>  4.127    0.04221  y3~y2  0.5065    0.06332  
#>  23.48    1.26e-06 y2~~x  2.269e-05 3.781e-06
#>  23.48    1.26e-06 y2~x   2.269e-05 3.781e-06
#>  23.48    1.26e-06 x~y2   2.269e-05 3.781e-06
#>  23.48    1.26e-06 y1~~y3 2.269e-05 3.781e-06
#>  23.48    1.26e-06 y1~y3  2.269e-05 3.781e-06
#>  23.48    1.26e-06 y3~y1  2.269e-05 3.781e-06
modelsearch(e,messages=0,type="cor")
#>  Score: S P(S>s)   Index  holm      BH       
#>  3.152    0.07584  y3~~x  0.1688    0.07584  
#>  3.152    0.07584  y1~~y2 0.1688    0.07584  
#>  4.127    0.04221  y1~~x  0.1688    0.06332  
#>  4.127    0.04221  y2~~y3 0.1688    0.06332  
#>  23.48    1.26e-06 y2~~x  7.562e-06 3.781e-06
#>  23.48    1.26e-06 y1~~y3 7.562e-06 3.781e-06