Attachment | Size |
---|---|
TSSEM script [6] | 5.9 KB |
Sample data file [7] | 361 bytes |
Hello, I was hoping someone might be able to help with use of the impliedR function in the context of a TSSEM model. I am conducting a 2-stage SEM following the Cheung guide here: https://cran.r-project.org/web/packages/metaSEM/vignettes/Examples.html#two-stage-structural-equation-modeling-tssem
An anonymous peer reviewer commented that: “From the R code, it seems that the a, b, and c path coefficients are directly treated as the correlation coefficients in the analyses. This is wrong! The path coefficient a is the same as that of the correlation. But the other paths (b and c) are different from those of the correlation coefficients. You may use the impliedR function in the metaSEM package to convert path coefficients to correlation matrices. The first example in the help manual shows how to do it for a mediation model.”
I am able to run implied R to convert path coefficients as suggested in the guide (https://rdrr.io/cran/metaSEM/man/impliedR.html):
ADDED CODE to convert path coefficients using implied R>>>>>>>>
A1_impliedR <- impliedR(Amatrix = A$values, Smatrix = S)
> A1_impliedR
Amatrix:
Treatment Change.in.sleep.outcome Change.in.DBAS
Treatment 0.00 0.00 0
Change.in.sleep.outcome 0.20 0.00 0
Change.in.DBAS 0.24 0.24 0
Smatrix:
Treatment Change.in.sleep.outcome Change.in.DBAS
Treatment 1 0.00 0.00000
Change.in.sleep.outcome 0 0.96 0.00000
Change.in.DBAS 0 0.00 0.86176
Fmatrix:
Treatment Change.in.sleep.outcome Change.in.DBAS
Treatment 1 0 0
Change.in.sleep.outcome 0 1 0
Change.in.DBAS 0 0 1
Sigma of the observed variables:
Treatment Change.in.sleep.outcome Change.in.DBAS
Treatment 1.000 0.200 0.288
Change.in.sleep.outcome 0.200 1.000 0.288
Change.in.DBAS 0.288 0.288 1.000
Sigma of both the observed and latent variables:
Treatment Change.in.sleep.outcome Change.in.DBAS
Treatment 1.000 0.200 0.288
Change.in.sleep.outcome 0.200 1.000 0.288
Change.in.DBAS 0.288 0.288 1.000
Correlation matrix: TRUE
Sigma of the observed variables is positive definite: TRUE
Sigma of both the observed and latent variables is positive definite: TRUE
Minimum value of the fit function (it should be close to 0 for correlation solution: 0
Status code of the optimization (it should be 0 for correlation solution: 0
But am now wondering how best to incorporate these values into the second stage of my tssem model - is it acceptable to simply substitute values from the 'sigma of the observed variables' matrix into my A matrix for the second stage, like this?
SUBSTITUTING 'b' and 'c' path estimates
A$values[3] <- A1_impliedR$SigmaObs[3]
A$values[6] <- A1_impliedR$SigmaObs[6]
Full code and sample data file attached (impliedR functions added to lines 110-115).
Any advice would be much appreciated! Thank you!