metaSEM
http://openmx.psyc.virginia.edu/taxonomy/term/44/0
enThis forum is about the metaSEM package for meta-analysis
http://openmx.psyc.virginia.edu/thread/2946
<p><a href="http://courses.nus.edu.sg/course/psycwlm/internet">Mike Cheung's</a> metaSEM package is introduced <a href="http://courses.nus.edu.sg/course/psycwlm/Internet/metaSEM">here</a></p>
<p>Post questions to this forum</p>
http://openmx.psyc.virginia.edu/thread/2946#commentsmetaSEMSat, 26 Apr 2014 21:26:16 +0000tbates2946 at http://openmx.psyc.virginia.eduErrors when including covariates in metaSEM
http://openmx.psyc.virginia.edu/thread/3963
<p>I have been attempting to add covariates to a network meta-analytic model that I'm fitting in metaSEM. As a brief bit of background, the network meta-analytic model is designed to model comparisons between a reference group and a set of other groups. Each comparison between the reference and other groups is modeled as a separate outcome. The S matrix in these models is often quite sparse because it is often the case that only ~half the studies contain multi-group designs, so one often needs to place constraints (e.g., with RE.constraints in metaSEM) on the between-studies covariance matrix for the model to be identifiable.</p>
<p>I am able to fit the model with a covariate using the mvmeta package in R, and I have verified that there is variance in my covariate for each of the outcomes (i.e., comparisons between reference and other groups) in the meta-analysis. However, when I attempt to fit the model with the single covariate in metaSEM, I receive the following error:</p>
<p>Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :<br />
0 (non-NA) cases</p>
<p>Does anybody have any idea what's happening here? For reference, I have tried fitting the covariate model on subsets of the data (i.e., using only one of the 11 outcomes from the meta-analysis) without generating these errors. My data and a script are attached.</p>
<table id="attachments" class="sticky-enabled">
<thead><tr><th>Attachment</th><th>Size</th> </tr></thead>
<tbody>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/Data for metaSEM forum_0.csv">Data for metaSEM forum.csv</a></td><td>134.09 KB</td> </tr>
<tr class="even"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/Code for metaSEM forum.R">Code for metaSEM forum.R</a></td><td>2.06 KB</td> </tr>
</tbody>
</table>
http://openmx.psyc.virginia.edu/thread/3963#commentsmetaSEMTue, 10 Mar 2015 15:59:51 +0000forscher3963 at http://openmx.psyc.virginia.eduNot positive definite error when all within-studies covariance matrices are positive definite
http://openmx.psyc.virginia.edu/thread/3962
<p>Hi Mike (and the rest of the forum),</p>
<p>Thanks so much for maintaining your metaSEM package!</p>
<p>I have been trying to fit a variation of a network meta-analysis model using your package. In particular, I need to impose specific constraints on the estimated between-studies covariance matrix. However, my question is not about the constraints that I'm imposing, but rather about a not positive definite error that I haven't been able to figure out.</p>
<p>If you read in the attached data and use the check_pd() function to test whether the within-studies covariance matrices are positive definite, you will see that they all are. However, when I attempt to run my model using meta(), I get the following error:</p>
<p>"The job for model 'Meta analysis with ML' exited abnormally with the error message: MxComputeGradientDescent: fitfunction Meta analysis with ML.fitfunction is not finite (Expected covariance matrix for continuous variables is not positive-definite in data row 32)"</p>
<p>What's odd is that I've fit a similar model using the mvmeta package (without the constraints on the between-studies covariance matrix that I want -- this isn't possible in mvmeta) without any errors. So, I'm forced to conclude that either I've mis-specified my model using meta() or that something strange is occurring within meta() or mxRun().</p>
<p>Do you have any suggestions for what might be happening?</p>
<table id="attachments" class="sticky-enabled">
<thead><tr><th>Attachment</th><th>Size</th> </tr></thead>
<tbody>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/Data for metaSEM forum.csv">Data for metaSEM forum.csv</a></td><td>25.79 KB</td> </tr>
<tr class="even"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/Script for metaSEM forum 03 06 15.R">Script for metaSEM forum 03 06 15.R</a></td><td>1.87 KB</td> </tr>
</tbody>
</table>
http://openmx.psyc.virginia.edu/thread/3962#commentsmetaSEMSat, 07 Mar 2015 03:52:25 +0000forscher3962 at http://openmx.psyc.virginia.eduDifferent results with tssem2 and wls function
http://openmx.psyc.virginia.edu/thread/3944
<p>Dear all,</p>
<p> I read in previous forum that it was possible to apply tssem2 over a given pooled correlation matrix with the function wls(), as it is a wrapper of tssem2. </p>
<p> I have found some inconsistent results when using wls() fuction, so I tried to take the pooled correlation matrix obtained by applying a random effect model with the function tssem1, and then analyze it with wls function to check it those results are the same to those obtained by applying tssem2 directly. With those two procedures I obtained differente results, even though they are suppose to be same.</p>
<p> I guess that one possible explanation is that in tssem 1 the sample covariance matrix takes into account the diferential precision of each correlation, and that in wls(), because the asymtotic covariance matrix is calculated over the pooled matrix with the sum of the sample, it does not take into account the diferential sampling variation of each correlation...am I right? Then, should I interpret the results of both procedures (tssem2 and wls) in a different way? I mean, when I am using wls: am I taking into account the diferential variability of each correlation? I calculated the sampling covariance matrix with the function asyCov. I will really appreciate any comment or answer to this question!! </p>
<p> Finally, I would like to thank Mike Cheung for the amazing metaSEM package!</p>
<p>Thank you vey much in advance and kind regards.</p>
http://openmx.psyc.virginia.edu/thread/3944#commentsmetaSEMSat, 24 Jan 2015 11:34:32 +0000Daniel883944 at http://openmx.psyc.virginia.eduStage 1: cluster
http://openmx.psyc.virginia.edu/thread/3936
<p>Dear Mike,</p>
<p> I am sorry for bothering you again...but I have another question!</p>
<p> In the document attached (DATOS1.dat) I have six matrices. I did a cluster analysis in order to find some moderators (commands are attached in Fixed-cluster.R), dividing the data in two blocks : the first and second matrices are in one block, and the other four matrices in another. When I execute the first stage, it turned out that the second block (the fourth last matrices) are homogeneous (Chi-square=28.9735, df=26, p=.3123). Until here, everything seems correct.</p>
<p> After that, I tried to carried out a fixed-effect model with only the four matrices (commands are attached in Fixed-effects(4).R) that were homogeneous in the previous analysis (you can find these matrices in CLUSTER.dat). The results from the first stage are not what I expected (Chi-square=60.2163, df=26, p<.01). Now, those four matrices do not seem to be homogeneus as we reject the null hypothesis. Why is this happening? Does it have something to do with the way I encode the missing variables?</p>
<p> And this is not all. I did the same analysis in LISREL (sintaxisLISREL.txt, I could not attach the .cfg file) with the four homogeneous matrices and the chi-square is almost the double (175.387), and the null hyphotesis is also rejected.</p>
<p> I guess that I'm doing some wrong...but I cant find what. Once again, thank you very much for your attention and the time you spend in this forum answering all our doubts! </p>
<p>King Regards,</p>
<p>Belén</p>
<table id="attachments" class="sticky-enabled">
<thead><tr><th>Attachment</th><th>Size</th> </tr></thead>
<tbody>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/DATOS1.dat">DATOS1.dat</a></td><td>633 bytes</td> </tr>
<tr class="even"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/CLUSTER.dat">CLUSTER.dat</a></td><td>415 bytes</td> </tr>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/sintaxisLISREL.txt">sintaxisLISREL.txt</a></td><td>2 KB</td> </tr>
<tr class="even"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/Fixed-Cluster.R">Fixed-Cluster.R</a></td><td>1.93 KB</td> </tr>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/Fixed-effect(4).R">Fixed-effect(4).R</a></td><td>709 bytes</td> </tr>
</tbody>
</table>
http://openmx.psyc.virginia.edu/thread/3936#commentsmetaSEMWed, 26 Nov 2014 16:05:17 +0000Bfcastilla3936 at http://openmx.psyc.virginia.eduFitting 2 stage random effects (with indirect effects)
http://openmx.psyc.virginia.edu/thread/3930
<p>Dear Mike,</p>
<p> I am having some problems when fitting a path model in the second stage (Random Effects Model) which includes some indirect effects. In the documents attached you can find the data (.dat), the commands I used (.R) and the path model I would like to fit (.png).</p>
<p> The error that appears is the next one:</p>
<p>Error in `$<-.data.frame`(`*tmp*`, "Std.Error", value = NA) :<br />
replacement has 1 row, data has 0<br />
In addition: Warning messages:<br />
1: In pchisq(tT, df = dfT, lower.tail = FALSE) : NaNs produced<br />
2: In sqrt(max((tT - dfT)/(n - 1), 0)/dfT) : NaNs produced<br />
Warning message:<br />
In model 'TSSEM2 random effects model' NPSOL returned a non-zero status code 1. The final iterate satisfies the optimality conditions to the accuracy requested, but the sequence of iterates has not yet converged. NPSOL was terminated because no further improvement could be made in the merit function (Mx status GREEN). </p>
<p>Thanks in advance,</p>
<p>Belén.</p>
<table id="attachments" class="sticky-enabled">
<thead><tr><th>Attachment</th><th>Size</th> </tr></thead>
<tbody>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/DATOS22.dat">DATOS22.dat</a></td><td>635 bytes</td> </tr>
<tr class="even"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/Path model.png">Path model.png</a></td><td>12.39 KB</td> </tr>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/CommandR.R">CommandR.R</a></td><td>1.16 KB</td> </tr>
</tbody>
</table>
http://openmx.psyc.virginia.edu/thread/3930#commentsmetaSEMMon, 10 Nov 2014 16:29:13 +0000Bfcastilla3930 at http://openmx.psyc.virginia.eduUsing Mixed-effects model in TSSEM for moderation analysis
http://openmx.psyc.virginia.edu/thread/3929
<p>Hi Mike,</p>
<p>I am using random-effects MASEM and I would like to include a binary characteristic of the studies in my analysis. Based on your recent paper (Cheung, 2014), I know that mixed-effects model can be used to include study characteristics as the predictors in a MASEM model. However, I was wondering how I can do this using metaSEM codes. I could not find any metaSEM code example in your papers/website that explain how I should code and indicate the study characteristics in tssem1() and tssem2() functions in metaSEM.</p>
<p>Your help would be very much appreciated,</p>
<p>Thank you,<br />
-- Hamed</p>
<p>Cheung, M. W.-L. 2014. "Fixed- and Random-Effects Meta-Analytic Structural Equation Modeling: Examples and Analyses in R," Behavior Research Methods (46:1), pp. 29-40.</p>
http://openmx.psyc.virginia.edu/thread/3929#commentsmetaSEMSat, 08 Nov 2014 02:18:49 +0000HAMED3929 at http://openmx.psyc.virginia.eduInstalling metaSEM
http://openmx.psyc.virginia.edu/thread/3897
<p>Dear Mike,</p>
<p> I'm having some problems for installing metaSEM package...This error always appears, and I cannot find the solution:</p>
<p>install.packages("metaSEM")<br />
Installing package into ‘D:/Documents/R/win-library/3.0’<br />
(as ‘lib’ is unspecified)<br />
Warning in install.packages :<br />
package ‘metaSEM’ is not available (for R version 3.0.2)</p>
<p>Where could I find a new version of the package?</p>
<p>Thanks in advantage,</p>
<p>Kind regards.</p>
http://openmx.psyc.virginia.edu/thread/3897#commentsmetaSEMThu, 11 Sep 2014 17:27:57 +0000Bfcastilla3897 at http://openmx.psyc.virginia.eduEquality Constraints
http://openmx.psyc.virginia.edu/thread/3606
<p>Hi Mike,</p>
<p>In my stage two analysis I would like to impose equality constraints on some items' error variances in the S matrix to be consistent with the models from the original studies. </p>
<p>I wonder whether this is feasible at all, because here (<a href="http://courses.nus.edu.sg/course/psycwlm/Internet/metaSEM/masem.html" title="http://courses.nus.edu.sg/course/psycwlm/Internet/metaSEM/masem.html">http://courses.nus.edu.sg/course/psycwlm/Internet/metaSEM/masem.html</a>) you wrote "Since we are conducting a correlation structure analysis, the error variances are not free parameters."</p>
<p>If it is possible, could you please provide a syntax example how to implement the equality constraints? </p>
<p>Many thanks for your help!<br />
Johannes</p>
http://openmx.psyc.virginia.edu/thread/3606#commentsmetaSEMThu, 03 Jul 2014 11:41:19 +0000jbauer3606 at http://openmx.psyc.virginia.eduBayesian MASEM
http://openmx.psyc.virginia.edu/thread/3439
<p>Dear Mike</p>
<p> I remembered you mentioned about Bayesian approach to MASEM in discussion part of your article.<br />
I think this topic is very intriguing to me and to unknown others. Could you detail more about the issue here?<br />
If you don't mine, I hope you to recommend some direct reference on this issue.<br />
Personally I ask questions as follows,<br />
what might be advantages of Bayesian approach in comparison to TSSEM or GLS?<br />
In Bayesian, is WLS replaced by Bayesian process? or just modified by it? or other than the replacement?<br />
Can I understand Bayesian approach into MASEM on the basis of typical Bayesian SEM?<br />
What might be difference that should be borne in mind?</p>
<p> Sorry for being too discursive.<br />
Excuse me, I just want to know more about Bayesian MASEM particularly.<br />
and I consider it as a worthy question hopefully.<br />
I look forward to your response. </p>
http://openmx.psyc.virginia.edu/thread/3439#commentsmetaSEMWed, 25 Jun 2014 15:08:33 +0000James Lee3439 at http://openmx.psyc.virginia.edutssem2 over a given pooled correlation matrix
http://openmx.psyc.virginia.edu/thread/3410
<p>Hi again Mike, </p>
<p>I was wondering if this is possible:<br />
Having the pooled correlation matrix and their standard errors, do you have any way to apply directly the second stage of tssem over that data? Any help would be very much appreciated. </p>
<p>Thanks a lot, </p>
<p>Laura</p>
http://openmx.psyc.virginia.edu/thread/3410#commentsmetaSEMWed, 25 Jun 2014 00:07:25 +00003410 at http://openmx.psyc.virginia.eduNot positive definite matrix
http://openmx.psyc.virginia.edu/thread/3409
<p>Hi Mike,</p>
<p>I'm making a lot of progress with the package but I still have some questions.<br />
When I try to run the tssem1 I get some non-positive definite matrix.<br />
I think it is because the determinant is lower than 0. Do you have implemented partial least square or ridge to resolve this problem?</p>
<p>Thank you in advantage,</p>
<p>Laura</p>
http://openmx.psyc.virginia.edu/thread/3409#commentsmetaSEMTue, 24 Jun 2014 23:58:16 +00003409 at http://openmx.psyc.virginia.edunot positive definite and NA errors
http://openmx.psyc.virginia.edu/thread/3408
<p>Hi Mike, </p>
<p>I am currently trying to fit a multivariate metaSEM model. I am getting a non-positive definite matrix when fitting a random effects model, and this is likely expected due to a lot missing data in the attached datafile. Would you agree that this is the reason behind the non-positive definite error? Please also note that I tried running the model with fewer studies that provided more data (the number of studies went from 108 to 44) but the errors were the same. </p>
<p>Additionally, I can’t seem to fit the fixed effects model. Given that I am new to R, I was hoping you could look at my code below and let me know how you have handled “NA” or missing values in metaSEM. Below is all the code I have used, as well as the errors. </p>
<p>Thanks in advance, </p>
<p>Yusra</p>
<p>#importing the dataset with a matrix for each sample<br />
my.full <- readFullMat("T:/matrix.dat")</p>
<p>#creating an object with the sample sizes<br />
n <- ("100 100 100 100 100 100 241 45 70 122 119 119 447 56 41 38 103 57 192 105 62 48 56 123 56 123 121 103 300 128 106 20 17 75 10 19 21 492 153 107 71 123 23 15 14 22 131 727 30 297 60 125 37 140 88 182 735 45 300 300 77 136 162 65 166 60 75 87 59 57 97 129 242 83 54 78 75 30 60 105 65 64 92 101 120 88 144 120 464 104 296 120 121 95 76 60 256 251 317 52 622 80 297 171 98 354 690 88")</p>
<p>#random effects model<br />
> random.full <- tssem1(my.full, n, method = "REM", RE.type="Symm", RE.startvalues=0.1, RE.lbound=1e-10, I2="I2q", model.name=NULL,suppressWarnings=TRUE)<br />
Error in function (x, n, cor.analysis = TRUE, dropNA = FALSE, as.matrix = TRUE, :<br />
x is not positive definite!</p>
<p>#fixed effects model<br />
> fixed1 <- tssem1(my.full$data, n$n, method = "FEM", cor.analysis = TRUE, cluster = NULL, RE.type= "Symm", suppressWarnings=FALSE)<br />
Error in !all.equal(my.range[1], my.range[2]) : invalid argument type<br />
In addition: Warning messages:<br />
1: In min(x, na.rm = na.rm) :<br />
no non-missing arguments to min; returning Inf<br />
2: In max(x, na.rm = na.rm) :<br />
no non-missing arguments to max; returning -Inf</p>
<table id="attachments" class="sticky-enabled">
<thead><tr><th>Attachment</th><th>Size</th> </tr></thead>
<tbody>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/matrix.dat">matrix.dat</a></td><td>62.18 KB</td> </tr>
</tbody>
</table>
http://openmx.psyc.virginia.edu/thread/3408#commentsmetaSEMTue, 24 Jun 2014 15:32:00 +0000yahmed3408 at http://openmx.psyc.virginia.eduError running REM in tssem1
http://openmx.psyc.virginia.edu/thread/3384
<p>Hi Mike,<br />
I am enjoying so much your package MetaSEM, thanks a lot! This is making a great advance in meta-analysis.<br />
I am having a bit of problem running random effects with tseem1, any help would be very much appreciated!<br />
I am trying to replicate Digman97 using a larger sample, here an example of a reduced sample of my data and the error I got.<br />
> random1 <- tssem1(neo$data, neo$n, method="REM", RE.type="Diag")<br />
Error: The reference '21' in mxMatrix("Stand", nrow = p, ncol = p, free = TRUE, values = jitter(vechs(cov2cor(x.new))), name = "S", labels = acovName) is illegal because it can be interpreted as a number</p>
<p>Am I missing anything?<br />
Thanks in advanced!<br />
Laura.</p>
<p>[img_assist|nid=3383|title=Error running REM in tssem1|desc=|link=none|align=left|width=100|height=50]</p>
<table id="attachments" class="sticky-enabled">
<thead><tr><th>Attachment</th><th>Size</th> </tr></thead>
<tbody>
<tr class="odd"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/ex.xls">ex.xls</a></td><td>84 KB</td> </tr>
<tr class="even"><td><a href="http://openmx.psyc.virginia.edu/sites/default/files/neo.R">neo.R</a></td><td>803 bytes</td> </tr>
</tbody>
</table>
http://openmx.psyc.virginia.edu/thread/3384#commentsmetaSEMMon, 23 Jun 2014 22:21:14 +00003384 at http://openmx.psyc.virginia.edudifference between corrected input and raw input
http://openmx.psyc.virginia.edu/thread/3051
<p> Dear professor Mike</p>
<p> I remember that you seem to mention from one of your article that a performance of MASEM model with and without artifact correction is worthy of scholarly attention.<br />
Am I right? By the way, It has been the topic i am always wondering about since i read your article.<br />
Corrected correlation might actually cause systematic bias, to some degree, compared to raw correlation.<br />
However, this bias has nothing to do with performance maybe because it is more likely to do with estimation method and sample sizes.</p>
<p> Performance Comparison between two model is feasible? then, what can be absolute criteria for that?<br />
I would like to ask your opinion on that issue.</p>
http://openmx.psyc.virginia.edu/thread/3051#commentsmetaSEMThu, 15 May 2014 14:31:46 +0000James Lee3051 at http://openmx.psyc.virginia.edu