Dear Mike & colleagues,

I'm currently sitting at a moderator analysis with the new OSMASEM approach (continuous moderators in MASEM - yeah!).

Unfortunately I get an error message, which I can't assign. I want to use HDI (Human Development Index) values as moderator variables for the regression coefficients (A-Matrix).

However, I get the following error message when I try to create the model with the moderator.

Code:

M1 <- create.vechsR(A0=RAM1$A, S0=RAM1$S, Ax=Ax) Error in as.vector(data) : no method for coercing this S4 class to a vector

I'd be happy if you had any idea how to solve this problem. Does it maybe have anything to do with the type of data I have?

I have my code and my data attached.

Best

Marius

Hi Marius,

It seems to work fine after correcting some syntax errors.

Hope it helps.

Best,

Mike

Thank you so much for your help. Now everything is running smoothly. I only have two more questions for a better understanding:

1) If I remove one of my covariances (k2), then I gain a degree of freedom. Then why is the CFI still not calculated? (I have defined the argument Saturated=TRUE)

2 Although I have defined residuals (p22, p33, p44 and p55), they are not estimated - why is that? In the conventional TSSEM approach they are also estimated.

Thank you very much for your help.

Hi Marius,

1) We don't know how to define CFI in this model. So we only provide the chi-square statistic, RMSEA, and SRMR. For the SRMR, you may need to use the osmasemSRMR().

2) The residuals are functions of the other parameters. You may get the residuals by using mxEval(Smatrix, fit0$mx.fit).

Best,

Mike

Thank you very much for the clarification. Really great work you did with the OSMASEM.

In the TSSEM approach there is the possibility to specify the indirect effects - would you recommend to calculate the Sobel test (or something similar) manually in the OSMASEM?

Hi Marius,

You can define an indirect effect and get the Wald SE with the mxSE(). Alternatively, you can also get the likelihood-based CI of the indirect effect. It may take a while to get the CIs as it is computationally intensive. Please see the attached examples.

Mike

Hi Mike,

Thanks for this great example. I'm still learning how to use the OSMASEM approach which seems very useful. I am able to successfully run the analyses, but I was wondering if when testing moderating effects, do I have to populate the Ax matrix for all paths in my model, or can I just estimate the moderating effects for only the paths that I'm interested in testing the moderating effect for?

Thanks,

Sergio

Hi Sergio,

I think that you can just test the paths that you are interested in. However, the OSMASEM approach is very new. We need to see whether testing a few paths (or all paths) may create some strange models. Your feedback on your data is highly appreciated.

Mike

Hi Mike,

I'm trying to estimate this model in OSMASEM, and I can't. I get this error:

> M0 <- create.vechsR(A0=RAM4$A, S0=RAM4$S, F0=RAM4$F)

> ## Create heterogeneity variances

> T0 <- create.Tau2(RAM=RAM4, RE.type="Symm")

> mx.fit0 <- osmasem(model.name="No moderator", Mmatrix=M0, Tmatrix=T0, data=my.df)

Warning message:

The following error occurred while evaluating the subexpression '

`No moderator.Tau2`

+`No moderator.V`

' during the evaluation of 'expCov' in model 'No moderator' : non-conformable arraysmodel4<- 'out =~ PAT2out

PAT + CIT2outCIT+ out ~ SIZE2OUT

SIZ + IO2OUTIO + CON2OUTCON + RD2OutRD+ RD ~ SIZE2RD

SIZ + IO2RDIO + CON2RDCONSIZ+ IO ~~ p10

+ IO ~~ p11

CONSIZ+ SIZ ~~ 1

+ IO ~~ 1

IOCON+ CON ~~ 1

+ RD ~~ p20

RDout+ out ~~ p21

+ PAT ~~ p22

PATCIT'+ CIT ~~ p23

plot(model4, color="yellow", layout = "tree2")

RAM4 <- lavaan2RAM(model4, obs.variables=c("IO","SIZ","CON","RD","PAT","CIT"), std.lv = FALSE)

I can estimate this same model in TSSEM without any problems:

my.vec <- readStackVec("matrix1.dat")

my.vec <- lapply(my.vec,function(x)

{dimnames(x) <- list(c("IO","SIZ","CON","RD","PAT","CIT"),

c("IO","SIZ","CON","RD","PAT","CIT"))

x})

