You are on page 1of 38

Lecture 06

Course Instructor
Ms. Sidra Zaheer
Lecturer
School of Public Health,
DUHS

Introduction to Biostatistics

12/29/2014 1
Lecture 06

t – Test
Inference Regarding Sample Means

12/29/2014 2
Previous class
 Hypothesis testing with single mean

 Null and Alternative hypotheses


 Level of significance
 Test statistic
 p-value ( critical region)
 Computation/analysis (SPSS)
 Conclusion

12/29/2014 3
What are we doing today?
 Two-sample t-test
 Paired t-test
 Independent samples
 Equal variance
 Unequal variance

 Confidence intervals
 Comparison of CI to hypothesis test

12/29/2014 4
Learning Objectives
 Understand the procedure of hypothesis testing and
assumptions for two population means.

 Understand the concept of dependent/paired samples.

 Comparison of dependent/paired sample means using t-


test.

 Understand the assumptions of independent samples


mean test.

12/29/2014 5
What kind of t is it?
 Single sample t – we have only 1 group; want to test
against a hypothetical mean.

 Paired/Repeated measures (Dependent t) – we have


two means. Either same people in both groups, or
people are related, e.g., husband-wife, left hand-right
hand, hospital patient and visitor.

 Independent samples t – we have 2 means, 2 groups;


no relation between groups, e.g., people randomly
assigned to a single group.
12/29/2014 6
t – Test
One Sample Mean Test
When to use…

 To compare mean of a single sample mean to a


population mean or a hypothetical mean.

 Population standard deviation is unknown.

 Sample size is < 30*.

 Underlying variable is normally distributed.

12/29/2014 7
Example: t -test
 An investigator conducted an experiment to see if a
given therapy works to reduce test anxiety in a sample
of college students. A standard measure of test anxiety
is known to produce a µ = 20. In the sample drawn of
25 the mean = 18 with s = 9.

 Use a significance level of 5%. Test average test anxiety


score in the college students who received therapy is
lower than 20.

H0 ? and Ha ?
12/29/2014 8
Two Samples t-Test
i- Paired samples t-test
 The paired samples test is a kind of research called repeated
measures test (aka, within-subjects design), commonly used
in before-after-designs.

 We often want to know whether the means of same population


on some quantitative outcome is differ or not at different time or
in different circumstances (before-after method, matched
subjects method, repeated measures method).

 The paired t-test provides a hypothesis test of the difference


between population means for a pair of random samples whose
differences are approximately normally distributed.

12/29/2014 9
Paired Sample t Test
Single-Sample Paired-Sample
 Single observation from each  Two observations from each
participant participant
 The second observation is
 The observation is dependent upon the first
independent from that of since they come from the
the other participants same person.
 Comparing a mean of
 Comparing a mean score to a
difference scores to a
distribution of mean scores . distribution of means of
difference scores

12/29/2014 10
Hypothesis Testing with two samples t-test
 State the hypotheses

 Upper-tailed Test
Ho: (µ1 - µ2) ≤ 0
Ha: (µ1 - µ2) > 0 Rejection
region

 Lower-tailed Test:
Ho: (µ1 - µ2) ≥ 0 Rejection
region
Ha: (µ1 - µ2) < 0

 Two-tailed Test:
Ho: (µ1 - µ2) = 0 Rejection
Rejection
region
region
Ha: (µ1 - µ2) ≠ 0

12/29/2014 11
Scenario
 A tumor size study: Having an accurate measure of tumor
size is extremely important because it allows a physician to
accurately determine if a tumor is growing, shrinking or
remaining constant.

 The problem is that often the measurements of the tumor


size vary from physician to physician.

 In the past, tumor size was measured using the linear


distance across the tumor, but this was found to be very
variable because of the irregular shape of some tumors. A
new method called the RECIST criteria traces the outside
of the tumor. The RECIST method was believed to give
more consistent measures of the volume of the tumor.

