Create a gist now

Instantly share code, notes, and snippets.

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