## Not run:
# data(wvs94a)
#
# ## Random-effects model
# random.ma1 <- meta(y=cbind(lifesat, lifecon),
# v=cbind(lifesat_var, inter_cov, lifecon_var), data=wvs94a,
# model.name="Random effects model")
# summary(random.ma1)
#
# ## Random-effects model with both population effect sizes fixed at 0
# random.ma2 <- meta(y=cbind(lifesat, lifecon),
# v=cbind(lifesat_var, inter_cov, lifecon_var), data=wvs94a,
# intercept.constraints=matrix(0, nrow=1, ncol=2),
# model.name="Effect sizes are fixed at 0")
# summary(random.ma2)
#
# ## Compare the nested models
# anova(random.ma1, random.ma2)
#
# ## Fixed-effects model by fixing the variance component at 0
# fixed.ma <- meta(y=cbind(lifesat, lifecon),
# v=cbind(lifesat_var, inter_cov, lifecon_var), data=wvs94a,
# RE.constraints=matrix(0, ncol=2, nrow=2),
# model.name="Fixed effects model")
# summary(fixed.ma)
#
# ## Mixed-effects model
# ## gnp is divided by 10000 and centered by using
# ## scale(gnp/10000, scale=FALSE)
# mixed.ma1 <- meta(y=cbind(lifesat, lifecon),
# v=cbind(lifesat_var, inter_cov, lifecon_var),
# x=scale(gnp/10000, scale=FALSE), data=wvs94a,
# model.name="GNP as a predictor")
# summary(mixed.ma1)
#
# ## Mixed-effects model with equal regression coefficients
# mixed.ma2 <- meta(y=cbind(lifesat, lifecon),
# v=cbind(lifesat_var, inter_cov, lifecon_var),
# x=scale(gnp/10000, scale=FALSE), data=wvs94a,
# coef.constraints=matrix(c("0.0*Eq_slope",
# "0.0*Eq_slope"), nrow=2),
# model.name="GNP as a predictor with equal slope")
# summary(mixed.ma2)
#
# ## Compare the nested models
# anova(mixed.ma1, mixed.ma2)
#
# ## Plot the multivariate effect sizes
# plot(random.ma1, main="Estimated effect sizes and their 95% confidence ellipses",
# axis.label=c("Gender difference on life satisfaction",
# "Gender difference on life control"))
# ## End(Not run)
Run the code above in your browser using DataLab