Created
December 9, 2015 10:54
-
-
Save johnjosephhorton/b93cbcd1e94a2f03bbb7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
SimExperiment <- function(num.groups, sample.size, beta, randomize.by.group = FALSE){ | |
"Simulate running an analysis of the experiment with linear regression" | |
df <- CreateClusteredData(num.groups, sample.size, beta, randomize.by.group = randomize.by.group) | |
m <- lm(y ~ trt, data = df) | |
c(as.numeric(coef(m)[2]), as.numeric(sqrt(diag(vcov(m))[2]))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment