Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The most important parameter to vary
- sdInEffectSize = 1
- # Other parameters
- nbSamples = 5e3
- sampleSize = 100
- effectSize = 0.2
- baseSD = 3
- alpha = 0.05
- nbTP = 0
- for (i in 1:nbSamples)
- {
- x1 = rnorm(sampleSize, mean = 0, sd = baseSD)
- x2 = x1 + rnorm(sampleSize, mean = effectSize, sd = sdInEffectSize)
- if (t.test(x2-x1)$p.value < alpha)
- {
- nbTP = nbTP + 1
- }
- }
- print(nbTP / nbSamples)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement