[R-meta] TR: I2 stats with NA values
Martineau, Roger
Roger.Martineau at AGR.GC.CA
Wed Aug 16 17:42:54 CEST 2017
Hi Wolfgang,
Yes it does now. Thanks a lot.
Roger ☺
-----Message d'origine-----
De : Viechtbauer Wolfgang (SP) [mailto:wolfgang.viechtbauer at maastrichtuniversity.nl]
Envoyé : 10 août 2017 05:58
À : r-sig-meta-analysis at r-project.org
Cc : Martineau, Roger
Objet : RE: I2 stats with NA values
Hi Roger,
As for I^2, this should work:
W <- diag(1/tmp.CD$vi)
Then all dimensions should match up.
I cannot say anything about the results.
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and
Neuropsychology | Maastricht University | P.O. Box 616 (VIJV1) | 6200 MD
Maastricht, The Netherlands | +31 (43) 388-4170 | http://www.wvbauer.com
-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of Martineau, Roger
Sent: Wednesday, August 09, 2017 17:57
To: r-sig-meta-analysis at r-project.org
Subject: [R-meta] I2 stats with NA values
Hi Metafor users,
I have a data set with missing values for ArgMean:
> tmp.dat.Arg3$ArgMean
[1] NA NA 53.00 58.50 NA NA NA NA
[9] NA NA NA 76.40 71.70 85.70 84.10 61.90 [17] 62.20 153.00 153.00 144.00 143.00 63.00 60.00 58.50 [25] 60.70 80.60 92.30 67.39 68.66 87.49 78.42 71.30 [33] 69.12 71.30 69.80 68.60 79.22 NA NA 83.00 [41] 97.00 117.00 115.00 83.00 95.00 115.00 106.00 75.77 [49] 74.05 74.05 84.96 91.85 102.18 98.70 86.30 98.90 [57] 87.20 53.70 80.00 53.70 80.30 NA NA 59.00 [65] 61.00 47.00 53.00 100.40 103.30 111.40 89.20 102.70 [73] NA NA 61.50 60.50 54.40 69.10 68.30 63.80 [81] 111.00 107.00 113.00 109.00 59.80 84.50 57.40 83.80 [89] 56.00 63.00 71.00 68.00 56.00 64.00 70.00 67.00 [97] 82.40 82.80 94.20 NA NA NA 77.50 80.94 [105] 78.80 110.30 73.00 97.60 73.00 77.70 63.00 63.00 [113] 77.00 87.00 63.00 62.00 76.00 80.00 65.90 62.57 [121] 68.00 79.00 60.00 72.00 67.00 71.00
My 4-level model using rma.mv function is:
> (tmp.CD <- rma.mv(ArgMean, ArgSEMtrDP^2, data=tmp.dat.Arg3,
+ mods = ~
+ cArgDI +
+ factor(Breed) +
+ factor(Breed)*cArgDI +
+ factor(Stage) +
+ factor(Stage)*cArgDI +
+ factor(CD) +
+ factor(CD)*cArgDI,
+ random = ~1|laboratory/experiment/study,
+ method = "REML"))
The model is solved with the rma.mv function and indeed I get a warning message:
Warning message:
In rma.mv(ArgMean, ArgSEMtrDP^2, data = tmp.dat.Arg3, mods = ~cArgDI + :
Rows with NAs omitted from model fitting.
Cook’s distance and robust functions work fine.
Upon calculation of I^2 statistic, I get the following:
> # Calculation of I^2 statistic
> W <- diag(1/tmp.dat.Arg3$ArgSEMtrDP^2) X <- model.matrix(tmp.CD) P <-
> W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W
Error in W %*% X : non-conformable arguments
> 100 * sum(tmp.CD$sigma2) /
+ (sum(tmp.CD$sigma2) + (tmp.CD$k-tmp.CD$p)/sum(diag(P)))
Error in diag(P) : object 'P' not found
> # Separation of total variance by cluster
> 100 * tmp.CD$sigma2 / (sum(tmp.CD$sigma2) +
> (tmp.CD$k-tmp.CD$p)/sum(diag(P)))
Error in diag(P) : object 'P' not found
>
If I remove NA values for ArgMean, then I can solve I^2 statistic:
> tmp.dat.Arg3 <- subset (tmp.dat.Arg3,ArgMean > 0)
> # Calculation of I^2 statistic
> W <- diag(1/tmp.dat.Arg3$ArgSEMtrDP^2) X <- model.matrix(tmp.CD) P <-
> W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W
> 100 * sum(tmp.CD$sigma2) /
+ (sum(tmp.CD$sigma2) + (tmp.CD$k-tmp.CD$p)/sum(diag(P)))
[1] 93.233
> # Separation of total variance by cluster
> 100 * tmp.CD$sigma2 / (sum(tmp.CD$sigma2) +
> (tmp.CD$k-tmp.CD$p)/sum(diag(P)))
[1] 0.0000022494 90.8175748834 2.4158304680
>
Is it possible to get I^2 statistic directly without removing NA values?
The residual heterogeneity is very high and it might be normal given the data analyzed ??. It is a meta-analysis on 108 raw treatment means from 44 studies, clustered within 29 experiments, themselves clustered within 16 laboratories. The effect of factor CD (type of studies) on the relationship was NS and is shown below:
Best,
Roger ☺
Roger Martineau, mv Ph.D.
Centre de recherche et de développement
sur le bovin laitier et le porc
Agriculture et agroalimentaire Canada/Agriculture and Agri-Food Canada
Téléphone/Telephone: 819-780-7319
Télécopieur/Facsimile: 819-564-5507
2000, Rue Collège / 2000, College Street Sherbrooke (Québec) J1M 0C8 Canada roger.martineau at agr.gc.ca
More information about the R-sig-meta-analysis
mailing list