#4.1 单样本
library(pwr)
u1=3.3
u2=3
s2=0.112
d=0.03/s2
pwr.t.test(d=d,sig.level = 0.05,power=0.90,type="one.sample",alternative = "two.sided")
pwr.t.test(n=100,d=d,sig.level = 0.05,type="one.sample",alternative = "two.sided")
#4.1.2 双样本
d=0.6/1.3
pwr.t.test(d=d,sig.level = 0.05,type="two.sample",power = 0.90,alternative = "two.sided")
pwr.t.test(n=80,d=d,sig.level = 0.05,type="two.sample",alternative = "two.sided")
#4.1.3 配对样本
d=0.3/0.78
pwr.t.test(d=d,sig.level = 0.05,type="paired",power = 0.90,alternative = "two.sided")
pwr.t.test(n=60,d=d,sig.level = 0.05,type="paired",alternative = "two.sided")
#4.3 方差分析
f=0.427983
pwr.anova.test(k=3,f=f,sig.level = 0.05,power=0.90)
pwr.anova.test(k=3,n=10,f=f,sig.level = 0.05)
#4.4 相关分析
pwr.r.test(r=0.7,sig.level = 0.05,power=0.80,alternative="two.sided")
pwr.r.test(n=10,r=0.7,sig.level = 0.05,alternative="two.sided")
#4.5 线性模型
pwr.f2.test(u=3,f2=0.0769,sig.level = 0.05,power = 0.90)
#4.6 分类资料的样本量估计
#4.6.1 单样本
pwr.2p.test(h=ES.h(0.12,0.10),sig.level = 0.05,power=0.9,alternative = "two.sided")
#4.6.2 两样本
pwr.2p.test(h=ES.h(0.45,0.25),sig.level = 0.05,power=0.9,alternative = "two.sided")
pwr.2p.test(h=ES.h(0.45,0.25),sig.level = 0.05,n=100,alternative = "two.sided")
#4.6.3 配对
pwr.2p.test(h=ES.h(0.5217,0.1538),sig.level = 0.05,power=0.9,alternative = "two.sided")
pwr.2p.test(h=ES.h(0.5217,0.1538),sig.level = 0.05,n=20,alternative = "two.sided")
网友评论