f<-c(0,0,0,0,"0.2

g_E","0.2g_O")F<-matrix(f,ncol = 1,nrow = 6)

F

A1 <- matrix(c(0,0,0,0,0,0,

0,0,0,0,0,0,

0,0,0,0,0,0,

"0.3

IO2RD","0.3IO2SIZ","0.3CON2RD",0,0,0,IO2out","0.20,0,0,0,0,0,

0,0,0,0,0,0),

nrow=6, ncol=6, byrow=TRUE)

A1

A<-rbind(cbind(A1, F), matrix (c("0.2

SIZ2out","0.2CON2OUT","0.2RD2OUT",0,0,0), ncol=7, nrow=1))e5"),nrow = 1,ncol = 1)A

dimnames(A)<-list(c("IO","SIZ","CON","RD","PAT","CIT","out"), c("IO","SIZ","CON","RD","PAT","CIT","out"))

A

phi<-matrix(c("0.3

psi<-matrix(c(1,"0.3

e4","0.3e6",0,0,0,"0.3

e4",1,0,0,0,0,e6",0,1,0,0,0,"0.3

0,0,0,"0.3

e1",0,0,e2",0,0,0,0,0,"0.3

0,0,0,0,0,"0.3*e3"),

nrow=6, ncol=6, byrow=TRUE)

S<-bdiagMat(list(psi,phi))

dimnames(S)<-list(c("IO","SIZ","CON","RD","PAT","CIT","out"), c("IO","SIZ","CON","RD","PAT","CIT","out"))

S

FM<-create.Fmatrix(c(1,1,1,1,1,1,0), as.mxMatrix = FALSE)

dimnames(FM)<-list(c("IO","SIZ","CON","RD","PAT","CIT"), c("IO","SIZ","CON","RD","PAT","CIT","out"))

FM

Random1 <- tssem1(my.vec, my.n, method = "REM")

summary(Random1)

Random2<-tssem2(Random1, Amatrix = A,Smatrix = S,Fmatrix = FM, model.name = "IBTmediator",

diag.constraints = FALSE)

summary(Random2)

Do you know why I can't estimate this model in OSMASEM?

Thanks for the amazing software and approach. I would really appreciate your help with this.

Thanks,

Sergio

Hi Sergio,

Could you please post the data and R code so that I can test it?

Best,

Mike

Hi Mike;

Thank you for adding the new OSMASEM functionality to metaSEM. This can have very helpful implications.

I have been trying to use OSAMASEM for my data. However, there is a significant discrepancy between what TSSEM results and OSMASEM (without moderation) results for my data. While TSSEM results show a much better fit (which make theoretical sense), the OSMASEM without moderation results are very poor and do not make theoretical sense. I have followed your code on GitHub for Nohe15A1 in developing my code. I appreciate any insight you might have to resolve this issue.

My code and data can be downloaded from this link, just in case you need to see them: https://www.dropbox.com/s/h0m90ugnra6v136/OSMASEM.zip?dl=0

Thank you very much

Hamed

Hi Hamed,

The results seem comparable between the OSMASEM and TSSEM. The OSMASEM indeed fits slightly better than that in the TSSEM.

Mike

Hi Mike;

Thank you for your help. Indeed, I was missing "Saturated = TRUE" command in summary(), which prevented me from comparing OSMASEM results with tssem results. I have some questions regarding OSMASEM with a moderator.

I am testing one moderator on five relations in my model (RAM1$A). The results show df=-1 and consequently TLI=1 and RMSEA=0. Should df and goodness-of-fit indices be interpreted the same way as in tssem? Meaning that should df always be positive in OSMASEM? and can I interpret RMSEA and TLI the same as in tssem? Also, if df should be kept positive, is it ok to remove some of the moderations from Ax matrix?

Thank you

Hamed

Hi Hamed,

Could you please post the R code and output?

Mike

Hi Mike;

I am sorry I forgot to paste the link. Here are the data and the code: https://www.dropbox.com/s/h0m90ugnra6v136/OSMASEM.zip?dl=0

Thank you

Hamed

Hi Hamed,

The

`Saturated = TRUE`

argument is only used for models without any moderators.When there are moderators, the goodness-of-fit indices do not apply here as the df is negative. The only way to test the model is to use the likelihood ratio test to compare the models with and without the moderators. In this example, it tests if all the five coefficients in

`A1`

are zero.Best,

Mike

Hi Mike;

Thank you for your response. ANOVA() is very helpful. It clarified the issue for me.

Best

Hamed

Hello,

I want to ask if it is okay to get negative minus2LL. I run the moderator models, and get negative minus2LL just like yours.

Model Statistics:

| Parameters | Degrees of Freedom | Fit (-2lnL units)

Model: 21 159517 -417246

Saturated: NA NA NA

Independence: NA NA NA

Number of observations/statistics: 39884/159538

The following thread may be useful. https://openmx.ssri.psu.edu/thread/1831

Thanks for your help!