########################################################## # # # 18.2 EFFECTS OF TEACHER EXPECTANCE ON PUPIL IQ # # # # DATE: 08/24/2008 # # # ########################################################## # simple function for computing the improved confidence interval # in the generic intervse variance method according to # Hartung and Knapp (2001a,b) using the DerSimonian-Laird # estimator of the heterogeneity parameter # theta = vector of study-specific estimates # xi = vector of study-specific standard deviations # alpha = 1 - confidence coefficients improved.ci <- function(theta, xi, alpha) { k <- length(theta) # number of studies v <- 1 / xi^2 # fixed effects weights theta.fix <- sum(v * theta) / sum(v) # fixed effects estimator of theta cochran.q <- sum(v * (theta - theta.fix)^2) # Cochran's Q tau.dsl <- (cochran.q - k + 1) / (sum(v) - sum(v^2) / sum(v)) # DerSimonian-Laird (DSL) estimator tau.est <- max(0, tau.dsl) # truncated DSL estimator w <- 1 / (xi^2 + tau.est) # random effects weights theta.ran <- sum(w * theta) / sum(w) # random effects estimator of theta hartung.q <- sum(w * (theta - theta.ran)^2) / ((k - 1) * sum(w)) # improved variance estimator ci.lower <- theta.ran - sqrt(hartung.q) * qt(1 - alpha/2, k - 1) # lower bound of CI on theta ci.upper <- theta.ran + sqrt(hartung.q) * qt(1 - alpha/2, k - 1) # upper bound of CI on theta test <- theta.ran / sqrt(hartung.q) # test statistic p.value <- 2 * (1 - pt(abs(test), k - 1)) # p-value return(cbind(tau.est, theta.ran, ci.lower, ci.upper, p.value)) } # Combining standardized mean differences from 19 studies # d = standardized mean difference # std.d = standard deviation of d study <- 1:19 d <- c( 0.03, 0.12, -0.14, 1.18, 0.26, -0.06, -0.02, -0.32, 0.27, 0.80, 0.54, 0.18, -0.02, 0.23, -0.18, -0.06, 0.30, 0.07, -0.07) std.d <- c(0.125, 0.147, 0.167, 0.373, 0.369, 0.103, 0.103, 0.220, 0.164, 0.251, 0.302, 0.223, 0.289, 0.290, 0.159, 0.167, 0.139, 0.094, 0.174) # Generic inverse variance method using R package meta library(meta) # Combining d's comb.d <- metagen(d, std.d) comb.d improved.ci(d, std.d, 0.05) # Confidence interval plot with fixed and random effects meta-analysis plot(comb.d, comb.f = TRUE, comb.r = TRUE, main = "Teacher expectancy studies", xlab = "Standardized mean difference") # Funnel plot and tests for publication bias # method = rank (rank correlation) # method = linear (linear regression) funnel(comb.d, main = "Teacher expectancy studies", xlab = "Standardized mean difference") metabias(comb.d, method = "rank") metabias(comb.d, method = "linreg")