-
Notifications
You must be signed in to change notification settings - Fork 5
T Test module notes
There is a relatively simple calculation for power for the t test. However, sample size needs to be determined interactively since there is not a simple calculation.
We might want to use R packages like
power.t.test(n = NULL, delta = NULL, sd = 1, sig.level = 0.05, power = NULL, type = c("two.sample", "one.sample", "paired"), alternative = c("two.sided", "one.sided"), strict = FALSE, tol = .Machine$double.eps^0.25)
or
pwr.t.test(n = NULL, d = NULL, sig.level = 0.05, power = NULL, type = c("two.sample", "one.sample", "paired"), alternative = c("two.sided", "less", "greater"))
Either of these will calculate sample size (n), detectable alternative (d), or power (power) in terms of all the other values. I'm not sure what is the difference between power.t.test and pwr.t.test.
If you look at my Fortran code for power, sample size, and detectable alternative (tpower, tsamplesize, and tdeltasize respectively) you'll see that tpower calculates directly. Functions tsamplesize and tdeltasize iterate a function to find the sample size. Using some R package that already does all of this might be easier and less error prone.
I guess we want to consider how much required baggage we will depend on vs how hard it is to do what we want with just our own code.