# Test of small differences in fit # # @author Timo Gnambs # @version 2008-09-29 # # @source MacCallum, R. C., Browne, M. W. & Cai, L. (2006). # Testing differences between nested covariance # structure models: Power analysis and null # hypotheses.Psychological Methods, 11, 19-35. # #################### SETTINGS #################### dfa <- 22 # Degrees of freedom for model A dfb <- 20 # Degrees of freedom for model B alpha <- 0.05 # Significance level n <- 200 # Sample size rmseaa <- 0.06 # RMSEA for model A rmseab <- 0.05 # RMSEA for model B chidiff <- 18 # Observed chi-square difference g <- 1 # Number of groups ################################################## # Test of small difference begins here ddiff <- dfa-dfb #df difference fa <- (dfa*rmseaa**2)/sqrt(g) #model A discrepancy fn value fb <- (dfb*rmseab**2)/sqrt(g) #model B discrepancy fn value ncp <- (n-1)*(fa-fb) #non-centrality parameter cval <- qchisq(1-alpha,df=ddiff,ncp=ncp) #critical value from non-central chi^2 sig <- 1-pchisq(chidiff,df=ddiff,ncp=ncp) #p-value from non-central chi^2 rm(ddiff, fa, fb, ncp, cval) print(c('Test of small differences in fit (McCallum et al., 2006): p=', round(sig,3)))