anova: Compare Nested Models with Likelihood Ratio Statistic

Description Usage Arguments Value Note Author(s) Examples

Description

It compares nested models with the likelihood ratio statistic from either wls, meta, meta3X or reml objects. It is a wrapper of mxCompare.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'wls'
anova(object, ..., all=FALSE)
## S3 method for class 'meta'
anova(object, ..., all=FALSE)
## S3 method for class 'meta3X'
anova(object, ..., all=FALSE)
## S3 method for class 'reml'
anova(object, ..., all=FALSE)

Arguments

object

An object or a list of objects of either class wls, class meta, class meta3 or class reml. It will be passed to the base argument in mxCompare.

...

An object or a list of objects of either class wls, class meta, class meta3 or class reml. It will be passed to the comparison argument in mxCompare.

all

A boolean value on whether to compare all bases with all comparisons. It will be passed to the all argument in mxCompare.

Value

A table of comparisons between the models in base and comparison.

Note

When the objects are class wls, the degrees of freedom in the base and comparison models are incorrect, while the degrees of freedom of the difference between them is correct. If users want to obtain the correct degrees of freedom in the base and comparison models, they may individually apply the summary function on the base and comparison models.

Author(s)

Mike W.-L. Cheung <[email protected]>

Examples

1
2
3
4
5
6
7
8
9
## Test the significance of a predictor with likelihood ratio test
## Model0: No predictor
model0 <- meta(y=yi, v=vi, data=Hox02, model.name="No predictor")

## Model1: With a predictor
model1 <- meta(y=yi, v=vi, x=weeks, data=Hox02, model.name="One predictor")

## Compare these two models
anova(model1, model0) 

Example output

Loading required package: OpenMx
To take full advantage of multiple cores, use:
  mxOption(NULL, 'Number of Threads', parallel::detectCores())
"SLSQP" is set as the default optimizer in OpenMx.
mxOption(NULL, "Gradient algorithm") is set at "central".
mxOption(NULL, "Optimality tolerance") is set at "6.3e-14".
mxOption(NULL, "Gradient iterations") is set at "2".
sh: 1: cannot create /dev/null: Permission denied
sh: 1: wc: Permission denied
           base   comparison ep minus2LL df        AIC   diffLL diffdf
1 One predictor         <NA>  3 13.90435 17 -20.095649       NA     NA
2 One predictor No predictor  2 27.79916 18  -8.200837 13.89481      1
             p
1           NA
2 0.0001933314

metaSEM documentation built on Sept. 29, 2017, 5:07 p.m.