Statistics Tutorial
Descriptive statistics, inferential statistics, stat reference, statistics - hypothesis testing a mean.
A population mean is an average of value a population.
Hypothesis tests are used to check a claim about the size of that population mean.
Hypothesis Testing a Mean
The following steps are used for a hypothesis test:
- Check the conditions
- Define the claims
- Decide the significance level
- Calculate the test statistic
For example:
- Population : Nobel Prize winners
- Category : Age when they received the prize.
And we want to check the claim:
"The average age of Nobel Prize winners when they received the prize is more than 55"
By taking a sample of 30 randomly selected Nobel Prize winners we could find that:
The mean age in the sample (\(\bar{x}\)) is 62.1
The standard deviation of age in the sample (\(s\)) is 13.46
From this sample data we check the claim with the steps below.
1. Checking the Conditions
The conditions for calculating a confidence interval for a proportion are:
- The sample is randomly selected
- The population data is normally distributed
- Sample size is large enough
A moderately large sample size, like 30, is typically large enough.
In the example, the sample size was 30 and it was randomly selected, so the conditions are fulfilled.
Note: Checking if the data is normally distributed can be done with specialized statistical tests.
2. Defining the Claims
We need to define a null hypothesis (\(H_{0}\)) and an alternative hypothesis (\(H_{1}\)) based on the claim we are checking.
The claim was:
In this case, the parameter is the mean age of Nobel Prize winners when they received the prize (\(\mu\)).
The null and alternative hypothesis are then:
Null hypothesis : The average age was 55.
Alternative hypothesis : The average age was more than 55.
Which can be expressed with symbols as:
\(H_{0}\): \(\mu = 55 \)
\(H_{1}\): \(\mu > 55 \)
This is a ' right tailed' test, because the alternative hypothesis claims that the proportion is more than in the null hypothesis.
If the data supports the alternative hypothesis, we reject the null hypothesis and accept the alternative hypothesis.
Advertisement
3. Deciding the Significance Level
The significance level (\(\alpha\)) is the uncertainty we accept when rejecting the null hypothesis in a hypothesis test.
The significance level is a percentage probability of accidentally making the wrong conclusion.
Typical significance levels are:
- \(\alpha = 0.1\) (10%)
- \(\alpha = 0.05\) (5%)
- \(\alpha = 0.01\) (1%)
A lower significance level means that the evidence in the data needs to be stronger to reject the null hypothesis.
There is no "correct" significance level - it only states the uncertainty of the conclusion.
Note: A 5% significance level means that when we reject a null hypothesis:
We expect to reject a true null hypothesis 5 out of 100 times.
4. Calculating the Test Statistic
The test statistic is used to decide the outcome of the hypothesis test.
The test statistic is a standardized value calculated from the sample.
The formula for the test statistic (TS) of a population mean is:
\(\displaystyle \frac{\bar{x} - \mu}{s} \cdot \sqrt{n} \)
\(\bar{x}-\mu\) is the difference between the sample mean (\(\bar{x}\)) and the claimed population mean (\(\mu\)).
\(s\) is the sample standard deviation .
\(n\) is the sample size.
In our example:
The claimed (\(H_{0}\)) population mean (\(\mu\)) was \( 55 \)
The sample mean (\(\bar{x}\)) was \(62.1\)
The sample standard deviation (\(s\)) was \(13.46\)
The sample size (\(n\)) was \(30\)
So the test statistic (TS) is then:
\(\displaystyle \frac{62.1-55}{13.46} \cdot \sqrt{30} = \frac{7.1}{13.46} \cdot \sqrt{30} \approx 0.528 \cdot 5.477 = \underline{2.889}\)
You can also calculate the test statistic using programming language functions:
With Python use the scipy and math libraries to calculate the test statistic.
With R use built-in math and statistics functions to calculate the test statistic.
5. Concluding
There are two main approaches for making the conclusion of a hypothesis test:
- The critical value approach compares the test statistic with the critical value of the significance level.
- The P-value approach compares the P-value of the test statistic and with the significance level.
Note: The two approaches are only different in how they present the conclusion.
The Critical Value Approach
For the critical value approach we need to find the critical value (CV) of the significance level (\(\alpha\)).
For a population mean test, the critical value (CV) is a T-value from a student's t-distribution .
This critical T-value (CV) defines the rejection region for the test.
The rejection region is an area of probability in the tails of the standard normal distribution.
Because the claim is that the population mean is more than 55, the rejection region is in the right tail:
The student's t-distribution is adjusted for the uncertainty from smaller samples.
This adjustment is called degrees of freedom (df), which is the sample size \((n) - 1\)
In this case the degrees of freedom (df) is: \(30 - 1 = \underline{29} \)
Choosing a significance level (\(\alpha\)) of 0.01, or 1%, we can find the critical T-value from a T-table , or with a programming language function:
With Python use the Scipy Stats library t.ppf() function find the T-Value for an \(\alpha\) = 0.01 at 29 degrees of freedom (df).
With R use the built-in qt() function to find the t-value for an \(\alpha\) = 0.01 at 29 degrees of freedom (df).
Using either method we can find that the critical T-Value is \(\approx \underline{2.462}\)
For a right tailed test we need to check if the test statistic (TS) is bigger than the critical value (CV).
If the test statistic is bigger than the critical value, the test statistic is in the rejection region .
When the test statistic is in the rejection region, we reject the null hypothesis (\(H_{0}\)).
Here, the test statistic (TS) was \(\approx \underline{2.889}\) and the critical value was \(\approx \underline{2.462}\)
Here is an illustration of this test in a graph:
Since the test statistic was bigger than the critical value we reject the null hypothesis.
This means that the sample data supports the alternative hypothesis.
And we can summarize the conclusion stating:
The sample data supports the claim that "The average age of Nobel Prize winners when they received the prize is more than 55" at a 1% significance level .
The P-Value Approach
For the P-value approach we need to find the P-value of the test statistic (TS).
If the P-value is smaller than the significance level (\(\alpha\)), we reject the null hypothesis (\(H_{0}\)).
The test statistic was found to be \( \approx \underline{2.889} \)
For a population proportion test, the test statistic is a T-Value from a student's t-distribution .
Because this is a right tailed test, we need to find the P-value of a t-value bigger than 2.889.
The student's t-distribution is adjusted according to degrees of freedom (df), which is the sample size \((30) - 1 = \underline{29}\)
We can find the P-value using a T-table , or with a programming language function:
With Python use the Scipy Stats library t.cdf() function find the P-value of a T-value bigger than 2.889 at 29 degrees of freedom (df):
With R use the built-in pt() function find the P-value of a T-Value bigger than 2.889 at 29 degrees of freedom (df):
Using either method we can find that the P-value is \(\approx \underline{0.0036}\)
This tells us that the significance level (\(\alpha\)) would need to be bigger than 0.0036, or 0.36%, to reject the null hypothesis.
This P-value is smaller than any of the common significance levels (10%, 5%, 1%).
So the null hypothesis is rejected at all of these significance levels.
The sample data supports the claim that "The average age of Nobel Prize winners when they received the prize is more than 55" at a 10%, 5%, or 1% significance level .
Note: An outcome of an hypothesis test that rejects the null hypothesis with a p-value of 0.36% means:
For this p-value, we only expect to reject a true null hypothesis 36 out of 10000 times.
Calculating a P-Value for a Hypothesis Test with Programming
Many programming languages can calculate the P-value to decide outcome of a hypothesis test.
Using software and programming to calculate statistics is more common for bigger sets of data, as calculating manually becomes difficult.
The P-value calculated here will tell us the lowest possible significance level where the null-hypothesis can be rejected.
With Python use the scipy and math libraries to calculate the P-value for a right tailed hypothesis test for a mean.
Here, the sample size is 30, the sample mean is 62.1, the sample standard deviation is 13.46, and the test is for a mean bigger than 55.
With R use built-in math and statistics functions find the P-value for a right tailed hypothesis test for a mean.
Left-Tailed and Two-Tailed Tests
This was an example of a right tailed test, where the alternative hypothesis claimed that parameter is bigger than the null hypothesis claim.
You can check out an equivalent step-by-step guide for other types here:
- Left-Tailed Test
- Two-Tailed Test
COLOR PICKER
Contact Sales
If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]
Report Error
If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected]
Top Tutorials
Top references, top examples, get certified.
Teach yourself statistics
Hypothesis Test: Difference Between Means
This lesson explains how to conduct a hypothesis test for the difference between two means. The test procedure, called the two-sample t-test , is appropriate when the following conditions are met:
- The sampling method for each sample is simple random sampling .
- The samples are independent .
- Each population is at least 20 times larger than its respective sample .
- The population distribution is normal.
- The population data are symmetric , unimodal , without outliers , and the sample size is 15 or less.
- The population data are slightly skewed , unimodal, without outliers, and the sample size is 16 to 40.
- The sample size is greater than 40, without outliers.
This approach consists of four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results.
State the Hypotheses
Every hypothesis test requires the analyst to state a null hypothesis and an alternative hypothesis . The hypotheses are stated in such a way that they are mutually exclusive. That is, if one is true, the other must be false; and vice versa.
The table below shows three sets of null and alternative hypotheses. Each makes a statement about the difference d between the mean of one population μ 1 and the mean of another population μ 2 . (In the table, the symbol ≠ means " not equal to ".)
The first set of hypotheses (Set 1) is an example of a two-tailed test , since an extreme value on either side of the sampling distribution would cause a researcher to reject the null hypothesis. The other two sets of hypotheses (Sets 2 and 3) are one-tailed tests , since an extreme value on only one side of the sampling distribution would cause a researcher to reject the null hypothesis.
When the null hypothesis states that there is no difference between the two population means (i.e., d = 0), the null and alternative hypothesis are often stated in the following form.
H o : μ 1 = μ 2
H a : μ 1 ≠ μ 2
Formulate an Analysis Plan
The analysis plan describes how to use sample data to accept or reject the null hypothesis. It should specify the following elements.
- Significance level. Often, researchers choose significance levels equal to 0.01, 0.05, or 0.10; but any value between 0 and 1 can be used.
- Test method. Use the two-sample t-test to determine whether the difference between means found in the sample is significantly different from the hypothesized difference between means.
Analyze Sample Data
Using sample data, find the standard error, degrees of freedom, test statistic, and the P-value associated with the test statistic.
SE = sqrt[ (s 1 2 /n 1 ) + (s 2 2 /n 2 ) ]
DF = (s 1 2 /n 1 + s 2 2 /n 2 ) 2 / { [ (s 1 2 / n 1 ) 2 / (n 1 - 1) ] + [ (s 2 2 / n 2 ) 2 / (n 2 - 1) ] }
t = [ ( x 1 - x 2 ) - d ] / SE
- P-value. The P-value is the probability of observing a sample statistic as extreme as the test statistic. Since the test statistic is a t statistic, use the t Distribution Calculator to assess the probability associated with the t statistic, having the degrees of freedom computed above. (See sample problems at the end of this lesson for examples of how this is done.)
Interpret Results
If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null hypothesis. Typically, this involves comparing the P-value to the significance level , and rejecting the null hypothesis when the P-value is less than the significance level.
Test Your Understanding
In this section, two sample problems illustrate how to conduct a hypothesis test of a difference between mean scores. The first problem involves a two-tailed test; the second problem, a one-tailed test.
Problem 1: Two-Tailed Test
Within a school district, students were randomly assigned to one of two Math teachers - Mrs. Smith and Mrs. Jones. After the assignment, Mrs. Smith had 30 students, and Mrs. Jones had 25 students.
At the end of the year, each class took the same standardized test. Mrs. Smith's students had an average test score of 78, with a standard deviation of 10; and Mrs. Jones' students had an average test score of 85, with a standard deviation of 15.
Test the hypothesis that Mrs. Smith and Mrs. Jones are equally effective teachers. Use a 0.10 level of significance. (Assume that student performance is approximately normal.)
Solution: The solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below:
State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis.
Null hypothesis: μ 1 - μ 2 = 0
Alternative hypothesis: μ 1 - μ 2 ≠ 0
- Formulate an analysis plan . For this analysis, the significance level is 0.10. Using sample data, we will conduct a two-sample t-test of the null hypothesis.
SE = sqrt[(s 1 2 /n 1 ) + (s 2 2 /n 2 )]
SE = sqrt[(10 2 /30) + (15 2 /25] = sqrt(3.33 + 9)
SE = sqrt(12.33) = 3.51
DF = (10 2 /30 + 15 2 /25) 2 / { [ (10 2 / 30) 2 / (29) ] + [ (15 2 / 25) 2 / (24) ] }
DF = (3.33 + 9) 2 / { [ (3.33) 2 / (29) ] + [ (9) 2 / (24) ] } = 152.03 / (0.382 + 3.375) = 152.03/3.757 = 40.47
t = [ ( x 1 - x 2 ) - d ] / SE = [ (78 - 85) - 0 ] / 3.51 = -7/3.51 = -1.99
where s 1 is the standard deviation of sample 1, s 2 is the standard deviation of sample 2, n 1 is the size of sample 1, n 2 is the size of sample 2, x 1 is the mean of sample 1, x 2 is the mean of sample 2, d is the hypothesized difference between the population means, and SE is the standard error.
Since we have a two-tailed test , the P-value is the probability that a t statistic having 40 degrees of freedom is more extreme than -1.99; that is, less than -1.99 or greater than 1.99.
We use the t Distribution Calculator to find P(t < -1.99) is about 0.027.
- If you enter 1.99 as the sample mean in the t-distribution Calculator, you will find the that the P(t ≤ 1.99) is about 0.973. Therefore, P(t > 1.99) is 1 minus 0.973 or 0.027. Thus, the P-value = 0.027 + 0.027 = 0.054.
- Interpret results . Since the P-value (0.054) is less than the significance level (0.10), we cannot accept the null hypothesis.
Note: If you use this approach on an exam, you may also want to mention why this approach is appropriate. Specifically, the approach is appropriate because the sampling method was simple random sampling, the samples were independent, the sample size was much smaller than the population size, and the samples were drawn from a normal population.
Problem 2: One-Tailed Test
The Acme Company has developed a new battery. The engineer in charge claims that the new battery will operate continuously for at least 7 minutes longer than the old battery.
To test the claim, the company selects a simple random sample of 100 new batteries and 100 old batteries. The old batteries run continuously for 190 minutes with a standard deviation of 20 minutes; the new batteries, 200 minutes with a standard deviation of 40 minutes.
Test the engineer's claim that the new batteries run at least 7 minutes longer than the old. Use a 0.05 level of significance. (Assume that there are no outliers in either sample.)
Null hypothesis: μ 1 - μ 2 <= 7
Alternative hypothesis: μ 1 - μ 2 > 7
where μ 1 is battery life for the new battery, and μ 2 is battery life for the old battery.
- Formulate an analysis plan . For this analysis, the significance level is 0.05. Using sample data, we will conduct a two-sample t-test of the null hypothesis.
SE = sqrt[(40 2 /100) + (20 2 /100]
SE = sqrt(16 + 4) = 4.472
DF = (40 2 /100 + 20 2 /100) 2 / { [ (40 2 / 100) 2 / (99) ] + [ (20 2 / 100) 2 / (99) ] }
DF = (20) 2 / { [ (16) 2 / (99) ] + [ (2) 2 / (99) ] } = 400 / (2.586 + 0.162) = 145.56
t = [ ( x 1 - x 2 ) - d ] / SE = [(200 - 190) - 7] / 4.472 = 3/4.472 = 0.67
where s 1 is the standard deviation of sample 1, s 2 is the standard deviation of sample 2, n 1 is the size of sample 1, n 2 is the size of sample 2, x 1 is the mean of sample 1, x 2 is the mean of sample 2, d is the hypothesized difference between population means, and SE is the standard error.
Here is the logic of the analysis: Given the alternative hypothesis (μ 1 - μ 2 > 7), we want to know whether the observed difference in sample means is big enough (i.e., sufficiently greater than 7) to cause us to reject the null hypothesis.
Interpret results . Suppose we replicated this study many times with different samples. If the true difference in population means were actually 7, we would expect the observed difference in sample means to be 10 or less in 75% of our samples. And we would expect to find an observed difference to be more than 10 in 25% of our samples Therefore, the P-value in this analysis is 0.25.
- FOR INSTRUCTOR
- FOR INSTRUCTORS
8.4.3 Hypothesis Testing for the Mean
$\quad$ $H_0$: $\mu=\mu_0$, $\quad$ $H_1$: $\mu \neq \mu_0$.
$\quad$ $H_0$: $\mu \leq \mu_0$, $\quad$ $H_1$: $\mu > \mu_0$.
$\quad$ $H_0$: $\mu \geq \mu_0$, $\quad$ $H_1$: $\mu \lt \mu_0$.
Two-sided Tests for the Mean:
Therefore, we can suggest the following test. Choose a threshold, and call it $c$. If $|W| \leq c$, accept $H_0$, and if $|W|>c$, accept $H_1$. How do we choose $c$? If $\alpha$ is the required significance level, we must have
- As discussed above, we let \begin{align}%\label{} W(X_1,X_2, \cdots,X_n)=\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}}. \end{align} Note that, assuming $H_0$, $W \sim N(0,1)$. We will choose a threshold, $c$. If $|W| \leq c$, we accept $H_0$, and if $|W|>c$, accept $H_1$. To choose $c$, we let \begin{align} P(|W| > c \; | \; H_0) =\alpha. \end{align} Since the standard normal PDF is symmetric around $0$, we have \begin{align} P(|W| > c \; | \; H_0) = 2 P(W>c | \; H_0). \end{align} Thus, we conclude $P(W>c | \; H_0)=\frac{\alpha}{2}$. Therefore, \begin{align} c=z_{\frac{\alpha}{2}}. \end{align} Therefore, we accept $H_0$ if \begin{align} \left|\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}} \right| \leq z_{\frac{\alpha}{2}}, \end{align} and reject it otherwise.
- We have \begin{align} \beta (\mu) &=P(\textrm{type II error}) = P(\textrm{accept }H_0 \; | \; \mu) \\ &= P\left(\left|\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}} \right| \lt z_{\frac{\alpha}{2}}\; | \; \mu \right). \end{align} If $X_i \sim N(\mu,\sigma^2)$, then $\overline{X} \sim N(\mu, \frac{\sigma^2}{n})$. Thus, \begin{align} \beta (\mu)&=P\left(\left|\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}} \right| \lt z_{\frac{\alpha}{2}}\; | \; \mu \right)\\ &=P\left(\mu_0- z_{\frac{\alpha}{2}} \frac{\sigma}{\sqrt{n}} \leq \overline{X} \leq \mu_0+ z_{\frac{\alpha}{2}} \frac{\sigma}{\sqrt{n}}\right)\\ &=\Phi\left(z_{\frac{\alpha}{2}}+\frac{\mu_0-\mu}{\sigma / \sqrt{n}}\right)-\Phi\left(-z_{\frac{\alpha}{2}}+\frac{\mu_0-\mu}{\sigma / \sqrt{n}}\right). \end{align}
- Let $S^2$ be the sample variance for this random sample. Then, the random variable $W$ defined as \begin{equation} W(X_1,X_2, \cdots, X_n)=\frac{\overline{X}-\mu_0}{S / \sqrt{n}} \end{equation} has a $t$-distribution with $n-1$ degrees of freedom, i.e., $W \sim T(n-1)$. Thus, we can repeat the analysis of Example 8.24 here. The only difference is that we need to replace $\sigma$ by $S$ and $z_{\frac{\alpha}{2}}$ by $t_{\frac{\alpha}{2},n-1}$. Therefore, we accept $H_0$ if \begin{align} |W| \leq t_{\frac{\alpha}{2},n-1}, \end{align} and reject it otherwise. Let us look at a numerical example of this case.
$\quad$ $H_0$: $\mu=170$, $\quad$ $H_1$: $\mu \neq 170$.
- Let's first compute the sample mean and the sample standard deviation. The sample mean is \begin{align}%\label{} \overline{X}&=\frac{X_1+X_2+X_3+X_4+X_5+X_6+X_7+X_8+X_9}{9}\\ &=165.8 \end{align} The sample variance is given by \begin{align}%\label{} {S}^2=\frac{1}{9-1} \sum_{k=1}^9 (X_k-\overline{X})^2&=68.01 \end{align} The sample standard deviation is given by \begin{align}%\label{} S&= \sqrt{S^2}=8.25 \end{align} The following MATLAB code can be used to obtain these values: x=[176.2,157.9,160.1,180.9,165.1,167.2,162.9,155.7,166.2]; m=mean(x); v=var(x); s=std(x); Now, our test statistic is \begin{align} W(X_1,X_2, \cdots, X_9)&=\frac{\overline{X}-\mu_0}{S / \sqrt{n}}\\ &=\frac{165.8-170}{8.25 / 3}=-1.52 \end{align} Thus, $|W|=1.52$. Also, we have \begin{align} t_{\frac{\alpha}{2},n-1} = t_{0.025,8} \approx 2.31 \end{align} The above value can be obtained in MATLAB using the command $\mathtt{tinv(0.975,8)}$. Thus, we conclude \begin{align} |W| \leq t_{\frac{\alpha}{2},n-1}. \end{align} Therefore, we accept $H_0$. In other words, we do not have enough evidence to conclude that the average height in the city is different from the average height in the country.
Let us summarize what we have obtained for the two-sided test for the mean.
One-sided Tests for the Mean:
- As before, we define the test statistic as \begin{align}%\label{} W(X_1,X_2, \cdots,X_n)=\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}}. \end{align} If $H_0$ is true (i.e., $\mu \leq \mu_0$), we expect $\overline{X}$ (and thus $W$) to be relatively small, while if $H_1$ is true, we expect $\overline{X}$ (and thus $W$) to be larger. This suggests the following test: Choose a threshold, and call it $c$. If $W \leq c$, accept $H_0$, and if $W>c$, accept $H_1$. How do we choose $c$? If $\alpha$ is the required significance level, we must have \begin{align} P(\textrm{type I error}) &= P(\textrm{Reject }H_0 \; | \; H_0) \\ &= P(W > c \; | \; \mu \leq \mu_0) \leq \alpha. \end{align} Here, the probability of type I error depends on $\mu$. More specifically, for any $\mu \leq \mu_0$, we can write \begin{align} P(\textrm{type I error} \; | \; \mu) &= P(\textrm{Reject }H_0 \; | \; \mu) \\ &= P(W > c \; | \; \mu)\\ &=P \left(\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}}> c \; | \; \mu\right)\\ &=P \left(\frac{\overline{X}-\mu}{\sigma / \sqrt{n}}+\frac{\mu-\mu_0}{\sigma / \sqrt{n}}> c \; | \; \mu\right)\\ &=P \left(\frac{\overline{X}-\mu}{\sigma / \sqrt{n}}> c+\frac{\mu_0-\mu}{\sigma / \sqrt{n}} \; | \; \mu\right)\\ &\leq P \left(\frac{\overline{X}-\mu}{\sigma / \sqrt{n}}> c \; | \; \mu\right) \quad (\textrm{ since }\mu \leq \mu_0)\\ &=1-\Phi(c) \quad \big(\textrm{ since given }\mu, \frac{\overline{X}-\mu}{\sigma / \sqrt{n}} \sim N(0,1) \big). \end{align} Thus, we can choose $\alpha=1-\Phi(c)$, which results in \begin{align} c=z_{\alpha}. \end{align} Therefore, we accept $H_0$ if \begin{align} \frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}} \leq z_{\alpha}, \end{align} and reject it otherwise.
$\quad$ $H_0$: $\mu \geq \mu_0$, $\quad$ $H_1$: $\mu \lt \mu_0$,
User Preferences
Content preview.
Arcu felis bibendum ut tristique et egestas quis:
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
- Duis aute irure dolor in reprehenderit in voluptate
- Excepteur sint occaecat cupidatat non proident
Keyboard Shortcuts
5.3 - hypothesis testing for one-sample mean.
In the previous section, we learned how to perform a hypothesis test for one proportion. The concepts of hypothesis testing remain constant for any hypothesis test. In these next few sections, we will present the hypothesis test for one mean. We start with our knowledge of the sampling distribution of the sample mean.
Hypothesis Test for One-Sample Mean Section
Recall that under certain conditions, the sampling distribution of the sample mean, \(\bar{x} \), is approximately normal with mean, \(\mu \), standard error \(\dfrac{\sigma}{\sqrt{n}} \), and estimated standard error \(\dfrac{s}{\sqrt{n}} \).
\(H_0\colon \mu=\mu_0\)
Conditions:
- The distribution of the population is Normal
- The sample size is large \( n>30 \).
Test Statistic:
If at least one of conditions are satisfied, then...
\( t=\dfrac{\bar{x}-\mu_0}{\frac{s}{\sqrt{n}}} \)
will follow a t-distribution with \(n-1 \) degrees of freedom.
Notice when working with continuous data we are going to use a t statistic as opposed to the z statistic. This is due to the fact that the sample size impacts the sampling distribution and needs to be taken into account. We do this by recognizing “degrees of freedom”. We will not go into too much detail about degrees of freedom in this course.
Let’s look at an example.
Example 5-1 Section
This depends on the standard deviation of \(\bar{x} \) .
\begin{align} t^*&=\dfrac{\bar{x}-\mu}{\frac{s}{\sqrt{n}}}\\&=\dfrac{8.3-8.5}{\frac{1.2}{\sqrt{61}}}\\&=-1.3 \end{align}
Thus, we are asking if \(-1.3\) is very far away from zero, since that corresponds to the case when \(\bar{x}\) is equal to \(\mu_0 \). If it is far away, then it is unlikely that the null hypothesis is true and one rejects it. Otherwise, one cannot reject the null hypothesis.
IMAGES
COMMENTS
The calculator not only calculates the \(p\text{-value}\) (p = 0.0396) but it also calculates the test statistic (t-score) for the sample mean, the sample mean, and the sample standard deviation. \(\mu > 65\) is the alternative hypothesis.
This means we would expect to find a sample mean of 108 or smaller in 19 percent of our samples, if the true population IQ were 110. Thus the P-value in this analysis is 0.19. Interpret results. Since the P-value (0.19) is greater than the significance level (0.01), we cannot reject the null hypothesis.
With Python use the scipy and math libraries to calculate the P-value for a right tailed hypothesis test for a mean. Here, the sample size is 30, the sample mean is 62.1, the sample standard deviation is 13.46, and the test is for a mean bigger than 55. import scipy.stats as stats
The null hypothesis will be rejected if the difference between sample means is bigger than would be expected by chance. Formulate an analysis plan. For this analysis, the significance level is 0.05. Using sample data, we will conduct a two-sample t-test of the null hypothesis. Analyze sample data. Using sample data, we compute the standard ...
If using the raw data, enter the column of interest into the blank variable window below the drop down selection. If using summarized data, enter the sample size, sample mean, and sample standard deviation in their respective fields. Choose the check box for "Perform hypothesis test" and enter the null hypothesis value. Choose Options.
Then type in the hypothesized mean (μ 0), sample standard deviation, sample mean, sample size (or list name (list1), and Freq: 1), arrow over to the \(\neq\), <, > and select the sign that is the same as the problem's alternative hypothesis statement then press the [ENTER] key to calculate. The calculator returns the t-test statistic and p ...
In this case, the null hypothesis is a simple hypothesis and the alternative hypothesis is a two-sided hypothesis (i.e., it includes both $\mu \lt \mu_0$ and $\mu>\mu_0$). We call this hypothesis test a two-sided test. The second and the third cases are one-sided tests. More specifically, the second case is
If a t-model is appropriate, determine the t-test statistic for the data's sample mean. Use the test statistic, together with the alternative hypothesis, to determine the P-value. The P-value is the probability of finding a random sample with a mean at least as extreme as our sample mean, assuming that the null hypothesis is true.
The mean length of the lumber is supposed to be 8.5 feet. A builder wants to check whether the shipment of lumber she receives has a mean length different from 8.5 feet. If the builder observes that the sample mean of 61 pieces of lumber is 8.3 feet with a sample standard deviation of 1.2 feet. What will she conclude? Is 8.3 very different from ...
Success criteria — hypothesis test for a sample mean: 1. State the null hypothesis: it is always where is the given population mean 2. Decide whether you will carry out a tailed or tailed test (it is usually given in the question). 3. State the alternative hypothesis, : • — two-tailed test • — one-tailed test, it is believed the ...