7.3: The One Sample t-Test Formula
- Page ID
- 50043
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)The formula is set up as a division problem with four symbols which represent and, thus, must be replaced with specific values. The numerator focuses on the difference between the sample statistic and the (known or hypothesized) population parameter for a variable. This is the core of the formula because the hypotheses tested using a one sample t-test are specifically asking whether these two values differ. Therefore, you can think of the numerator as the main focus of the formula and the denominator as taking into account other necessary information and adjustments. This will be true for the main format used for all three versions of the t-test in this book. The denominator of the one sample t-test formula is used to take into account the error in the sample (via the standard deviation) and the sample size. The one sample t-test formula is as follows:
\[t=\dfrac{\bar{x}-\mu}{\left(\frac{s}{\sqrt{n}}\right)} \nonumber\]
Notice that the formula, though small, includes all three components that impact statistical power (see Chapter 6 for a review of the components of power):
- The size of the change, difference, or pattern observed in the sample
- The sample size
- The size of the error in the sample statistic(s)
The first component, size of difference, is being incorporated in the numerator. The second and third components of sample size and error are being incorporated in the denominator.
Let’s take a moment to further examine the denominator. Recall that we expect some error when we draw a sample from a population and that we call this sampling error. We often estimate this error with the formula for standard error (\(SE\)). \(SE\) is calculated by dividing the sample standard deviation by the square root of the sample size (i.e. \(SE=s / \sqrt{n}\)). Thus, the denominator for a one sample t-test is actually the standard error formula (see Chapter 6 for a review of standard error). This means that we have the SE formula inside of our one sample t-test formula. Smaller formulas appearing inside larger formulas will happen a lot as we move though the various inferential statistics formulas. This is because statistics builds on some underlying estimates and concepts that get subsumed into more complex formulas to address different needs. If you keep this in mind, it can make future formulas easier to learn and understand, especially when the same formula may be written a few different ways. For example, the one sample t-test formula can be written as follows:
\[t=\dfrac{\bar{x}-\mu}{SE} \nonumber\]
This version of the formula requires the same information and steps as the one shown previously; the only difference is that the steps used to calculate the standard error in the denominator have been replaced with the symbol for SE. Therefore, these two versions of the formula have the exact same steps and will yield the same result. You can use either version. However, this abbreviated one requires that you either remember or look up how to calculate \(SE\). In contrast, the previous version shows you how to calculate \(SE\). Therefore, I recommend using the previous one showing the \(SE\) formula rather than the latter one showing the \(SE\) symbol, especially if you are newer to statistics and/or to memorizing mathematical formulas and symbols in general.
When adding formulas to your notes:
- use the version which shows more steps and
- note for yourself when a group of symbols and operations within a formula are actually another formula altogether.
This will help you connect across topics and see that much of statistics breaks down to the same elements repeating in various ways to create new formulas.
One Sample t-Test Formula
\(t=\dfrac{\bar{x}-\mu}{\left(\frac{s}{\sqrt{n}}\right)}\) | \(\Leftarrow \)The Standard Error (\(SE\)) Formula appears as the denominator of the one sample t-test formula |
\(t=\dfrac{\bar{x}-\mu}{s / \sqrt{n}}\) | The formula may also be written like this where the parenthesis for the denominator is implied. The formula and steps are the same as for the version shown above. |
Formula Components
In order to solve for t, four things must first be known:
\(\mu\) = the hypothesized or known population mean
\(\bar{x}\)= the sample mean
\(s\) = the sample standard deviation
\(n\) = the sample size
Some of these components can be given while others generally need to be calculated from a data set. Typically, the information for the population is given and the information for the sample is calculated from a data set when using this formula. If all four components are given, one can proceed to plugging them into the formula and finding the t-value using the order of operations. However, because the sample statistics are typically found using data, all steps are shown below assuming these need to be calculated.
Formula Steps
The steps are shown in order and categorized into two sections: A) preparation and B) solving. I recommend using this categorization to help you organize, learn, and properly use all inferential formulas. Preparation steps refer to any calculations that need to be done before values can be plugged into the formula. For the one sample t-test this includes finding the descriptive statistics that make up the four components of the formula (listed above). Once those are known, the steps in section B can be used to yield the obtained value for the formula. The symbol for the obtained value for each t-test is t. Follow these steps, in order, to find t.
Section A: Preparation
- Identify \(\mu\) using the known population mean or otherwise hypothesized value.
- Find \(n\) using the sample data for the focal variable.
- Find \(\bar{x}\) using the sample data for the focal variable.
- Find \(s\) using the sample data for the focal variable.
Section B: Solving
- Write the formula with the values found in section A plugged into their respective locations.
- Solve the numerator by subtracting the population (or hypothesized) mean from the sample mean.
- Solve for the denominator by finding the square root of the sample size and then dividing the sample standard deviation by that value.
- Solve for t by dividing the numerator (result of step 2) by the denominator (the result of step 3).
You may have noticed that we are solving the numerator before the denominator despite the fact that the denominator is shown in parentheses. This may seem like it goes against the order of operations commonly referred to as PEMDAS. PEMDAS states the correct order of computations is: Parentheses, Exponents, Multiplication and Division, and finally, Adding and Subtracting. However, the P in PEMDAS is better stated as G for Grouping (making the acronym GEMDAS). This is because we work through any groups of operations first, regardless of whether they are in parentheses, brackets, or other grouping structures. Our formula actually has two groups of steps: those in the numerator and those in the denominator. This is because the division sign in the middle of the formula separates the operations into these two distinct groups. Therefore, when we see a horizontal division line (like we see in the one sample t-test formula), it is treated as a grouping structure. You can imagine that the whole numerator is within parentheses just like the denominator. For more review of order of operations, see Appendix B.
Test Scores |
---|
85 80 80 75 75 75 70 70 70 70 65 65 65 65 65 60 60 60 60 55 55 55 50 50 45 |
Example of How to Test a Hypothesis by Computing t
Let us assume that a school has implemented a new teaching strategy, and we want to assess whether the students at that school are scoring significantly differently on a standardized test than students in general in the United States. Let us assume that the mean for the population of students in the U.S. is 58.00. Assume that Data Set 7.1 includes data from the school sample. Let’s use this information to test a hypothesis.
Steps in Hypothesis Testing
In order to test a hypothesis, we must follow the steps for hypothesis testing:
- State the hypothesis.
A non-directional hypothesis is the best fit because the goal is to see if those at the school had a different mean score from the population without having enough information to hypothesize whether the sample will be specifically higher or lower than the population. A summary of the research hypothesis and corresponding null hypothesis in sentence and symbol format are shown below. However, researchers often only state the research hypothesis using a format like this: It is hypothesized that the mean test score for the school sample will be different from the population mean of 58.00. If the format shown in the table below is used instead, it must be made clear that what is being stated is a research hypothesis not a result (hence, you see it labeled to the left of the hypothesis as such).
Research hypothesis |
The mean test score for the school sample will be different from the population mean of 58.00. |
\(H_A: \bar{X} \neq \bar{\mu}\) |
---|---|---|
Null hypothesis |
The mean test score for the school sample will not be different from the population mean of 58.00. |
\(H_0: \bar{X}=\bar{\mu}\) |
- Choose the inferential test (formula) that best fits the hypothesis.
A sample mean is being compared to a population mean so the appropriate test is a one sample t-test.
- Determine the critical value.
In order to determine the critical value, three things must be identified:
- the alpha level,
- whether the hypothesis requires a one-tailed test or a two-tailed test, and
- the degrees of freedom for the test (\(d f\)).
An alpha level refers to the risk of a Type I Error that is being taken and is summarized with the symbol α. Alpha levels are often set at .05 unless there is reason to adjust them such as when multiple hypotheses are being tested in one study or when a Type I Error could be particularly problematic. The default alpha level can be used for this example because only one hypothesis is being tested and there is no clear indication that a Type I Error would be especially problematic. Thus, alpha can be set to 5%, which can be summarized as \(\alpha\) = .05.
The hypothesis is non-directional so a two-tailed test should be used.
The df must also be calculated. Each inferential test has a unique formula for calculating \(d f\). See the section titled “Deeper Dive: What are Degrees of Freedom?” later in this chapter to learn what \(d f\) represents and how it is calculated for the different t-tests before returning to this section to complete the steps in hypothesis testing. In short, the formula for \(d f\) for a one sample t-test is as follows: \(d f= n – 1\). The sample size for Data Set 7.1 is 25. Thus, \(d f\) = 25 – 1 so the \(d f\) for this scenario is 24.
These three pieces of information are used to locate the critical value for the test. The full tables of the critical values for t-tests are located in Appendix D. Below is an excerpt of the section of the t-tables that fits the current hypothesis and data. Under the conditions of an alpha level of .05, a two-tailed test, and 24 degrees of freedom, the critical value is 2.064.
two-tailed test | ||
alpha level: | \(\alpha\) = 0.05 | \(\alpha\) = 0.01 |
Degrees of Freedom: | 24 | 24 |
Critical Values: | 2.064 | 2.797 |
The critical value represents the absolute value which must be exceeded in order to declare a result significant. Think of this as the threshold of evidence needed to be confident a hypothesis is true and think of the obtained value (which is called t in a t-test) as the amount of evidence present.
- Calculate the test statistic.
A test statistic can also be referred to as an obtained value. The formula needed to find the test statistics t for this scenario is as follows:
\[t=\dfrac{\bar{x}-\mu}{\left(\frac{s}{\sqrt{n}}\right)} \nonumber \]
Section A: Preparation
Start each inferential formula by identifying and solving for the pieces that must go into the formula. For the one sample t-test, this preparatory work is as follows:
- Identify \(\mu\) using the known population value or the hypothesized value.
- This value is given as \(\mu\) = 58.00
- Find \(n\) using the sample data for the focal variable.
- This value is found using Data Set 7.1 and is summarized as \(n\) = 25
- Find \(\bar{x}\) using the sample data for the focal variable.
- This value is found using Data Set 7.1 and is summarized as \(\bar{x}\)= 65.00
- Find \(s\) using the sample data for the focal variable.
- This value is found using Data Set 7.1 and is summarized as \(s\) = 10.2062
For review of how to calculate a sample mean, see Chapter 3. For review of how to calculate a sample standard deviation, see Chapter 4. The standard deviation is shown rounded to the ten thousandths place.
Now that the pieces needed for the formula have been found, we can move to Section B.
Section B: Solving
Now that the preparatory work is done, the formula can be used to compute the obtained value. For the one sample t-test, this work is as follows:
Write the formula with the values found in section A plugged into their respective locations. Writing the formula first in symbol format before filling it in with the values can help you recognize and memorize it. Here is the formula with the symbols:
\[t=\dfrac{\bar{x}-\mu}{\left(\frac{s}{\sqrt{n}}\right)} \nonumber \]
Here is the formula with values filled into their appropriate locations in place of their symbols: \[t=\dfrac{65.00-58.00}{\left(\frac{10.2062}{\sqrt{25}}\right)} \nonumber\]
Once the symbols have been replaced by values, it is easier to see the mathematical operations which should be followed using the order of operations.
- Solve the numerator by subtracting the population (or hypothesized) mean from the sample mean. \[65.00-58.00=7.00 \nonumber\]
- Solve for the denominator by finding the square root of the sample size and then dividing the sample standard deviation by that value. \[\begin{aligned}
& \frac{10.2062}{\sqrt{25}} \\
& =\frac{10.2062}{5} \\
& \approx 2.0412
\end{aligned} \nonumber \] - Solve for t by dividing the numerator (result of step 2) by the denominator (the result of step 3). \[\begin{aligned}
& t=\frac{7.00}{2.0412} \\
& t \approx 3.4294
\end{aligned} \nonumber \] This result, known as a test statistic or t-value, can also be referred to by the general term “obtained value.”
- Apply a decision rule and determine whether the result is significant.
Assess whether the obtained value for t exceeds the critical value as follows:
The critical value is 2.064.
The obtained t-value is 3.4294
The obtained t-value does exceed (i.e. is greater than) the critical value, thus, the result is significant.
Only the size of the values, not whether they are positive or negative, is considered when a hypothesis is non-directional (i.e. when a two-tailed test is being performed). Thus, it is the absolute value of t that is being compared to the critical value. However, when a directional hypothesis is used, both the direction and the size of the t-value must be considered.
- Calculate the effect size and/or other relevant secondary analyses.
When it is determined that the result is significant, effect sizes should be computed. Because the result was determined to be significant in step 4, the effect size is needed before proceeding to step 7 to complete the process.
The effect size that is appropriate for t-tests is known as Cohen’s d (Cohen, 1988). The formula for Cohen’s \(d\) is as follows:
\[d=\dfrac{\bar{x}-\mu}{s} \nonumber \]
You may notice how similar the effect size formula is to the one sample t-test formula. Cohen’s \(d\), when used for a one sample t-test, calculates how many sample standard deviations the sample mean is from the population mean (or hypothesized mean). Thus, the numerator finds the difference in the two means and the denominator is used to divide that by the sample standard deviation. The calculations for the current data would be as follows:
\[\begin{gathered}
d=\frac{65.00-58.00}{10.2062} \\
d=\frac{7.00}{10.2062} \\
d \approx 0.6859
\end{gathered} \nonumber \]
Effect sizes, like most values, are rounded and reported to the hundredths place. Thus, this effect size is reported as \(d\) = 0.69. Cohen’s \(d\) can be interpreted using the following rules of thumb (Cohen, 1988; Navarro, 2014):
~0.80 | Large effect |
~0.50 | Moderate effect |
~0.20 | Small effect |
The rules of thumb are general guidance and do not dictate precise or required interpretations. Instead, they provide some generally agreed upon approximations to aid in interpretations. As is true of all analyses, it is best to consider their situated (or practical) relevance. However, the rules of thumb are useful in providing an initial guideline for interpreting effect sizes. Following these rules of thumb, the current finding of \(d\) = 0.69 would be considered a moderate to large effect.
- Report the results in American Psychological Associate (APA) format.
Results for inferential tests are often best summarized using a paragraph that states the following:
- the hypothesis and specific inferential test used,
- the main results of the test and whether they were significant,
- any additional results that clarify or add details about the results,
- whether the results support or refute the hypothesis.
Keep in mind that results are reported in past tense because they report on what has already been found. In addition, the research hypothesis must be stated but the null hypothesis is usually not needed for summary paragraphs because it can be deduced from the research hypothesis. Finally, APA format requires a specific format be used for reporting the results of a test. This includes recommendations for rounding and a specific format for reporting relevant symbols and details for the formula and data used. Throughout this book, decimal numbers will be rounded to the hundredths place when reported in a summary sentence or paragraph. Following this, the results for our hypothesis with Data Set 7.1 can be written as shown in the summary example below.
A one sample t-test was used to test the hypothesis that the mean test score for the school sample would be different from the population mean of 58.00. Consistent with the hypothesis, the mean test score for the sample (\(M\) = 65.00; \(SD\) = 10.21) was significantly different than the mean for the population, t(24) = 3.43, \(p\) < .05. The Cohen’s \(d\) effect size of 0.69 was moderate to large.
This succinct summary in APA format provides a lot of detail and uses specific symbols in a particular order. To understand how to read and create a summary like this, let’s take a detailed walk-though of each piece, what it means, and why it appears where it does. Each inferential test will use this structure, though as we progress through some chapters, the summary paragraph will grow to accommodate the increasing complexity and/or details of the analyses. Thus, in the same way it is necessary to understand the smaller formulas because each chapter builds from them, it is also necessary to understand the basic parts of a summary paragraph because these, too, will be built upon.