# NOT RUN {
### STANDARD MODELS
# RANDOM-EFFECTS META-ANALYSIS, ESTIMATED WITH REML
model <- mixmeta(logor, logorvar, data=bcg)
summary(model)
# RANDOM-EFFECTS META-REGRESSION, ESTIMATED WITH ML
model <- mixmeta(logor~ablat, logorvar, data=bcg, method="ml")
summary(model)
### MAIN METHOD FUNCTIONS
# COEFFICIENTS AND (CO)VARIANCE MATRIX
coef(model)
vcov(model)
# RESIDUALS AND FITTED VALUES
residuals(model)
fitted(model)
# MODEL FRAME AND MODEL MATRIX
model.frame(model)
model.matrix(model)
# LOG-LIKELIHOOD AND AIC VALUE
logLik(model)
AIC(model)
# COCHRAN Q TEST FOR RESIDUAL HETEROGENEITY
qtest(model)
### PREDICTIONS
# PREDICTED EFFECTS
predict(model)
predict(model, se=TRUE)
predict(model, newdata=data.frame(ablat=2:5*10), ci=TRUE)
# BEST LINEAR UNBIASED PREDICTION
blup(model)
blup(model, pi=TRUE)
# SEE help(predict.mixmeta) AND help(BLUP.mixmeta) FOR MORE INFO
### MULTIVARIATE MODELS
### BIVARIATE MODELS
model <- mixmeta(cbind(PD,AL) ~ pubyear, S=berkey98[5:7], data=berkey98)
summary(model)
residuals(model)
### MULTIVARIATE META-ANALYSIS WITH MORE THAN 2 OUTCOMES
y <- as.matrix(fibrinogen[2:5])
S <- as.matrix(fibrinogen[6:15])
model <- mixmeta(y, S)
summary(model)
predict(model, se=TRUE)
predict(model, se=TRUE, aggregate="outcome")
### OTHER EXTENSIONS
# MULTILEVEL META-ANALYSIS
model <- mixmeta(effect, var, random= ~ 1|district/study, data=school)
summary(model)
# SEE help(school) AND help(thrombolytic) FOR MORE EXAMPLES
# DOSE-RESPONSE META-ANALYSIS (SIMPLIFIED)
model <- mixmeta(logrr ~ 0 + dose, S=se^2, random= ~ 0 + dose|id, data=alcohol,
subset=!is.na(se))
summary(model)
# SEE help(alcohol) FOR MORE EXAMPLES
# LONGITUDINAL META-ANALYSIS
model <- mixmeta(logOR~time, S=logORvar, random=~I(time-15)|study, data=gliomas)
summary(model)
# SEE help(gliomas) AND help(dbs) FOR MORE EXAMPLES
### FIXED-EFFECTS MODELS AND ALTERNATIVE ESTIMATORS
# FIXED-EFFECTS MODEL
model <- mixmeta(sbp~ish, S=sbp_se^2, data=hyp, method="fixed")
summary(model)
# METHOD OF MOMENTS
S <- as.matrix(hsls[5:10])
model <- mixmeta(cbind(b1,b2,b3), S, data=hsls, method="mm")
summary(model)
# VARIANCE COMPONENTS ESTIMATOR
model <- mixmeta(cbind(PD,AL)~pubyear, S=berkey98[5:7], data=berkey98,
method="vc")
summary(model)
### IN THE PRESENCE OF MISSING VALUES
# RUN THE MODEL
y <- as.matrix(smoking[11:13])
S <- as.matrix(smoking[14:19])
model <- mixmeta(y, S)
summary(model)
model.frame(model)
# SEE help(na.omit.data.frame.mixmeta) FOR MORE EXAMPLES
### WHEN WITHIN-STUDY COVIARIANCES ARE NOT AVAILABLE AND/OR NEED TO BE INPUTTED
# GENERATE S
(S <- inputcov(hyp[c("sbp_se","dbp_se")], cor=hyp$rho))
# RUN THE MODEL
model <- mixmeta(cbind(sbp,dbp), S=S, data=hyp)
# INPUTTING THE CORRELATION DIRECTLY IN THE MODEL
model <- mixmeta(cbind(y1,y2), cbind(V1,V2), data=p53, control=list(Scor=0.95))
summary(model)
# SEE help(hyp) AND help(p53) FOR MORE EXAMPLES
### STRUCTURING THE BETWEEN-STUDY (CO)VARIANCE
# DIAGONAL
S <- as.matrix(hsls[5:10])
model <- mixmeta(cbind(b1,b2,b3), S, data=hsls, bscov="diag")
summary(model)
model$Psi
# COMPOUND SYMMETRY
model <- mixmeta(cbind(b1,b2,b3), S, data=hsls, bscov="cs")
summary(model)
model$Psi
# SEE help(mixmetaCovStruct) FOR DETAILS AND ADDITIONAL EXAMPLES
### USE OF THE CONTROL LIST
# PRINT THE ITERATIONS AND CHANGE THE DEFAULT FOR STARTING VALUES
y <- as.matrix(smoking[11:13])
S <- as.matrix(smoking[14:19])
model <- mixmeta(y, S, control=list(showiter=TRUE, igls.inititer=20))
# SEE help(mixmeta.control) FOR FURTHER DETAILS
# }
Run the code above in your browser using DataLab