This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kalaian, H. A., & Raudenbush, S. W. (1996). A multivariate mixed linear model for meta-analysis. Psychological Methods, 1(3), 227-235. | |
Berkey, C. S., Hoaglin, D. C., Antczak-Bouckoms, A., Mosteller, F., & Colditz, G. A. (1998). Meta-analysis of multiple outcomes by regression with random effects. Statistics in Medicine, 17(22), 2537-2550. | |
van Houwelingen, H. C., Arends, L. R., & Stijnen, T. (2002). Advanced methods in meta-analysis: Multivariate approach and meta-regression. Statistics in Medicine, 21(4), 589-624. | |
Nam, I.-S., Mengersen, K., & Garthwaite, P. (2003). Multivariate meta-analysis. Statistics in Medicine, 22(14), 2309-2333. | |
Hedges, L. V., Tipton, E., & Johnson, M. C. (2010). Robust variance estimation in meta-regression with dependent effect size estimates. Research Synthesis Methods, 1(1), 39-65. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devtools::install_github("wviechtb/metafor") | |
library(metafor) | |
rs <- seq(-1,1,length=1001) | |
ns <- c(seq(10, 100, 10), 150, 200, 300) | |
ys <- lapply(ns, function(n) metafor:::.dcor(rs, n, rho=0)) | |
plot(NA, xlim=range(rs), ylim=range(ys), xlab="Correlation", ylab="Density") | |
invisible(lapply(ys, function(y) lines(rs, y))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rmat <- function(x, n, upper=TRUE, simplify=TRUE, rtoz=FALSE, data) { | |
if (inherits(x, "formula")) { | |
options(na.action = "na.pass") | |
if (missing(data)) | |
stop("Must specify 'data' argument when 'x' is a formula.") | |
if (!is.data.frame(data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list=ls()) | |
library(metafor) | |
iters <- 1000 | |
### number of studies/effects | |
k <- 10 | |
### SD of the true effects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list=ls()) | |
library(metafor) | |
iters <- 1000 | |
### number of studies/effects | |
k <- 10 | |
### SD of the true effects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list=ls()) | |
setwd("/home/wviechtb/misc/wallpapers/bivariate_normal") | |
library(mvtnorm) | |
library(ellipse) | |
### specify the correlation for the bivariate normal distribution | |
rho <- 0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ll <- function(mu, tau2, yi, vi, method="ML") { | |
k <- length(yi) | |
wi <- 1/(vi + tau2) | |
if (method == "ML") { | |
sum(dnorm(yi, mean=mu, sqrt(vi + tau2), log=TRUE)) | |
} else { | |
-1/2 * (k-1) * log(2*pi) + 1/2 * log(k) - 1/2 * sum(log(vi + tau2)) - 1/2 * log(sum(wi)) - 1/2 * sum(wi * (yi - mu)^2) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <- function(x, data) { | |
if (missing(data)) | |
data <- NULL | |
if (is.null(data)) | |
data <- sys.frame(sys.parent()) | |
mf <- match.call() | |
mf.x <- mf[[match("x", names(mf))]] | |
x <- eval(mf.x, data, enclos=sys.frame(sys.parent())) | |
temp <- x^2 + 5 | |
return(temp) |
NewerOlder