R version 4.1.1 (2021-08-10) -- "Kick Things" Copyright (C) 2021 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin17.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. [R.app GUI 1.77 (7985) x86_64-apple-darwin17.0] [Workspace restored from /Users/srikanthparameswaran/.RData] [History restored from /Users/srikanthparameswaran/.Rapp.history] > ### Step 1 > library("metaSEM") Loading required package: OpenMx OpenMx may run faster if it is compiled to take advantage of multiple cores. "SLSQP" is set as the default optimizer in OpenMx. mxOption(NULL, "Gradient algorithm") is set at "central". mxOption(NULL, "Optimality tolerance") is set at "6.3e-14". mxOption(NULL, "Gradient iterations") is set at "2". > > ### Step 2 > data3 <- read.csv("/Users/srikanthparameswaran/Desktop/TSSEM 3/M2/M2 Data.csv") > nvar <- 5 > varnames <- c("A","B","C","D","E") > labels <- list(varnames,varnames) > cordat <- list() > > for (i in 1:nrow(data3)){ + cordat[[i]] <- vec2symMat(as.matrix(data3[i,2:11]),diag = FALSE) + dimnames(cordat[[i]]) <- labels} > > data3$data<-cordat > > pattern.na(data3$data, show.na = FALSE) A B C D E A 377 49 62 297 315 B 49 377 26 57 60 C 62 26 377 62 60 D 297 57 62 377 260 E 315 60 60 260 377 > pattern.n(data3$data, data3$Corr_Sample) A B C D E A 153507 19045 22861 121371 126080 B 19045 153507 11326 21828 23389 C 22861 11326 153507 22694 22587 D 121371 21828 22694 153507 101765 E 126080 23389 22587 101765 153507 > > random_stage1<- tssem1(data3$data, data3$Corr_Sample, method="REM", RE.type="Diag") > summary(random_stage1) Call: meta(y = ES, v = acovR, RE.constraints = Diag(paste0(RE.startvalues, "*Tau2_", 1:no.es, "_", 1:no.es)), RE.lbound = RE.lbound, I2 = I2, model.name = model.name, suppressWarnings = TRUE, silent = silent, run = run) 95% confidence intervals: z statistic approximation (robust=FALSE) Coefficients: Estimate Std.Error lbound ubound z value Pr(>|z|) Intercept1 -0.1555873 0.0427820 -0.2394384 -0.0717362 -3.6367 0.0002761 *** Intercept2 0.2689317 0.0325704 0.2050948 0.3327686 8.2569 2.220e-16 *** Intercept3 0.2454403 0.0128759 0.2202041 0.2706766 19.0620 < 2.2e-16 *** Intercept4 0.3860312 0.0134787 0.3596135 0.4124489 28.6402 < 2.2e-16 *** Intercept5 0.0636387 0.0569760 -0.0480323 0.1753096 1.1169 0.2640210 Intercept6 -0.0251060 0.0332812 -0.0903359 0.0401240 -0.7544 0.4506336 Intercept7 -0.0513371 0.0424873 -0.1346107 0.0319365 -1.2083 0.2269351 Intercept8 0.4737624 0.0242643 0.4262053 0.5213195 19.5251 < 2.2e-16 *** Intercept9 0.1033250 0.0300813 0.0443667 0.1622833 3.4349 0.0005929 *** Intercept10 0.2029748 0.0151562 0.1732693 0.2326803 13.3922 < 2.2e-16 *** Tau2_1_1 0.0863077 0.0181553 0.0507239 0.1218914 4.7539 1.996e-06 *** Tau2_2_2 0.0620042 0.0117783 0.0389192 0.0850892 5.2643 1.407e-07 *** Tau2_3_3 0.0452124 0.0040930 0.0371903 0.0532345 11.0463 < 2.2e-16 *** Tau2_4_4 0.0536825 0.0046003 0.0446660 0.0626989 11.6693 < 2.2e-16 *** Tau2_5_5 0.0815652 0.0234106 0.0356813 0.1274491 3.4841 0.0004938 *** Tau2_6_6 0.0598359 0.0119885 0.0363390 0.0833328 4.9911 6.003e-07 *** Tau2_7_7 0.1050560 0.0198394 0.0661715 0.1439405 5.2953 1.188e-07 *** Tau2_8_8 0.0328008 0.0065504 0.0199621 0.0456394 5.0074 5.516e-07 *** Tau2_9_9 0.0506167 0.0100229 0.0309721 0.0702613 5.0501 4.416e-07 *** Tau2_10_10 0.0557539 0.0052965 0.0453730 0.0661347 10.5266 < 2.2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Q statistic on the homogeneity of effect sizes: 26567.06 Degrees of freedom of the Q statistic: 1238 P value of the Q statistic: 0 Heterogeneity indices (based on the estimated Tau2): Estimate Intercept1: I2 (Q statistic) 0.9723 Intercept2: I2 (Q statistic) 0.9619 Intercept3: I2 (Q statistic) 0.9516 Intercept4: I2 (Q statistic) 0.9642 Intercept5: I2 (Q statistic) 0.9707 Intercept6: I2 (Q statistic) 0.9605 Intercept7: I2 (Q statistic) 0.9771 Intercept8: I2 (Q statistic) 0.9308 Intercept9: I2 (Q statistic) 0.9536 Intercept10: I2 (Q statistic) 0.9590 Number of studies (or clusters): 377 Number of observed statistics: 1248 Number of estimated parameters: 20 Degrees of freedom: 1228 -2 log likelihood: 19.4068 OpenMx status1: 0 ("0" or "1": The optimization is considered fine. Other values may indicate problems.) > vec2symMat(coef(random_stage1, select="fixed"), diag = FALSE) [,1] [,2] [,3] [,4] [,5] [1,] 1.0000000 -0.15558730 0.26893171 0.24544034 0.38603123 [2,] -0.1555873 1.00000000 0.06363865 -0.02510597 -0.05133706 [3,] 0.2689317 0.06363865 1.00000000 0.47376240 0.10332504 [4,] 0.2454403 -0.02510597 0.47376240 1.00000000 0.20297483 [5,] 0.3860312 -0.05133706 0.10332504 0.20297483 1.00000000 > > ### Step 3 > for (i in 1:length(data3$data)){ + for (j in 1:nrow(data3$data[[i]])){ + if (sum(is.na(data3$data[[i]][j,]))==nvar-1) + {data3$data[[i]][j,j] <- NA} + }} > > pattern.na(data3$data, show.na = FALSE) A B C D E A 335 49 62 297 315 B 49 72 26 57 60 C 62 26 70 62 60 D 297 57 62 345 260 E 315 60 60 260 354 > pattern.n(data3$data, data3$Corr_Sample) A B C D E A 137077 19045 22861 121371 126080 B 19045 26643 11326 21828 23389 C 22861 11326 25094 22694 22587 D 121371 21828 22694 139610 101765 E 126080 23389 22587 101765 143035 > > random_stage1<- tssem1(data3$data, data3$Corr_Sample, method="REM", RE.type="Diag") > summary(random_stage1) Call: meta(y = ES, v = acovR, RE.constraints = Diag(paste0(RE.startvalues, "*Tau2_", 1:no.es, "_", 1:no.es)), RE.lbound = RE.lbound, I2 = I2, model.name = model.name, suppressWarnings = TRUE, silent = silent, run = run) 95% confidence intervals: z statistic approximation (robust=FALSE) Coefficients: Estimate Std.Error lbound ubound z value Pr(>|z|) Intercept1 -0.1555873 0.0427820 -0.2394384 -0.0717362 -3.6367 0.0002761 *** Intercept2 0.2689317 0.0325704 0.2050948 0.3327686 8.2569 2.220e-16 *** Intercept3 0.2454403 0.0128759 0.2202041 0.2706766 19.0620 < 2.2e-16 *** Intercept4 0.3860312 0.0134787 0.3596135 0.4124489 28.6402 < 2.2e-16 *** Intercept5 0.0636386 0.0569760 -0.0480323 0.1753096 1.1169 0.2640212 Intercept6 -0.0251060 0.0332812 -0.0903359 0.0401240 -0.7544 0.4506338 Intercept7 -0.0513371 0.0424873 -0.1346106 0.0319365 -1.2083 0.2269352 Intercept8 0.4737624 0.0242643 0.4262053 0.5213195 19.5251 < 2.2e-16 *** Intercept9 0.1033250 0.0300813 0.0443667 0.1622833 3.4349 0.0005929 *** Intercept10 0.2029748 0.0151562 0.1732693 0.2326803 13.3922 < 2.2e-16 *** Tau2_1_1 0.0863077 0.0181553 0.0507239 0.1218915 4.7539 1.996e-06 *** Tau2_2_2 0.0620042 0.0117783 0.0389192 0.0850892 5.2643 1.407e-07 *** Tau2_3_3 0.0452124 0.0040930 0.0371903 0.0532345 11.0463 < 2.2e-16 *** Tau2_4_4 0.0536825 0.0046003 0.0446660 0.0626989 11.6693 < 2.2e-16 *** Tau2_5_5 0.0815652 0.0234106 0.0356813 0.1274492 3.4841 0.0004938 *** Tau2_6_6 0.0598359 0.0119885 0.0363390 0.0833328 4.9911 6.003e-07 *** Tau2_7_7 0.1050560 0.0198394 0.0661716 0.1439405 5.2953 1.188e-07 *** Tau2_8_8 0.0328008 0.0065504 0.0199621 0.0456394 5.0074 5.516e-07 *** Tau2_9_9 0.0506167 0.0100229 0.0309721 0.0702613 5.0501 4.416e-07 *** Tau2_10_10 0.0557539 0.0052965 0.0453730 0.0661348 10.5266 < 2.2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Q statistic on the homogeneity of effect sizes: 26567.04 Degrees of freedom of the Q statistic: 1238 P value of the Q statistic: 0 Heterogeneity indices (based on the estimated Tau2): Estimate Intercept1: I2 (Q statistic) 0.9723 Intercept2: I2 (Q statistic) 0.9619 Intercept3: I2 (Q statistic) 0.9516 Intercept4: I2 (Q statistic) 0.9642 Intercept5: I2 (Q statistic) 0.9707 Intercept6: I2 (Q statistic) 0.9605 Intercept7: I2 (Q statistic) 0.9771 Intercept8: I2 (Q statistic) 0.9308 Intercept9: I2 (Q statistic) 0.9536 Intercept10: I2 (Q statistic) 0.9590 Number of studies (or clusters): 377 Number of observed statistics: 1248 Number of estimated parameters: 20 Degrees of freedom: 1228 -2 log likelihood: 19.4068 OpenMx status1: 0 ("0" or "1": The optimization is considered fine. Other values may indicate problems.) > vec2symMat(coef(random_stage1, select="fixed"), diag = FALSE) [,1] [,2] [,3] [,4] [,5] [1,] 1.0000000 -0.15558730 0.26893172 0.24544034 0.38603123 [2,] -0.1555873 1.00000000 0.06363863 -0.02510596 -0.05133705 [3,] 0.2689317 0.06363863 1.00000000 0.47376240 0.10332504 [4,] 0.2454403 -0.02510596 0.47376240 1.00000000 0.20297483 [5,] 0.3860312 -0.05133705 0.10332504 0.20297483 1.00000000 > > ### Step 4 > for (i in 1:length(data3$data)){ + for (j in 1:nrow(data3$data[[i]])){ + for (k in 1:nvar){ + if (is.na(data3$data[[i]][j,k])==TRUE + &is.na(data3$data[[i]][j,j])!=TRUE + &is.na(data3$data[[i]][k,k])!=TRUE){ + + if(sum(is.na(data3$data[[i]])[j,])>sum(is.na(data3$data[[i]])[k,])) + {data3$data[[i]][k,k] = NA} + if(sum(is.na(data3$data[[i]])[j,])<=sum(is.na(data3$data[[i]])[k,])) + {data3$data[[i]][j,j] = NA} + }}}} > > pattern.na(data3$data, show.na = FALSE) A B C D E A 326 49 62 297 315 B 49 64 26 57 60 C 62 26 65 62 60 D 297 57 62 282 260 E 315 60 60 260 354 > pattern.n(data3$data, data3$Corr_Sample) A B C D E A 133495 19045 22861 121371 126080 B 19045 24007 11326 21828 23389 C 22861 11326 23752 22694 22587 D 121371 21828 22694 112014 101765 E 126080 23389 22587 101765 143035 > > random_stage1<- tssem1(data3$data, data3$Corr_Sample, method="REM", RE.type="Diag") > summary(random_stage1) Call: meta(y = ES, v = acovR, RE.constraints = Diag(paste0(RE.startvalues, "*Tau2_", 1:no.es, "_", 1:no.es)), RE.lbound = RE.lbound, I2 = I2, model.name = model.name, suppressWarnings = TRUE, silent = silent, run = run) 95% confidence intervals: z statistic approximation (robust=FALSE) Coefficients: Estimate Std.Error lbound ubound z value Pr(>|z|) Intercept1 -0.1773626 0.0420345 -0.2597486 -0.0949765 -4.2195 2.449e-05 *** Intercept2 0.2675973 0.0334759 0.2019858 0.3332089 7.9937 1.332e-15 *** Intercept3 0.2705176 0.0147088 0.2416889 0.2993464 18.3915 < 2.2e-16 *** Intercept4 0.3870935 0.0137212 0.3602004 0.4139867 28.2113 < 2.2e-16 *** Intercept5 0.0728311 0.0602118 -0.0451818 0.1908440 1.2096 0.2264392 Intercept6 -0.0460822 0.0354904 -0.1156422 0.0234777 -1.2984 0.1941355 Intercept7 -0.0393342 0.0427658 -0.1231536 0.0444853 -0.9198 0.3576998 Intercept8 0.4705018 0.0244739 0.4225339 0.5184697 19.2247 < 2.2e-16 *** Intercept9 0.1032963 0.0300816 0.0443375 0.1622551 3.4339 0.0005950 *** Intercept10 0.2034620 0.0151636 0.1737419 0.2331822 13.4178 < 2.2e-16 *** Tau2_1_1 0.0674595 0.0159444 0.0362090 0.0987100 4.2309 2.327e-05 *** Tau2_2_2 0.0623565 0.0121430 0.0385566 0.0861564 5.1352 2.819e-07 *** Tau2_3_3 0.0476653 0.0047686 0.0383191 0.0570116 9.9957 < 2.2e-16 *** Tau2_4_4 0.0546579 0.0047240 0.0453991 0.0639168 11.5703 < 2.2e-16 *** Tau2_5_5 0.0842409 0.0251544 0.0349392 0.1335425 3.3490 0.0008112 *** Tau2_6_6 0.0570407 0.0124609 0.0326178 0.0814636 4.5776 4.704e-06 *** Tau2_7_7 0.1027974 0.0197652 0.0640583 0.1415366 5.2009 1.983e-07 *** Tau2_8_8 0.0316184 0.0064990 0.0188805 0.0443562 4.8651 1.144e-06 *** Tau2_9_9 0.0506165 0.0100230 0.0309717 0.0702613 5.0500 4.418e-07 *** Tau2_10_10 0.0558082 0.0053015 0.0454174 0.0661989 10.5268 < 2.2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Q statistic on the homogeneity of effect sizes: 24677.46 Degrees of freedom of the Q statistic: 1145 P value of the Q statistic: 0 Heterogeneity indices (based on the estimated Tau2): Estimate Intercept1: I2 (Q statistic) 0.9648 Intercept2: I2 (Q statistic) 0.9621 Intercept3: I2 (Q statistic) 0.9539 Intercept4: I2 (Q statistic) 0.9648 Intercept5: I2 (Q statistic) 0.9716 Intercept6: I2 (Q statistic) 0.9586 Intercept7: I2 (Q statistic) 0.9766 Intercept8: I2 (Q statistic) 0.9284 Intercept9: I2 (Q statistic) 0.9536 Intercept10: I2 (Q statistic) 0.9591 Number of studies (or clusters): 377 Number of observed statistics: 1155 Number of estimated parameters: 20 Degrees of freedom: 1135 -2 log likelihood: 23.55453 OpenMx status1: 0 ("0" or "1": The optimization is considered fine. Other values may indicate problems.) > vec2symMat(coef(random_stage1, select="fixed"), diag = FALSE) [,1] [,2] [,3] [,4] [,5] [1,] 1.0000000 -0.17736256 0.26759733 0.27051761 0.38709354 [2,] -0.1773626 1.00000000 0.07283111 -0.04608224 -0.03933416 [3,] 0.2675973 0.07283111 1.00000000 0.47050182 0.10329626 [4,] 0.2705176 -0.04608224 0.47050182 1.00000000 0.20346204 [5,] 0.3870935 -0.03933416 0.10329626 0.20346204 1.00000000 >