Hypothesis Testing Part 2
Hypothesis Testing Part 2
PART 2
Melanie Joy Arellano, RMT
Learning Outcomes
◦ Explain the uses of select statistics tools for hypothesis testing
◦ Interpret results of the said test.
ONE SAMPLE T TEST
◦ 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.
◦ This test is useful when the population standard deviation is unknown, and the sample
size is relatively small (typically n<30).
ONE SAMPLE T TEST
◦ Common Uses
◦ The One Sample t Test is commonly used to test the following:
◦ Statistical difference between a sample mean and a known or hypothesized value of the
mean in the population.
◦ Statistical difference between the sample mean and the sample midpoint of the test
variable.
◦ Statistical difference between the sample mean of the test variable and chance.
◦ This approach involves first calculating the chance level on the test variable. The chance level is
then used as the test value against which the sample mean of the test variable is compared.
◦ Statistical difference between a change score and zero.
◦ This approach involves creating a change score from two variables, and then comparing the
mean change score to zero, which will indicate whether any change occurred between the two
time points for the original measures. If the mean change score is not significantly different from
zero, no significant change occurred.
ONE SAMPLE T TEST
◦ Note: The One Sample t Test can only compare a single sample mean to a specified
constant. It cannot compare sample means between two or more groups. If you wish
to compare the means of multiple groups to each other, you will likely want to run an
Independent Samples t Test (to compare the means of two groups) or a One-Way
ANOVA (to compare the means of two or more groups).
ONE SAMPLE T TEST
◦ Data Requirements
◦ The data must meet the following requirements:
◦ Test variable that is continuous (i.e., interval or ratio level)
◦ 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
◦ Random sample of data from the population
◦ 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
◦ Homogeneity of variances (i.e., variances approximately equal in both the sample and
population)
◦ No outliers
ONE SAMPLE T TEST
Hypothesis
◦ The null hypothesis (H0) and alternative hypothesis (H1) of the one sample T test can be
expressed as:
◦ H0: µ = x ("the sample mean is equal to the [proposed] population mean")
◦ H1: µ ≠ x ("the sample mean is not equal to the [proposed] population mean")
◦ 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.
ONE SAMPLE T TEST
◦ Example 1 for One-Tail T-test
◦ 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
ONE SAMPLE T TEST
◦ Hypotheses:
◦ The null and alternative hypotheses of this test will be:
◦ 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.
ONE SAMPLE T TEST
Before the Test:
◦ Perform a test for normality of distribution. If the distribution is normal, proceed to testing
for one-sample t-test; otherwise, use appropriate non-parametric statistical tool. For the
purpose of instruction for this week, do not proceed and just write “t-test not
applicable; use non-parametric statistical tool”.
ONE SAMPLE T TEST
◦ Since the p value (Sig.) 0.623 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 one
sample t-test.
ONE SAMPLE T TEST
◦ Running the Test:
◦ Step 1: To run the One Sample t Test, click Analyze > Compare Means > One-Sample T Test.
ONE SAMPLE T TEST
◦ Step 2: In the Test Value field, enter 67.5, which is the X's estimation of the average height
of adults over 20.
ONE SAMPLE T TEST
◦ 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%)
◦ 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.
PAIRED SAMPLES T-TEST
Running the Test
Step 1: Go to Analyze>Compare Means>Paired-Samples T Test
PAIRED SAMPLES T-TEST
◦ Step 2: Drag the “Before” and “After” variable in the Pair 1 Variable 1 and Pair 1
Variable 2 boxes in the Paired Variables Box, respectively.
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.
PAIRED SAMPLES T-TEST
Step 4: Click Continue.
Step 5: Click OK.
PAIRED SAMPLES T-TEST
PAIRED SAMPLES T-TEST
Decision and Conclusion:
◦ Possible decisions
✓If the p-value is less than the alpha of 0.05, reject the null hypothesis.
✓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
◦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.
INDEPENDENT SAMPLES T-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
INDEPENDENT SAMPLES T-TEST
Common Uses
The Independent Samples t Test is commonly used to test the following:
➢Statistical differences between the means of two groups
➢Statistical differences between the means of two interventions
➢Statistical differences between the means of two change scores
Note: The Independent Samples t Test can only compare the means for two
(and only two) groups. It cannot make comparisons among more than two
groups. If you wish to compare the means across more than two groups, you will
likely want to run an ANOVA.
INDEPENDENT SAMPLES T-TEST
Data Requirements
Your data must meet the following requirements:
➢Dependent variable that is continuous (i.e., interval or ratio level)
➢Independent variable that is categorical (i.e., two or more groups)
➢Cases that have values on both the dependent and independent
variables
➢Independent samples/groups (i.e., independence of observations)
◦ There is no relationship between the subjects in each sample. This means that:
❖Subjects in the first group cannot also be in the second group
❖No subject in either group can influence subjects in the other group
◦ No group can influence the other group
INDEPENDENT SAMPLES T-TEST
◦ Violation of this assumption will yield an inaccurate p value
◦ Random sample of data from the population
◦ Normal distribution (approximately) of the dependent variable for each group
❖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
◦ Homogeneity of variances (i.e., variances approximately equal across groups)
❖When this assumption is violated and the sample sizes for each group differ, the p value is not trustworthy.
However, the Independent Samples t Test output also includes an approximate t statistic that is not based
on assuming equal population variances. This alternative statistic, called the Welch t Test statistic, may be
used when equal variances among populations cannot be assumed. The Welch t Test is also known an
Unequal Variance t Test or Separate Variances t Test.
◦ No outliers
Note: When one or more of the assumptions for the Independent Samples t Test are not met, you
may want to run the nonparametric Mann-Whitney U Test instead.
INDEPENDENT SAMPLES T-TEST
Researchers often follow several rules of thumb:
◦ Each group should have at least 6 subjects, ideally more.
Inferences for the population will be more tenuous with too
few subjects.
◦ A balanced design (i.e., same number of subjects in each
group) is ideal. Extremely unbalanced designs increase the
possibility that violating any of the requirements/assumptions
will threaten the validity of the Independent Samples t Test.
INDEPENDENT SAMPLES T-TEST
Hypotheses
◦ The null hypothesis (H0) and alternative hypothesis (H1) of the
Independent Samples t Test can be expressed in two different
but equivalent ways:
H0: µ1 = µ2 ("the two population means are equal")
H1: µ1 ≠ µ2 ("the two population means are not equal")
◦ where µ1 and µ2 are the population means for group 1 and
group 2, respectively.
INDEPENDENT SAMPLES T-TEST
Levene’s Test for Equality of Variances
✓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.
◦ The hypotheses for Levene’s test are:
➢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.
INDEPENDENT SAMPLES T-TEST
◦ 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
INDEPENDENT SAMPLES T-TEST
◦ Example 1 Independent Samples t-Test
◦ 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
INDEPENDENT SAMPLES T-TEST
Before the Test:
◦ 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 1: Encode the data in the input view as shown.
INDEPENDENT SAMPLES T-TEST
INDEPENDENT SAMPLES T-TEST
◦ Step 2: Go to Data>Split File
INDEPENDENT SAMPLES T-TEST
◦ Step 3: In the Split File Window, click “Organize output by groups” and transfer the
variable “Mental_State” into the “Groups based on” box.
INDEPENDENT SAMPLES T-TEST
◦ Step 4: Click OK
◦ Step 5: Perform Normality Test
INDEPENDENT SAMPLES T-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.
INDEPENDENT SAMPLES T-TEST
Running the 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 1: Go to Analyze>Compare Means>Independent Samples T Test
INDEPENDENT SAMPLES T-TEST
◦ 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.
INDEPENDENT SAMPLES T-TEST
◦ 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”.
◦ 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
◦ Sig. 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.)
INDEPENDENT SAMPLES T-TEST
◦ 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
◦ Std. Error Difference is the standard error; it also corresponds to the
denominator of the test statistic
INDEPENDENT SAMPLES T-TEST
◦ 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.
INDEPENDENT SAMPLES T-TEST
◦ 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.
INDEPENDENT SAMPLES T-TEST
Decision and Conclusion:
◦ 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 were
higher by 1.23 mg/dL than the average serum uric acid level of normal
individuals