Skip to content

Instantly share code, notes, and snippets.

result <- c()
N <- 10000
for(d in 1:100){
ps <- c()
for(i in 1:N){
x <- rt(n = 100, df = d)
ps[i] <- t.test(x, mu = 0)$p.value
}
result[d] <- sum(ifelse(ps < 0.05, 1, 0))
}