Hand Coding the Power of a Test
Hand Coding the Power of a Test
We want to test if our population average is different from twenty.
We therefore specify the follow zero hypothesis.
$$ H_0: \mu = 20 $$
The alternative hypothesis is
$$ H_a: \mu \neq 20 $$
Accepting
{% highlight r %} mu <- 40 sd <- 8 n <- 20 ci <- qnorm(0.975)*sd/sqrt(n) (left <- mu - ci) {% endhighlight %}
{% highlight text %}
[1] 36.49391
{% endhighlight %}
{% highlight r %} (right <- mu + ci) {% endhighlight %}
{% highlight text %}
[1] 43.50609
{% endhighlight %}
This post is licensed under CC BY 4.0 by the author.