We have, level of sig = 0.05 Type of test = paired standard deviation= 0.03 delta = 0.015 power=0.75
power.t.test(n=NULL,delta=.015,sd=.03,sig.level=.05, power=.75,type = c("paired"),alternative = c("one.sided") )
##
## Paired t test power calculation
##
## n = 22.92961
## delta = 0.015
## sd = 0.03
## sig.level = 0.05
## power = 0.75
## alternative = one.sided
##
## NOTE: n is number of *pairs*, sd is std.dev. of *differences* within pairs
We used power.t.test to determine the sample size for question 1, The sample size should be 23.
We have, type of test= two sample Level of sig=.10 power=.85 if sd=1, then u1-u2=.5, so Cohen’s d =u1-u2/sd=0.5
library(pwr)
pwr.t.test(n=NULL,d=.5, sig.level = .1,power = .85,type = c("two.sample"),alternative = c("greater"))
##
## Two-sample t test power calculation
##
## n = 43.40568
## d = 0.5
## sig.level = 0.1
## power = 0.85
## alternative = greater
##
## NOTE: n is number in *each* group
For this question we do not know the value of sd, so we used pwr.t.test to find out the sample size. The sample size for this two sample t-test should be 44 for both samples. Nad the total sample should be 88.
#Answer to Question 1
#We have level of sig = 0.05
#Type of test = paired
#standard deviation= 0.03
# delta = 0.015
#power=0.75
?power.t.test
power.t.test(n=NULL,delta=.015,sd=.03,sig.level=.05, power=.75,type = c("paired"),alternative = c("one.sided") )
#So the sample size should be 23
#Answer to the Question 2
#type of test= two sample
#Level of sig=.10
#power=.85
# if sd=1, then u1-u2=.5, so d=u1-u2/sd=0.5
library(pwr)
?pwr.t.test
pwr.t.test(n=NULL,d=.5, sig.level = .1,power = .85,type = c("two.sample"),alternative = c("greater"))
#So the sample size for both samples should be 44. The total will be 88.