12/29/2014 12
Available data
 For a portion of the study, a pair of doctors were
shown the same set of tumor pictures. The volume
of the tumor was measured by two separate
physicians under similar conditions.

 Question of interest: Did the measurements


from the two physicians significantly differ?

 If not, then there would be no evidence that the


volume measurements change based on physician.
12/29/2014 13
Analysis

 20 scans were measured Tumor Dr. 1 Dr. 2


by each physician (10 are
shown here) 1 15.8 17.2
2 22.3 20.3
 Measurements in cm3 3 14.5 14.2
 What can you say about 4 15.7 18.5
these samples?
 Two measurement on the
5 26.8 28.0
same person 6 24.0 24.8
 They are related so we
must account for this 7 21.8 20.3
 Much research in statistics 8 23.0 25.4
deals with how to handle
correlated data, but in this 9 29.3 27.5
case it is pretty easy 10 20.5 19.7
12/29/2014 14
Dependent sample
Tumo Dr. 1 Dr. 2 Difference
r
 We can measure the effect of
1 15.8 17.2 -1.4
the treatment in each person
by taking the difference 2 22.3 20.3 2.0
3 14.5 14.2 0.3
d i  x1i  x2i 4 15.7 18.5 -2.8
5 26.8 28.0 -1.2
 Instead of having two
samples, we can consider our 6 24.0 24.8 -0.8
dataset to be one sample of 7 21.8 20.3 1.5
differences 8 23.0 25.4 -2.4
 Just like the one sample
problem 9 29.3 27.5 1.8
12/29/2014
10 20.5 19.7 0.8 15
Paired t-test
1) Null hypothesis: No difference between physicians effect

H 0 :  dr1   dr 2   dr1   dr 2  0

H A :  dr1   dr 2   dr1   dr 2  0
2) Alpha=0.05

3) Test statistic: paired sample t-statistic

4) Reject H0 if p-value < 0.05, (p-value=0.69)

5) SPSS Analysis, Fail to reject null hypothesis

6) Conclusion: there is no evidence of a difference in tumor


volume measurement based on physician
12/29/2014 16
Normality
 We can see that the assumption of normality of
the differences is reasonable in this case
Histogram of diff
5
4
3
Frequency

2
1
0

-4 -3 -2 -1 0 1 2 3

diff
12/29/2014 17
Paired t-test in SPSS
 Import Data1.sav

12/29/2014 18
Paired t-test in SPSS
Analyze –> Compare means –> Paired samples t test

12/29/2014 19
Paired t-test in SPSS

12/29/2014 20
Paired t-test in SPSS

To interchange
the means
position

12/29/2014 21
SPSS Output

Conclusion: p-value (0.69) > α (0.05)


There is no evidence of a difference in tumor volume
measurement based on physician
12/29/2014 22
Confidence Interval
 Confidence interval for paired t-test constructed in the
same way as one-sample t-test
 sd sd 
 d  t1 a / 2 , d  t1 a / 2 
 n n

 For our example, the 95% confidence interval is (-1.46 , 1.02)


 Note that the conclusion from the hypothesis test and the
confidence interval are the same
12/29/2014 23
ii- Independent t-Test:

The independent-samples t-test (or independent t-test)


compares the means between two unrelated groups on the
same continuous, dependent variable.
Ex. Comparison of cholesterol in males and females

Thus, an independent-measures design can be used to test


for mean differences between two distinct populations (such
as men versus women) or between two different treatment
conditions (such as drug versus no-drug).

12/29/2014 24
Independent t-Test
 For example, an independent t-test is used to understand
whether first year graduate salaries differed based on
gender (i.e., your dependent variable would be "first year
graduate salaries" and your independent variable would be
"gender", which has two groups: "male" and "female").

 Alternately, an independent t-test can use to understand


whether there is a difference in text anxiety based on
educational level (i.e., your dependent variable would be
"test anxiety" and your independent variable would be
"educational level", which has two groups:
"undergraduates" and "postgraduates").

