lacunary - Mathnotes

Hypothesis Testing

Given a baseline population mean μ0, a sample mean x¯, a sample count n, and either a sample standard deviation s or a population standard deviation σ, we might want to know if the sample data provides sufficient evidence to conclude that the true population mean μ differs significantly from μ0.

Definition: Null and Alternative Hypotheses \@{null-alternative-hypothesis}

We could say that our null hypothesis is that the population mean is what we expect:

H0:μ=μ0,

and that the alternative hypothesis is that it is different from what we expect:

H1:μμ0.

We'd then compute a test statistic. Here, we will assume we know the population's standard deviation σ

z=x¯μ0σ/n.

Definition: p-value \@{p-value}

The p-value is the probability of getting a test statistic (z) this extreme or more extreme if the actual mean is μ0.

Referenced by (1 direct)

Direct references:

Then, since we want to know the p-value, we have a two-tailed test because the sample mean could either be lower than or higher than our actual mean. So, we do

p-value=P(|Z||z|)=2×P(Z|z|)=2(1|z|12πet22dt)

or in Mathematica notation:

2(1CDF[NormalDistribution[0,1],Abs[z]]).

Low p-values (typically, p<0.05 or so) lead us to reject the null-hypothesis and adopt the alternative hypothesis. A very low p-value means that the probability of getting the sample we got if μ=μ0 is very low.

Instead of hypothesizing that μμ0, we could hypothesize that μ>μ0, or that μ<μ0. These would be single-tailed tests and we'd use, for example:

H0:μ=μ0,

H1:μ>μ0,

1CDF[NormalDistribution[0,1],z]

instead.

Additionally, if we don't know σ but only know s, the standard deviation of the sample, we would use a Student T Distribution. We'd calculate a t value instead of a z value:

t=x¯μ0s/n.

1CDF[StudentTDistribution[n1],t].

Note that if we wanted to test the alternative hypothesis H1:μ<μ0 we'd use

CDF[StudentTDistribution[n1],t],

and similarly for when σ is known, except we'd use the standard normal distribution and a z value.