Skip to content

Instantly share code, notes, and snippets.

@sckott
Created August 2, 2011 23:46
Show Gist options
  • Save sckott/1121532 to your computer and use it in GitHub Desktop.
Save sckott/1121532 to your computer and use it in GitHub Desktop.
Example for the mvmeta package
> berkey98
trial pubyear npat PD AL var_PD cov_PD_AL var_AL
1 Pihlstrom1983 1983 14 0.47 -0.32 0.0075 0.0030 0.0077
2 Lindhe1982 1982 15 0.20 -0.60 0.0057 0.0009 0.0008
3 Knowles1979 1979 78 0.40 -0.12 0.0021 0.0007 0.0014
4 Ramfjord1987 1987 89 0.26 -0.31 0.0029 0.0009 0.0015
5 Becker1988 1988 16 0.56 -0.39 0.0148 0.0072 0.0304
> model <- mvmeta(cbind(PD,AL),S=berkey98[6:8],data=berkey98,lab=list(mlab=trial))
> summary(model)
MULTIVARIATE RANDOM-EFFECTS META-ANALYSIS
Dimensions: 2
Studies: 5
Estimation method: REML
Variance-covariance matrix Psi: unstructured
Fixed effects
Estimate StdErr z p-value 95%ci.lb 95%ci.ub
PD 0.3534 0.0588 6.0057 0.0000 0.2381 0.4688 ***
AL -0.3392 0.0879 -3.8589 0.0001 -0.5115 -0.1669 ***
Variance components: between-studies stdev and correlation matrix
StdDev PD AL
PD 0.1083 1.0000 .
AL 0.1807 0.6090 1.0000
Multivariate Cochran Q-test for heterogeneity:
Q = 128.2267 (df = 8), p-value = <0.0001
10 observations, 2 fixed and 3 random parameters
logLik AIC BIC
2.0823 5.8353 6.2325
> AIC(model)
[1] 5.83534
> blup(model,pi=TRUE,aggregate="y",pi.level=0.90)
$PD
blup pi.lb pi.ub
Pihlstrom1983 0.4175761 0.27265246 0.5624997
Lindhe1982 0.2299012 0.09377627 0.3660262
Knowles1979 0.4024566 0.28408589 0.5208273
Ramfjord1987 0.2864583 0.16258938 0.4103272
Becker1988 0.4307487 0.26821197 0.5932853
$AL
blup pi.lb pi.ub
Pihlstrom1983 -0.3248929 -0.5192103 -0.13057558
Lindhe1982 -0.5912270 -0.7426969 -0.43975700
Knowles1979 -0.1283270 -0.2849441 0.02829000
Ramfjord1987 -0.3077010 -0.4650393 -0.15036267
Becker1988 -0.3439279 -0.5948634 -0.09299245
> model <- mvmeta(cbind(PD,AL)~pubyear,S=berkey98[6:8],data=berkey98,
+ lab=list(mlab=trial),method="ml")
> summary(model)
MULTIVARIATE RANDOM-EFFECTS META-ANALYSIS
Dimensions: 2
Studies: 5
Estimation method: ML
Variance-covariance matrix Psi: unstructured
Fixed effects
PD :
Estimate StdErr z p-value 95%ci.lb 95%ci.ub
(Int) -1.5822 30.6137 -0.0517 0.9588 -61.5839 58.4195
pubyear 0.0010 0.0154 0.0631 0.9497 -0.0293 0.0312
AL :
Estimate StdErr z p-value 95%ci.lb 95%ci.ub
(Int) 21.1354 48.2512 0.4380 0.6614 -73.4353 115.7061
pubyear -0.0108 0.0243 -0.4450 0.6563 -0.0585 0.0369
Variance components: between-studies stdev and correlation matrix
StdDev PD AL
PD 0.0897 1.0000 .
AL 0.1582 0.6590 1.0000
Multivariate Cochran Q-test for residual heterogeneity:
Q = 125.7557 (df = 6), p-value = <0.0001
10 observations, 4 fixed and 3 random parameters
logLik AIC BIC
6.0043 1.9914 4.1095
> qtest(model)
Multivariate Cochran Q-test for residual heterogeneity:
Q = 125.7557 (df = 6), p-value = <0.0001
> newdata <- data.frame(pubyear=1985:1989)
> predict(model,newdata,se=TRUE)
$pred
PD AL
[1,] 0.3498409 -0.3567822
[2,] 0.3508143 -0.3676094
[3,] 0.3517876 -0.3784367
[4,] 0.3527610 -0.3892640
[5,] 0.3537343 -0.4000913
$se
PD AL
[1,] 0.05792492 0.08828305
[2,] 0.06631198 0.10185017
[3,] 0.07691408 0.11889814
[4,] 0.08894261 0.13814422
[5,] 0.10189365 0.15879116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment