You are here

Path analysis

3 posts / 0 new
Last post
mdr's picture
mdr
Offline
Joined: 02/12/2014 - 06:12
Path analysis

Hello,

  1. I've built a simple model with Onyx with no latent variables, a constant, one endogenous observed variable and two exogenous observed variables, with one path each from the exogenous variables and constant to the endogenous variable, to see how Onyx may be used for (eventually, simultaneous) regression equations with only observed variables. I created a data set with random values for the two exogenous variables and defined the endogenous variable as the sum of the constant and the sum of the products of coefficient and exogenous variable (Y=const + b1X1 + b2X2). I used 200 observations.

The estimates of all coefficients was accurate, but the fit measures seem off - particularly for such a simple model. Chi-square is 541.05, RMSEA 0.95, CFI 0.70, and TLI 0.41. Only SRMR suggests a good fit (0.02). Are there any reasons for this?

  1. In other models with no latents - though with far fewer observations - several fit measures were reported as NaN; TLI turned out negative. What might cause this to happen?

  2. Also, at least two text books calculate df as k(k+1)/2 - p where k = # variables and p = # parameters estimated. As I understand it, k(k+1)/2 = number of knowns = number of covariances + the number of correlations. Onyx seems to add k to the formula while reporting observed statistics. What is the reason?

Thanks for your help.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
Onyx, raw data, fit statistics, ref models

Often helpful to describe the model in OpenMx functions. Is this it?

library(OpenMx)
data(myFADataRaw, package="OpenMx")
manifests = paste0("x", 1:3)
myData = myFADataRaw[, manifests]
m1 <- mxModel("m1", type="RAM",
    manifestVars = manifests,
    mxPath(c("x1", "x2"), to = "x3"), # manifest causes
    mxPath(manifests, arrows = 2), # manifest residuals 
    mxPath("one", to = manifests), # manifest means
    mxData(myData, type = "raw")
)
m1 = mxRun(m1)
omxGraphviz(m1)

The missing fit indices are because OpenMx doesn't compute reference models for raw data by default.

The easiest solution to this is to update to OpenMx 2.0 beta (release version expected soon), and add a call to mxRefModels()

ref = mxRefModels(m1, run=TRUE)
summary(m1, refModels = ref)
Summary of m1 
 
free parameters:
       name matrix row col  Estimate  Std.Error
1 m1.A[3,1]      A  x3  x1 0.3865221 0.04235861
2 m1.A[3,2]      A  x3  x2 0.3512717 0.04178546
3 m1.S[1,1]      S  x1  x1 0.9952729 0.06294587
4 m1.S[2,2]      S  x2  x2 1.0228462 0.06468862
5 m1.S[3,3]      S  x3  x3 0.5331745 0.03372066
6 m1.M[1,1]      M   1  x1 2.9879508 0.04461535
7 m1.M[1,2]      M   1  x2 3.0113429 0.04522920
8 m1.M[1,3]      M   1  x3 0.7734044 0.11269218
 
observed statistics:  1500 
estimated parameters:  8 
degrees of freedom:  1492 
-2 log likelihood:  3951.288 
saturated -2 log likelihood:  3693.424 
number of observations:  500 
chi-square:  X2 ( df=1 ) = 257.8639,  p = 5.013631e-58
Information Criteria: 
      |  df Penalty  |  Parameters Penalty  |  Sample-Size Adjusted
AIC:       967.2876               3967.288                       NA
BIC:     -5320.9077               4001.004                 3975.612
CFI: 0.5415045 
TLI: -0.3754866 
RMSEA:  0.716748  [95% CI (0.6304896, 0.8057941)]
OpenMx version number: 2.0.0.3952 

The lack of fit suggests that your manifests have covariances you have not modelled. For instance in this case, adding

m2 <- mxModel(m1, name="m2", mxPath("x1", "x2", arrows = 2) )
m2 = mxRun(m2)
mxCompare(m2,m1
summary(m2)

Gives dramatically better fit...
χ²(1491) = 0, p < 0.001; CFI = 1; TLI = 1; RMSEA = 0

For Onyx help, you should post a link to this question in the Onyx forum... (look in forms for the Onyx group).

Cheers,
tim

mdr's picture
mdr
Offline
Joined: 02/12/2014 - 06:12
Onyx, raw data, fit statistics, ref models

Thank you very much for the detailed answer, will check out your suggestions with my data. mdr