anova: Provide a comparison of nested models and nonnested models...

Description Arguments Value Author(s) See Also Examples

Description

This function will provide averages of model fit statistics and indices for nested models. It will also provide average differences of fit indices and power for likelihood ratio tests of nested models.

Arguments

object

SimResult object being described. Currently at least two objects must be included as arguments

...

any additional arguments, such as additional objects or for the function with result object

Value

A data frame that provides the statistics described above from all parameters. For using with linkS4class{SimResult}, the result is a list with two or three elements:

Author(s)

Alexander M. Schoemann (East Carolina University; schoemanna@ecu.edu), Sunthud Pornprasertmanit (psunthud@gmail.com)

See Also

SimResult for the object input

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
loading1 <- matrix(0, 6, 1)
loading1[1:6, 1] <- NA
loading2 <- loading1
loading2[6,1] <- 0
LY1 <- bind(loading1, 0.7)
LY2 <- bind(loading2, 0.7)
RPS <- binds(diag(1))
RTE <- binds(diag(6))
CFA.Model1 <- model(LY = LY1, RPS = RPS, RTE = RTE, modelType="CFA")
CFA.Model2 <- model(LY = LY2, RPS = RPS, RTE = RTE, modelType="CFA")

# We make the examples running only 5 replications to save time.
# In reality, more replications are needed.
# Need to make sure that both simResult calls have the same seed!
Output1 <- sim(5, n=500, model=CFA.Model1, generate=CFA.Model1, seed=123567)
Output2 <- sim(5, n=500, model=CFA.Model2, generate=CFA.Model1, seed=123567)
anova(Output1, Output2)

# The example when the sample size is varying
Output1b <- sim(NULL, n=seq(50, 500, 50), model=CFA.Model1, generate=CFA.Model1, seed=123567)
Output2b <- sim(NULL, n=seq(50, 500, 50), model=CFA.Model2, generate=CFA.Model1, seed=123567)
anova(Output1b, Output2b)

## End(Not run)

Example output

Loading required package: lavaan
This is lavaan 0.6-3
lavaan is BETA software! Please report any bugs.
 
#################################################################
This is simsem 0.5-14
simsem is BETA software! Please report any bugs.
simsem was first developed at the University of Kansas Center for
Research Methods and Data Analysis, under NSF Grant 1053160.
#################################################################

Attaching package: 'simsem'

The following object is masked from 'package:lavaan':

    inspect

Progress: 1 / 5 
Progress: 2 / 5 
Progress: 3 / 5 
Progress: 4 / 5 
Progress: 5 / 5 
Progress: 1 / 5 
Progress: 2 / 5 
Progress: 3 / 5 
Progress: 4 / 5 
Progress: 5 / 5 
$summary
              chisq df      aic      bic       rmsea       cfi      tli
Object 1   7.321895  9 7435.274 7511.137 0.007856755 0.9992485 1.002620
Object 2 254.916384 10 7680.868 7752.517 0.220531268 0.7643413 0.646512
               srmr
Object 1 0.01167828
Object 2 0.20583363

$diff
 chisq diff     df diff  power diff    aic diff    bic diff  rmsea diff 
247.5944886   1.0000000   1.0000000 245.5944886 241.3798805   0.2126745 
   cfi diff    tli diff   srmr diff 
 -0.2349071  -0.3561077   0.1941554 

$varyParam
NULL

Progress: 1 / 10 
Progress: 2 / 10 
Progress: 3 / 10 
Progress: 4 / 10 
Progress: 5 / 10 
Progress: 6 / 10 
Progress: 7 / 10 
Progress: 8 / 10 
Progress: 9 / 10 
Progress: 10 / 10 
Progress: 1 / 10 
Progress: 2 / 10 
Progress: 3 / 10 
Progress: 4 / 10 
Progress: 5 / 10 
Progress: 6 / 10 
Progress: 7 / 10 
Progress: 8 / 10 
Progress: 9 / 10 
Progress: 10 / 10 
$summary
              chisq df      aic      bic      rmsea       cfi       tli
Object 1   9.361414  9 4153.062 4214.667 0.02595039 0.9901499 0.9906091
Object 2 156.777110 10 4298.478 4356.660 0.22557478 0.7591833 0.6387749
               srmr
Object 1 0.02074946
Object 2 0.20839487

$diff
 chisq diff     df diff  power diff    aic diff    bic diff  rmsea diff 
147.4156960   1.0000000   1.0000000 145.4156960 141.9932317   0.1996244 
   cfi diff    tli diff   srmr diff 
 -0.2309666  -0.3518342   0.1876454 

$varyParam
     N power.1
1   50       1
2   74       1
3   97       1
4  121       1
5  145       1
6  168       1
7  192       1
8  216       1
9  239       1
10 263       1
11 287       1
12 311       1
13 334       1
14 358       1
15 382       1
16 405       1
17 429       1
18 453       1
19 476       1
20 500       1

simsem documentation built on March 29, 2021, 1:07 a.m.

Related to anova in simsem...