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

Rplot_X.png | 8.94 KB |

Script.R | 802 bytes |

Dear Mike,

thank you very much for your metaSEM-package, I really enjoy working with it!

I tested a model with 8 variables and 3 latent factors and now I would like to check, if there is a common factor for these three latent factors at the superordinate level - is it possible with metaSEM? I was looking for specifications like Gamma matrix in LISREL, but I unfortunately couldn't find anything.

Thank you!

Best wishes,

Nastja

Dear Nastja,

Yes, you may specify both first- and second-order factor models in RAM specification. See e.g., http://openmx.psyc.virginia.edu/docs/OpenMx/2.6.7/Examples_Matrix.html

Alternatively, you may specify the models in equations (lavann syntax) and convert them to RAM specification via lavaan2RAM() in the metaSEM package. Please always check the RAM output as lavaan2RAM() is only experimental. Attached are the examples relevant to your models. Please also note that these two models are equivalent models with the same dfs.

Best,

Mike

Dear Mike,

due to the current situation I have some to complete my old analyses. Would you be so kind and provide me with examples for specifying second-order factor models in RAM?

Thank you!

Best,

nastjuscha

Dear nastjuscha,

There are some examples at https://cran.r-project.org/web/packages/metaSEM/vignettes/Examples.html#two-stage-structural-equation-modeling-tssem You may modify them to fit your case.

If you have specific questions, please let use know.

Best,

Mike

Dear Mike,

thank you! Unfortunately I still don't know where I have to specify the second-order factor. I tried something like this:

Phi2<-matrix(c(1,"0.3

cor1","0.3cor2",".3G_DT","0.3cor1",1,"0.3cor3",".3G_Alpha","0.3

cor2","0.3cor3",1,".3G_Beta",".3G_DT",".3G_Alpha",".3G_Beta",1),ncol=4, nrow=4)Psi2<-Diag(c("0.2

e1","0.2e2","0.2e3","0.2e4","0.2e5","0.2e6","0.2e7",e8","0.2"0.2

e9","0.2e10","0.2e11","0.2e12","0.2e13","0.2e14"))S2<-bdiagMat(list(Psi2, Phi2))

dimnames(S2)[[1]]<-dimnames(S2)[[2]]<-c("M","N","P","5O","5C","5E","5A","5N","6H","6E","6X","6A","6C","6O","DT","Alpha","Beta","G")

S2

Lambda2<-matrix(c(".3

DT_M",".3DT_N",".3DT_P",0,".3DT_5C",0,".3DT_5A",0,".3DT_6H",rep(0,2), ".3

DT_6A", ".3DT_6C",rep(0,5),".3Alpha_5C",0,".3Alpha_5A",".3Alpha_5N",0,".3Alpha_6E",0,".3

Alpha_6A",".3Alpha_6C",rep(0,2),".3Beta_Nar",0,".3Beta_5O",0,".3Beta_5E",rep(0,4),Beta_6X",rep(0,2),".3*Beta_6O",rep(0,14)),ncol=4, nrow=14)".3

A2<-rbind(cbind(matrix(0,ncol=14,nrow=14),Lambda2), matrix(0,ncol=18,nrow=4))

dimnames(A2)[[1]]<-dimnames(A2)[[2]]<-c("M","N","P","5O","5C","5E","5A","5N","6H","6E","6X","6A","6C","6O","DT","Alpha","Beta","G")

A2

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

F2

random2<-tssem2(random1,Amatrix=A2, Smatrix=S2, Fmatrix=F2, intervals="LB")

summary(random2)

The programm is running this code for hours and hours without results. Could you help me, please?

Best,

nastjuscha

Dear nastjuscha,

There are some errors in your model specification, e.g., "0.3cor1" should be "0.3*cor1".

I suggest to use the lavaan specification if you are not familiar with the RAM specification. Here is an example similar to yours.

Best,

Mike

Thank you!

I tried to use lavaan specification like yours but I always have the same error:

RAM <- lavaan2RAM(model2, obs.variables=c("M","N","P","FFMO","FFMC","FFME","FFMA","FFMN","HH","HE","HX","HA","HC","HO"), std.lv=FALSE)

> RAM

$

`A`

M N P FFMO FFMC FFME FFMA FFMN HH HE HX HA HC HO DT Alpha

M "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

MONDT" "0"NONDT" "0"N "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

P "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

PONDT" "0"FFMCONDT" "0FFMO "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

FFMC "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

FFMCONAlpha"FFMAONDT" "0FFME "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

FFMA "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

FFMAONAlpha"FFMNONAlpha"FFMN "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

HH "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

HHONDT" "0"HEONAlpha"HE "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

HX "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

HA "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

HAONDT" "0HAONAlpha"HC "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0

HCONDT" "0HCONAlpha"HO "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

DT "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

Alpha "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

Beta "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

G "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

Beta G

M "0" "0"

N "0

NONBeta" "0"FFMOONBeta" "0"P "0" "0"

FFMO "0

FFMC "0" "0"

FFME "0

FFMEONBeta" "0"HXONBeta" "0"FFMA "0" "0"

FFMN "0" "0"

HH "0" "0"

HE "0" "0"

HX "0

HA "0" "0"

HC "0" "0"

HO "0

HOONBeta" "0"AlphaONG"DT "0" "0"

Alpha "0" "0

Beta "0" "0*BetaONG"

G "0" "0"

$S

M N P FFMO FFMC FFME FFMA

M "0

MWITHM" "0" "0" "0" "0" "0" "0"NWITHN" "0" "0" "0" "0" "0"N "0" "0

P "0" "0" "0

PWITHP" "0" "0" "0" "0"FFMOWITHFFMO" "0" "0" "0"FFMO "0" "0" "0" "0

FFMC "0" "0" "0" "0" "0

FFMCWITHFFMC" "0" "0"FFMEWITHFFME" "0"FFME "0" "0" "0" "0" "0" "0

FFMA "0" "0" "0" "0" "0" "0" "0

FFMAWITHFFMA"FFMNWITHFFMN" "0" "0" "0" "0" "0" "0"FFMN "0" "0" "0" "0" "0" "0" "0"

HH "0" "0" "0" "0" "0" "0" "0"

HE "0" "0" "0" "0" "0" "0" "0"

HX "0" "0" "0" "0" "0" "0" "0"

HA "0" "0" "0" "0" "0" "0" "0"

HC "0" "0" "0" "0" "0" "0" "0"

HO "0" "0" "0" "0" "0" "0" "0"

DT "0" "0" "0" "0" "0" "0" "0"

Alpha "0" "0" "0" "0" "0" "0" "0"

Beta "0" "0" "0" "0" "0" "0" "0"

G "0" "0" "0" "0" "0" "0" "0"

FFMN HH HE HX HA HC HO

M "0" "0" "0" "0" "0" "0" "0"

N "0" "0" "0" "0" "0" "0" "0"

P "0" "0" "0" "0" "0" "0" "0"

FFMO "0" "0" "0" "0" "0" "0" "0"

FFMC "0" "0" "0" "0" "0" "0" "0"

FFME "0" "0" "0" "0" "0" "0" "0"

FFMA "0" "0" "0" "0" "0" "0" "0"

FFMN "0

HH "0" "0

HHWITHHH" "0" "0" "0" "0" "0"HEWITHHE" "0" "0" "0" "0"HE "0" "0" "0

HX "0" "0" "0" "0

HXWITHHX" "0" "0" "0"HAWITHHA" "0" "0"HA "0" "0" "0" "0" "0

HC "0" "0" "0" "0" "0" "0

HCWITHHC" "0"HOWITHHO"HO "0" "0" "0" "0" "0" "0" "0

DT "0" "0" "0" "0" "0" "0" "0"

Alpha "0" "0" "0" "0" "0" "0" "0"

Beta "0" "0" "0" "0" "0" "0" "0"

G "0" "0" "0" "0" "0" "0" "0"

DT Alpha Beta G

M "0" "0" "0" "0"

N "0" "0" "0" "0"

P "0" "0" "0" "0"

FFMO "0" "0" "0" "0"

FFMC "0" "0" "0" "0"

FFME "0" "0" "0" "0"

FFMA "0" "0" "0" "0"

FFMN "0" "0" "0" "0"

HH "0" "0" "0" "0"

HE "0" "0" "0" "0"

HX "0" "0" "0" "0"

HA "0" "0" "0" "0"

HC "0" "0" "0" "0"

HO "0" "0" "0" "0"

DT "0

DTWITHDT" "0" "0" "0"AlphaWITHAlpha" "0" "0"Alpha "0" "0

Beta "0" "0" "0*BetaWITHBeta" "0"

G "0" "0" "0" "1"

$F

M N P FFMO FFMC FFME FFMA FFMN HH HE HX HA HC HO DT Alpha Beta G

M 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

N 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

P 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

FFMO 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0

FFMC 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0

FFME 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0

FFMA 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0

FFMN 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0

HH 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0

HE 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0

HX 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0

HA 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0

HC 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0

HO 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0

$M

M N P FFMO FFMC FFME FFMA FFMN HH HE HX HA HC HO DT Alpha Beta G

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

> fitmodel2 <- tssem2(random1, RAM=RAM, intervals="LB")

Error in wls(Cov = pooledS, aCov = aCov, n = tssem1.obj$total.n, Amatrix = Amatrix, :

"Smatrix" matrix is not specified.

Why is Smatrix not specified? I don't understand it, that's why I tried it with RAM specification.

Best,

nastjuscha

Dear Nastja,

Please provide the data and R code so that the errors can be replicated.

Best,

Mike

Dear Mike,

here you are. I hope you can help me to solve the problem.

Best,

Nastja

Dear Nastja,

The issue was the variance of the latent independent variable DT had not been fixed yet. Please see the attached file.

Please also note that I have not checked whether or not the model makes sense.

Best,

Mike