0

I need to calculate the power of a t-test for

set.seed(1)
    N=1000
    mu=5
    number.of.rejects=0
    sd=1.2

first I want to calculate my number of rejects with:

for(i in 1:N){
  x=rnorm(n=16,mean = mu,sd=1.2)
  
  #calculate test size
  t=(mean(x)-5)/(sd(x)/4)
  
  number.of.rejects=number.of.rejects +(abs(t)>c)
}

but I do not know how to find my critical value c when my test has the level 95%

below is Q

enter image description here

firmo23
  • 129
  • 5
  • It happens to know that my c should be 2.131 but I cannot prove it I dont know hot can I reach to that – firmo23 Nov 10 '21 at 22:44
  • Must be some confusion. Can't see how this matches $n = 1000.$ That might be for $n=16,$ DF = 15. – BruceET Nov 10 '21 at 22:53
  • 2
    The term should be *power*, not 'strength'. Further, the term 'level' has a particular meaning in hypothesis tests and that won't be 95%. It might be 5%. – Glen_b Nov 10 '21 at 22:58
  • Lets say that I find c. If instead of mu=5 I want to calculate number of rejects for mu=6 is the c affected? Everything else will be the same – firmo23 Nov 10 '21 at 23:01
  • 1
    Use the critical value, $c$, that you calculated at $\mu=5$ – Glen_b Nov 10 '21 at 23:04

0 Answers0