'How many data values do I need?'

- 'It depends on the wanted power'

- 'It depends on your two hypotheses'

'??'

- 'Read all info, do the exercises!'

✕

**Definition of 'power'**
(*Oxford dictionary of statistics*):

'The probability of accepting the alternative hypothesis when it is true'

**Interpretation**:

Make sure that the page is in its initial state (restart if necessary). The two red lines is the interval where we will accept the null hypothesis (H_{0}).
However, if H_{1} is true, there is a large probability (the area right of the right red line and under the dashed curve) of getting an average right
of the right line. This probability is called *power* and is 0.85.

Thus there is a risk of 0.15 (1 - the power) of falsely accepting H_{0} when it is false.

(In so-called acceptance sampling the power is traditionally
calculated as (1 - power) and then called *the Operating Characteristic curve* (OC-curve).

Sample size:

Difference:

Power value:

Sigma:

Alpha:

Data description...

Info, referenser, m.m...

Test of hypothesis — power and sample size

Repeat (a new average)

✕

An illuminating example

Suppose that a foodstuff is sold
in glass jars with a content of 25 grams, at least according to the label.
If the average content is too small the consumers will protest and if the average is too high it will
be too expensive for the manufacturer.

To protect himself the manufacturer wants to measure the
content of a number of glass jars.
A simple set of measurements can be helpful but the sample needs to be designed in some way.

Apart
from the equipment and methods needed, the size of the sample needs to be determined.
To determine the sample size, there must be some kind of knowledge of sigma, the standard
deviation of the content. This might be known from previous measurement or some other method of estimation.

The investgator needs also some other entities:

**1.** The alpha-value i.e. the risk (probability) that the null hypothesis
(here "The average content is 25 grams").
**2.** The alternative hypothesis which can be seen as the largest deviation that can be accepted.
(In computer programs this is often expressed as the difference from the null hypothesis.)
**3.** The power of the test i.e. the probability of rejecting the null hypothesis in favour of the
alternative hypothesis (when the null hypothesis is false).

The investigator can adjust these parameters so the result is a reasonable plan for the measurements.
(If a large power is wanted the sample size might rise to what can be unacceptable.)
NB that the reaoning can be also reversed, i.e. having a certain sample size in mind, what power
will this get, or having decided the power and sample size, what difference can be detected?

(See the other info buttons and exercises for more information.)

••••

*μ* H0

*μ* H1

*σ*

number of values

alpha

**General. **
The exercises from 2 and higher are clickable and will store Minitab-commands with the given parameter settings. Any change of a parameter will not be
transfered to the commands unless the exercise is clicked again.

To transfer the commands the 'Copy commands'-button is pressed and then the result must
be pasted into the Minitab-session window.

Any value of the tripple 'power/difference/sample' can be calculated given the other two. Perhaps 'sample size' is the wanted answer and getting this
the power wanted and difference to detect, must be given. (Se Exercise 4).

Exercise 1 – change the parameters

Change the parameters via the slides and note that the difference between the two hypotheses and correpsponding distributions and the curve change accordingly.

The power curve is a function of the other parameters. Click the radio buttons to see the changes of the power curve.
Note that the power increases with increasing sample size and also with decreasing sigma.

Exercise 2 – power, given difference and sample size

This exercise will calculate the power value using the given difference and given sample size. Click 'Exercises...' and transfer the parameter values
to the command area.

Exercise 3 – difference, given power and sample size

This exercise will calculate the difference between the hypotheses that can be detected using the wanted power and given sample size.
Click 'Exercises...' and transfer the parameter values to the command area.

Exercise 4 – sample size, given difference and power

This exercise will calculate the needed sample size in order to detect the wanted difference with the wanted power.
Click 'Exercises...' and transfer the parameter values to the command area.

Exercise 5 – 'Less than'

Sometimes we want the parameter to be **less than** a given value. Thus we want protection against the parameter becoming too large and this with a certain power.
Click 'Exercises...' and transfer the parameter values to the command area.

Exercise 6 – 'Greater than'

Sometimes we want the parameter to be **greater than** a given value. Thus we want protection against the parameter becoming too small and this with a certain power.
Click 'Exercises...' and transfer the parameter values to the command area.

••••

**The two distributions** are theoretical normal distributions of averages, **not** the measurements.
The blue distribution shows averages around the *null hypothesis* and the grey dashed distribution
shows averages around the *alternative hypothesis*.

The standard deviation of averages where each average is calculated with *n* values:

$${\sigma}_{\mathrm{averages}}=\frac{\sqrt{\sigma}}{n}$$

**The two red lines** are the same as a calculating a confidence interval with real data in a so-called
*t-test*.

The sum of the two areas under the blue curve, but outside the vertical red lines, equals the alpha-value.

**The red cross** is a simulated average created by the alternative hypothesis. The 'Repeat'-button will create a new value.

••••

Probability of rejecting H_{0} when it is false

**The Y-axis** shows probability from 0 to 1.

**The X-axis** shows both the *null hypothesis H _{0}* and the

The X-axis can be changed by clicking and changing the min or max values for a better fit.

••••

'Less than', 'Not equal' or 'Greater than'

**'Less than'** is valid when we want the mean to be high and we want the analysis to show if the results is lower than wanted. Perhaps we have promised
that 'the product contains at least 200 grams'.

We do not mind if the average is more but definitely not lower than this value.

**'Not equal'** is valid when we want the mean to be a certain value, not less, not more. Perhaps we have promised
that 'the product contains 250 grams'. We do not want the average to be neither less nor larger than this value.

**'Greater than'** is valid when we want the mean to be low and we want the analysis to show if the results is higher than wanted. Perhaps we have promised
that 'the product contains less than 20 milligrams of fat'. We do not mind if the average is less but definitely not higher than this value.

••••

The endpoints of the slides can not be changed.

The three top slides move 0.1 every time a right
or left arrow is pressed. The 'number of values' changes by integers. The alpha slide moves in steps of 0.01.

** μ H_{0}:** The value of the null hypotheses.

••••

A click on the [Copy commands]-button copies the commands to the clipboard. Shift to the Minitab-application and perform a 'Paste'
into the 'Session window' in Minitab at the 'MTB >'-prompt. Click the [Enter]-key of the keyboard. This will launch
the Minitab-macro in Minitab.

The rows in the right column in blue contain a short comment to each Minitab-command.

••••