Published on *OpenMx* (http://openmx.psyc.virginia.edu)

By *neale*

Created *10/31/2009 - 16:33*

Sat, 10/31/2009 - 16:33 — neale [1]

So a question was on SEMNET the other day, as to whether there were any free SEM packages that do power calculations. In essence, OpenMx does, given a bit of help from the R package pwr. Basically, one would fit the true model to the data, fix one or more parameters to predetermined values (usually to zero) and refit the model. Suppose that the difference in the -2lnL fit functions (as might be obtained from two mxRun commands

sat<-mxRun(saturated)

and

sub <-mxRun(submodel)

then the difference in the fit of these two models would be:

deltachi<-mxEval(objective,sub) - mxEval(objective,sat)

and the difference in the degrees of freedom would be (sorry this is crude but df is not healthy in OpenMx yet)

deltadf<-length(sat@output$estimate) - length(sub@output$estimate)

To compute the power to reject the null hypothesis at significance level alpha=.05, we could use:

require(stats)

alpha<-.05

1-pchisq(qchisq(1-alpha,deltadf),deltadf,deltachi)

This probably belongs in the documentation somewhere, for now it is just a convenient aide-memoire pour moi.

**Links:**

[1] http://openmx.psyc.virginia.edu/users/neale

[2] http://openmx.psyc.virginia.edu/thread/298

[3] http://openmx.psyc.virginia.edu/thread/132

[4] http://openmx.psyc.virginia.edu/forums/openmx-help/openmx-structural-equation-modeling