12/29/2014 25
Assumptions

Independent t-Test:
It is only appropriate to use an independent t-test if your data
"passes" six assumptions that are required for an independent t-test
to give you a valid result

Assumption #1:
Dependent variable should be measured at the interval or ratio
level (i.e., they are continuous).
Examples: Revision time (measured in hours), intelligence
(measured using IQ score), exam performance (measured from 0
to 100), weight (measured in kg), and so forth

12/29/2014 26
Assumptions cont…
Assumption #2:
Independent variable should consist of two
categorical, independent groups.
Example independent variables that meet this criterion
include gender (2 groups: male or female), employment
status (2 groups: employed or unemployed), smoker (2
groups: yes or no), and so forth.

Assumption #3:
You should have independence of observations, which
means that there is no relationship between the observations
in each group or between the groups themselves.

12/29/2014 27
Assumptions cont…
Assumption #4:
There should be no significant outliers. Outliers are simply
single data points within your data that do not follow the usual
pattern
Assumption #5:
Dependent variable should be approximately normally
distributed for each category of the independent variable.
You can test for normality using the Kalmogorov/Shapiro-Wilk test
of normality, which is easily tested for using SPSS.
Assumption #6:
There needs to be homogeneity of variances. You can test this
assumption in SPSS using Levene’s test for homogeneity of
variances.

12/29/2014 28
Independent t Test
Paired-Sample Independent t Test
 Two observations from each  Single observation from each
participant participant from two
independent groups
 The second observation is  The observation from the
dependent upon the first second group is independent
since they come from the from the first since they come
same person. from different subjects.
 Comparing the difference
 Comparing a mean
between two means to a
difference to a distribution distribution of differences
of mean difference scores between mean scores .

12/29/2014 29
Scenario
 Another aspect of the tumor volume study was trying
to compare the tumor volume among patients with
different forms of cancer. The average tumor size is
important to know the effect of treatment can be
determined.

 In this study, patients with brain, breast and liver


tumors, but initially we will only compare the brain
and breast cancers.
 All of the tumors were measured using the RECIST
method
12/29/2014 30
Data
Brain Breast
Information
n 20 24
 For the tumor volume xbar 15.2 cm3 16.9 cm3
study, there were 20 brain s 2.42 2.83
cancer subjects and 24
breast cancer subjects
 The summary statistics
and histogram for the data
are given here
 What can you say about
the distributions?
 Does the equal variance
assumption seem valid in
this case?

12/29/2014 31
Hypothesis
1)
test
The null hypothesis is that there is no difference between the volume
of the tumor in the two forms of cancer
brain  breast  0
H0: mean brain tumor size = mean breast tumor size
Ha: mean brain tumor size ≠ mean breast tumor size brain  breast  0

2) Two independent samples with equal variance; alpha =


0.05

3) Test statistic: independent sample t test

4) Reject H0 if p-value < 0.05 (p-value: 0.043)

5) SPSS output, Reject null hypothesis

6) Conclusion: There is a significant difference in the size of


brain and breast cancer tumors
12/29/2014 32
Independent t-test with SPSS
Import Data2.sav

12/29/2014 33
Analyze  Compare means  Independent samples t-test

We have to make
grouping variable
first, according to
given
independent
groups

12/29/2014 34
Analyze  Compare means  Independent samples t-test

12/29/2014 35
1

2 5

12/29/2014 36
SPSS Output

Levene’s Test for Equality of Variance:

Since from Leaven’s Test p‐value is greater than α = 0.05 than we


conclude that population variances are equal and use 1st row t‐calc
& P‐value for testing two samples mean and vice versa
12/29/2014 37
SPSS Output

Conclusion:
• Since from t-test, p‐value (0.043) is less than α = 0.05
than we conclude that there is a significant difference
in the size of brain and breast cancer tumors.
• 95% Confidence Intervals (-3.30, -0.05)
12/29/2014 38

You might also like