Displaying 2 results from an estimated 2 matches for "n_es".
2010 Mar 04
1
ifthen() question
...this
condition is not met, Therefore, I have been trying ifthen() statements to
keep the original value when length of unique id == 1 but I cannot get it to
work. e.g.:
#function to aggregate effect sizes:
aggs <- function(g, n.1, n.2, cor = .50) {
n.1 <- mean(n.1)
n.2 <- mean(n.2)
N_ES <- length(g)
corr.mat <- matrix (rep(cor, N_ES^2), nrow=N_ES)
diag(corr.mat) <- 1
g1g2 <- cbind(g) %*% g
PSI <- (8*corr.mat + g1g2*corr.mat^2)/(2*(n.1+n.2))
PSI.inv <- solve(PSI)
a <- rowSums(PSI.inv)/sum(PSI.inv)
var.g <- 1/sum(PSI.inv)
g <- sum(g*a)
ou...
2010 Mar 04
0
ifthen() question -- whoops--ifelse()
...I have been trying ifthen() statements to
> keep the original value when length of unique id == 1 but I cannot get it to
> work. e.g.:
>
> #function to aggregate effect sizes:
> aggs <- function(g, n.1, n.2, cor = .50) {
> n.1 <- mean(n.1)
> n.2 <- mean(n.2)
> N_ES <- length(g)
> corr.mat <- matrix (rep(cor, N_ES^2), nrow=N_ES)
> diag(corr.mat) <- 1
> g1g2 <- cbind(g) %*% g
> PSI <- (8*corr.mat + g1g2*corr.mat^2)/(2*(n.1+n.2))
> PSI.inv <- solve(PSI)
> a <- rowSums(PSI.inv)/sum(PSI.inv)
> var.g <- 1/s...