Мои параметры:
n = 30
a0 = 10
a1 = 12
msd = 2
t_stat_H0<-rep(NA,1000)
t_stat_H1<-rep(NA,1000)
Построение графиков:
x<-seq(-10,10,0.01)
hist(t_stat_H0,freq=F, xlim=c(-10,10), ylim = c(0,0.5) ,col=rgb(0,1,0,1/4),main = '',xlab='')
hist(t_stat_H1,freq=F, xlim=c(-10,10),col=rgb(1,0,0,1/4),add=T)
lines(x,dt(x,df=n-1),col="blue")
lines(x,dnorm(x,0,1),col="black")
H0 - mu=5
H1 - mu=5.3
power = 0.9
iternum = 1000
n = 500
mu0 = 5
mu1 = 5.3
my_sd = 2
alpha = 0.05
H0_true<-rep(NA,iternum)
H1_true<-rep(NA,iternum)
table(H0_true)
## H0_true
## H0 Not H0
## 953 47
table(H1_true)
## H1_true
## H0 Not H0
## 92 908
power.t.test(power=0.9,delta=0.3,sd=2,type="one.sample")
##
## One-sample t test power calculation
##
## n = 468.9215
## delta = 0.3
## sd = 2
## sig.level = 0.05
## power = 0.9
## alternative = two.sided