Biostat W9
Biostat W9
This module focuses on commonly used hypothesis testing one sample t-test, independent samples
t-test, and paired t-test. In this module, we shall use the non-directional (i.e., two-tailed) alternative
hypothesis.
Lesson Proper:
ONE SAMPLE T TEST
Introduction
The One Sample t Test determines whether the sample mean is statistically different from a known or
hypothesized population mean. The One Sample t Test is a parametric test.
This test is also known as: Single Sample t Test
The variable used in this test is known as: Test variable
In a One Sample t Test, the test variable is compared against a "test value", which is a known or
hypothesized value of the mean in the population.
Common Uses
Data Requirements
The data must meet the following requirements:
1. Test variable that is continuous (i.e., interval or ratio level)
2. Scores on the test variable are independent (i.e., independence of observations)
There is no relationship between scores on the test variable
Violation of this assumption will yield an inaccurate p value
3. Random sample of data from the population
4. Normal distribution (approximately) of the sample and population on the test variable
Non-normal population distributions, especially those that are thick-tailed or heavily skewed,
considerably reduce the power of the test
Among moderate or large samples, a violation of normality may still yield accurate p values
5. Homogeneity of variances (i.e., variances approximately equal in both the sample and population)
6. No outliers
Hypothesis
The null hypothesis (H0) and alternative hypothesis (H1) of the one sample T test can be expressed as:
where µ is a constant proposed for the population mean and x is the sample mean.
Note: In real life, the decision whether your alternative hypothesis is two-tailed or one-tailed depends on you.
Problem:
According to the X agency, the mean height of adults ages 20 and older is about 67.5 inches (69.3 inches for
males, 64.8 inches for females). Let's test if the mean height of our sample data is not equal to 67.5 inches
using a one-sample t test (alpha = 0.05)
Data Set:
65.39, 64.51, 64.41, 66.86, 64.18, 67.4, 66.09, 64.18, 64.75, 64.77, 67.7, 62.74, 66.04, 64.09, 65.62, 64.54,
68.39, 65.71, 65.16, and 67.01
Hypotheses:
H0: 67.5 = µHeight ("the mean height of the sample is equal to 67.5")
H1: 67.5 ≠ µHeight ("the mean height of the sample is not equal to 67.5") –
non-directional/two-tailed test
where 67.5 is the X's estimate of average height for adults, and xHeight is the mean height of the sample.
Step 1: To run the One Sample t Test, click Analyze > Compare Means > One-Sample T Test.
Step 2: Move the variable Height to the Test Variable(s) area. In the Test Value field, enter 67.5, which is the
X's estimation of the average height of adults over 20.
Step 3: Set the confidence level. Since our alpha is 0.05, we set it at 95% (i.e, 0.05 = 95%; 0.01 = 99%)
Step 4. Click OK to run the One Sample t Test.
Results:
Two sections (boxes) appear in the output: One-Sample Statistics and One-Sample Test. The first section,
One-Sample Statistics, provides basic information about the selected variable, Height, including the valid
(nonmissing) sample size (n), mean, standard deviation, and standard error. In this example, the mean height
of the sample is 65.48 inches, which is based on 20 nonmissing observations.
The second section, One-Sample Test, displays the results most relevant to the One Sample t Test.
A - Test Value: The number we entered as the test value in the One-Sample T Test window.
B - t Statistic: The test statistic of the one-sample t test, denoted t. In this example, t = -6.313. Note that t is
calculated by dividing the mean difference (E) by the standard error mean (from the One-Sample Statistics
box).
C - df: The degrees of freedom for the test. For a one-sample t test, df = n - 1; so here, df = 20 - 1 = 19.
D - Sig. (2-tailed): The two-tailed p-value corresponding to the test statistic.
E - Mean Difference: The difference between the "observed" sample mean (from the One Sample Statistics
box) and the "expected" mean (the specified test value (A)). The sign of the mean difference corresponds to
the sign of the t value (B). The negative t value in this example indicates that the mean height of the sample is
less than the hypothesized value (67.5).
F Confidence Interval for the Difference: The confidence interval for the difference between the specified test
value and the sample mean.
Decision and Conclusion:
Since our hypothesis is non-directional (i.e., two-tailed), we will use the p-value in the Sig. (2-tailed) part of
the table above. We reject Ho if p < 0.05; we accept Ho if p > 0.05.
Since p is < 0.001 (i.e., 000 is read as <0.001) and is less than the alpha of 0.05, we reject the null hypothesis
that the sample mean is not equal to the hypothesized population mean and conclude that the mean height
of the sample is significantly different than the average height of the overall adult population (i.e., our sample
mean height is not equal to the hypothesized mean height of 67.5).
Based on the results, we can state the following:
There is a significant difference in mean height between the sample and the overall adult population
(p < .001).
The average height of the sample is about 2.0 inches shorter than the overall adult population
average.
PAIRED SAMPLES T-TEST
Introduction
The Paired Samples t Test compares two means that are from the same individual, object, or related units.
The two means can represent things like:
A measurement taken at two different times (e.g., pre-test and post-test with an intervention
administered between the two time points)
A measurement taken under two different conditions (e.g., completing a test under a "control"
condition and an "experimental" condition)
Measurements taken from two halves or sides of a subject or experimental unit (e.g., measuring
hearing loss in a subject's left and right ears).
The purpose of the test is to determine whether there is statistical evidence that the mean difference
between paired observations on a particular outcome is significantly different from zero. The Paired Samples t
Test is a parametric test.
This test is also known as:
Dependent t Test
Paired t Test
Repeated Measures t Test
The variable used in this test is known as:
Dependent variable, or test variable (continuous), measured at two different times or for two related
conditions or units
Common Uses
The Paired Samples t Test is commonly used to test the following:
o Statistical difference between two time points
o Statistical difference between two conditions
o Statistical difference between two measurements
o Statistical difference between a matched pair
Note: The Paired Samples t Test can only compare the means for two (and only two) related (paired) units on
a continuous outcome that is normally distributed. The Paired Samples t Test is not appropriate for analyses
involving the following: 1) unpaired data; 2) comparisons between more than two units/groups; 3) a
continuous outcome that is not normally distributed; and 4) an ordinal/ranked outcome.
To compare unpaired means between two groups on a continuous outcome that is normally
distributed, choose the Independent Samples t Test.
To compare unpaired means between more than two groups on a continuous outcome that is
normally distributed, choose ANOVA.
To compare paired means for continuous data that are not normally distributed, choose the
nonparametric Wilcoxon Signed-Ranks Test.
To compare paired means for ranked data, choose the nonparametric Wilcoxon Signed-Ranks Test.
Data Requirements
Hypothesis
The hypotheses can be expressed in two different ways that express the same idea and are mathematically
equivalent:
H0: µ1 - µ2 = 0 ("the difference between the paired population means is equal to 0")
H1: µ1 - µ2 ≠ 0 ("the difference between the paired population means is not 0")
Where µ1 is the population mean of variable 1, and µ2 is the population mean of variable 2
Note: In real life, the decision whether your alternative hypothesis is two-tailed or one-tailed depends on you.
For the purposes of instruction and for simplicity, we shall use two-tailed test.
Problem:
The women’s weights before and after 12 weeks of treatment with a very low calorie diet are as follows. Is
there a sufficient evidence to conclude that the treatment is effective? Use alpha 0.05
Before After
117.3 83.3
111.4 85.9
98.6 75.8
104.3 82.9
105.4 82.3
100.4 77.7
81.7 62.7
89.5 69.0
78.2 63.9
H0: µ1 - µ2 = 0 ("the difference between the paired population means is equal to 0")
H1: µ1 - µ2 ≠ 0 ("the difference between the paired population means is not 0")
Perform a test for normality of distribution. If the distribution is normal, proceed to testing for paired samples
t-test; otherwise, use appropriate non-parametric statistical tool. For the purpose of instruction for this week,
do not proceed and just write “paired samples t-test not applicable; use non-parametric statistical tool”.
Since the p value (Sig.) 0.316 is greater than the alpha of 0.05, we can conclude that the distribution is
normally distributed; thus, we can proceed to the performance of paired samples t-test.
Step 3: Click Options… In the Options Window, set the Confidence Interval Percentage at 95 since our alpha is
0.05.
Results:
There are three tables: Paired Samples Statistics, Paired Samples Correlations, and Paired Samples Test.
Paired Samples Statistics gives univariate descriptive statistics (mean, sample size, standard deviation, and
standard error) for each variable entered. Notice that the sample size here is 9; this is because the paired
t-test can only use cases that have non-missing values for both variables. Paired Samples Correlations shows
the bivariate Pearson correlation coefficient (with a two-tailed test of significance) for each pair of variables
entered. Paired Samples Test gives the hypothesis test results.
The Paired Samples Statistics output repeats what we examined before we ran the test. The Paired Samples
Correlation table adds the information that Before and After weights are significantly positively correlated (r
= .960). The Pearson correlation shall be discussed in the succeeding lessons.
Possible decisions
1. If the p-value is less than the alpha of 0.05, reject the null hypothesis.
2. If the p-value is greater than the alpha of 0.05, accept the null hypothesis.
From the results, we can say that:
Since the p value of <0.001 is less than the alpha of 0.05, we reject the null hypothesis. It means that there
was a significant difference between Before and After weights (t(8) = 12.740, p < 0.001); thus, the treatment
is effective.
Please note of the t-statistic; it is a positive number. This means that the mean weight of “Before” is greater
than “After”—the goal of low calorie diet.
INDEPENDENT SAMPLES T-TEST
Introduction
The Independent Samples t Test compares the means of two independent groups in order to determine
whether there is statistical evidence that the associated population means are significantly different. The
Independent Samples t Test is a parametric test.
This test is also known as:
Independent t Test
Independent Measures t Test
Independent Two-sample t Test
Student t Test
Two-Sample t Test
Uncorrelated Scores t Test
Unpaired t Test
Unrelated t Test
The variables used in this test are known as:
Dependent variable, or test variable
Independent variable, or grouping variable
Common Uses
Data Requirements
The null hypothesis (H0) and alternative hypothesis (H1) of the Independent Samples t Test can be expressed
in two different but equivalent ways:
where µ1 and µ2 are the population means for group 1 and group 2, respectively.
The Independent Samples t Test requires the assumption of homogeneity of variance -- i.e., both groups have
the same variance. SPSS conveniently includes a test for the homogeneity of variance, called Levene's Test,
whenever you run an independent samples t test.
H0: σ12 - σ22 = 0 ("the population variances of group 1 and 2 are equal")
H1: σ12 - σ22 ≠ 0 ("the population variances of group 1 and 2 are not equal")
This implies that if we reject the null hypothesis of Levene's Test, it suggests that the variances of the two
groups are not equal; i.e., that the homogeneity of variances assumption is violated.
In other words, if the p-value of Levene’s Test is less than the alpha of 0.05, the variances are unequal; if it is
greater than the alpha of 0.05, the variances are equal.
The output in the Independent Samples Test table includes two rows: Equal variances assumed and Equal
variances not assumed. If Levene’s test indicates that the variances are equal across the two groups (i.e.,
p-value large), you will rely on the first row of output, Equal variances assumed, when you look at the results
for the actual Independent Samples t Test (under the heading t-test for Equality of Means). If Levene’s test
indicates that the variances are not equal across the two groups (i.e., p-value small), you will need to rely on
the second row of output, Equal variances not assumed, when you look at the results of the Independent
Samples t Test (under the heading t-test for Equality of Means).
The difference between these two rows of output lies in the way the independent samples t test statistic is
calculated. When equal variances are assumed, the calculation uses pooled variances; when equal variances
cannot be assumed, the calculation utilizes un-pooled variances and a correction to the degrees of freedom.
Problem:
The serum uric acid of mentally-challenged and normal individuals of the same age and sex from a general
hospital was conducted and the result is shown below. Is there a significant difference in the mean serum uric
acid levels between normal individuals and mentally challenged?
Mentally-challenged individuals (in mg/dL): 3.83, 2.75, 5.85, 4.74, 5.84, 2.04, 4.71, 4.61, 4.5, 4.32, 4.46, 5.42,
6.37, 4.08, 5.6
Normal individuals (in mg/dL): 3.81, 0.99, 2.98, 2.63, 2.27, 2.74, 4.63, 1.67, 3.83, 3.29, 4.54, 5.17, 3.39, 4.35,
4.32
Perform a test for normality of distribution. If the distribution is normal, proceed to testing for independent
samples t-test; otherwise, use appropriate non-parametric statistical tool. For the purpose of instruction for
this week, do not proceed and just write “independent samples t-test not applicable; use non-parametric
statistical tool”.
Step 3: In the Split File Window, click “Organize output by groups” and transfer the variable “Mental_State”
into the “Groups based on” box.
Step 4: Click OK
Step 5: Perform Normality Test
Since the p values (Sig.) of Mentally Challenged patients (i.e., 0.451) and of Normal patients (i.e., 0.869) are
both greater than the alpha of 0.05, we can conclude that the distributions are normally distributed; thus, we
can proceed to the performance of independent samples t-test.
Note: Before running the test, unsplit file by going to Data>Split File. Click “Analyze all cases, do not create
groups” in the Split File Window.
Step 2: In the Independent-Samples T Test Window, drag the dependent variable “Serum_Uric_Acid” to the
“Test Variable(s):” box. Also, drag the independent variable “Mental_State” to the “Grouping variable:” box.
Step 3: In the same window in Step 2, Click Define Groups. In the Define Groups Window, type 1 in Group 1
box, since our label for Mentally Challenged group in the variable view of the input window is “1”, and type 2
in Group 2 box, since our label for Normal group in the variable view of the input window is “2”.
Results:
Two sections (boxes) appear in the output: Group Statistics and Independent Samples Test. The first section,
Group Statistics, provides basic information about the group comparisons, including the sample size (n), mean,
standard deviation, and standard error for mile times by group. In this example, there are 15 mentally
challenged and 15 normal individuals. The mean serum uric acid level of the mentally challenged group is 4.61
mg/dL, and the mean serum uric acid level of the normal group is 3.37 mg/dL.
The second section, Independent Samples Test, displays the results most relevant to the Independent
Samples t Test. There are two parts that provide different pieces of information: (A) Levene’s Test for Equality
of Variances and (B) t-test for Equality of Means.
A - Levene's Test for Equality of of Variances: This section has the test results for Levene's Test. From left to
right:
F is the test statistic of Levene's test
is the p-value corresponding to this test statistic.
The p-value of Levene's test is 0.698, which is greater than the alpha of 0.05, so we accept the null of Levene's
test and conclude that the variances of the mean serum uric acid level of both the mentally challenged and
normal groups is equal. This tells us that we should look at the "Equal variances assumed" row for the t test
(and corresponding confidence interval) results. (If this test result had been significant -- that is, if we had
observed p > α -- then we would have used the "Equal variances not assumed" output.)
B - t-test for Equality of Means provides the results for the actual Independent Samples t Test. From left to
right:
t is the computed test statistic
df is the degrees of freedom
Sig (2-tailed) is the p-value corresponding to the given test statistic and degrees of freedom
Mean Difference is the difference between the sample means; it also corresponds to the numerator of
the test statistic
Error Difference is the standard error; it also corresponds to the denominator of the test statistic
Note that the mean difference is calculated by subtracting the mean of the second group from the mean of
the first group. In this example, the mean serum uric acid level of normal individuals was subtracted from the
mean serum uric acid level of mentally-challenged individuals (4.6080 – 3.3740 = 1.23400). The sign of the
mean difference corresponds to the sign of the t value. The positive t value in this example indicates that the
mean serum uric acid of the first group, mentally challenged individuals, is significantly greater than the mean
serum uric acid level of the second group, normal individuals.
C - Confidence Interval of the Difference: This part of the t-test output complements the significance test
results. Typically, if the CI for the mean difference contains 0, the results are not significant at the chosen
significance level. In this example, the 95% CI is [0.36017, 2.10783], which does not contain zero; this agrees
with the small p-value of the significance test.
Since p value of .007 is less than our chosen significance level α = 0.05, we can reject the null hypothesis, and
conclude that the that the mean serum uric acid level of mentally-challenged and normal individuals is
significantly different.
Based on the results, we can state the following:
There was a significant difference in mean serum uric acid level between mentally challenged and
normal individual (t(28)= 2.893, p .007).
The average serum uric acid level of mentally challenged individuals was higher by 1.23 mg/dL than
the average serum uric acid level of normal individuals
***END OF LESSON***