Attachment | Size |
---|---|

example1.txt | 17.99 KB |

SEM.R | 2.95 KB |

example.pdf | 98.36 KB |

Dear all, Please help me fixing this problem.

The data set has (please see example diagram)

+ 3 continuous variables(X1, X2, X3) for a latent variable (intercept)

+ 3 mediators (one binary X8 and two categorical variables X6, X7)

+ 1 dependent variable (X4).

This coding was based on the post about Categorical Data in both independent and dependent variables https://openmx.ssri.psu.edu/thread/3883

When I run SEM.R model I have following error message.

Error in mxRAMObjective(A = "A", S = "S", M = "M", thresholds = "Threshold") :

argument 'F' is not a string (the name of the 'F' matrix)

When I delete #Threshold matrix from the SEM.R, I have the following error message.

Error: The following error occurred while evaluating the subexpression '`Linear Growth Curve Model Path Specification.I`

- `Linear Growth Curve Model Path Specification.A`

' during the evaluation of 'expVars' in model 'Linear Growth Curve Model Path Specification' : non-conformable arrays

# Threshold matrix

mxMatrix(type = "Full", nrow = 1, ncol = 7, free = c(T, T, T, T, T, T, T),

values = c(-0.18173563, -1.27430357,-1.75717640, 0.37933827,-0.01542988, -0.82819033, -0.12312234), byrow = T, dimnames = list(c(), c("X1","X2","X3","X4","X6","X7","X8")),

name = "Threshold"),

# Means and covaraince matrix

mxRAMObjective(A="A", S="S", M="M", thresholds = "Threshold")

I know you are busy! But I will return you back! I appreciate your time!

Hyoshin,

University of Maryland

The first error you mention is occurring because

`mxRAMObjective()`

needs a character string value for its argument`F`

, which has no default. The character string you provide is supposed to be the name of the 'F' (filter) matrix in the MxModel. I think what you want to do instead isThe second error you mention is occurring because your identity matrix

`"I"`

is 7x7, but your asymmetric-paths matrix`"A"`

ends up being 8x8, since you have 7 manifest variables and 1 latent variable. Redefine`"I"`

asFurther, I notice the 7th line of your script is

I suspect you want to do

You'll also need to provide

`X8`

with thresholds, for instance,Finally, if you're using

`mxThreshold()`

in a RAM-type model, I'm not sure you need the thresholds matrix. I think you can simply adjust your objective toThis syntax, starting right after the dataset is loaded, appears to work:

You will want to adjust starting values, though.

Edit: In particular, note the extra parentheses in

`mxAlgebra(diag2vec(fmat%&%(F%&%(solve(I-A)%&%S))), name="expVars")`

. One needs to be careful about order-of-operations when using the quadratic product operator,`%&%`

.Please allow me to work on this. I will come back with good results.

I really appreciate both of you spending time for this problem. Hope you can get rewards and good lucks in your work!