Download Two Sample Inference for Means

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Bootstrapping (statistics) wikipedia , lookup

Psychometrics wikipedia , lookup

Omnibus test wikipedia , lookup

Taylor's law wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
Two Sample Inference for Means
Farrokh Alemi Ph.D
Kashif Haqqi M.D.
Go to index
Summary Slide
• Review
• F test
• Test of two means
– Small sample, equal variance
– Small sample, unequal variance
– Small dependent sample
Go to index
Review
• Frequency distributions and descriptive
statistics.
• Comparing an observation to a distribution.
• Comparing two distributions.
Go to index
Objectives
• To learn how to compare two distributions.
• No need to know the formulas, focus on
assumptions and interpretations.
• Be able to do the calculations using excel
functions.
Go to index
Which Test Is Right?
Normal population
Random Samples
Compare two
distributions
Known variance
Z test
Go to index
Compare observation
to a distribution
Variance estimated
from small sample
Variance estiamted
from large sample
Unequal variance
Independent samples
Equal variance
Independent samples
Repeated group
Dependent samples
Unequal variance t test
Equal variance t test
Paired t test
Z test
F Test
• Used to test if two population variances are equal.
• Assumes independent, random samples from
populations with normal distributions.
• Test is conducted by taking the ratio of the
variances (square of standard deviations). If the
two variances are equal the ratio will be one. The
larger value is always on top.
• Critical test values are determined using number
of observations minus one for each sample.
Go to index
Example
• Are nurses in
Private Government
government owned
Average
26000
25400
hospitals paid less than
Standard
privately owned
deviation
600
450
hospitals?
Number of
observations
10
8
Go to index
From Bluman A. Elementary statistics. McGraw Hill, 1998.
Solution
• Hypothesis: variances are equal.
• Alternative hypothesis: variance are
unequal.
• Critical value for two tailed F test at 9 and 7
degrees of freedom is 8.51.
• The F statistic is equal to 600*600/450*450
= 1.7.
• The null hypothesis is not rejected.
Go to index
Do this in Excel
Which Test Is Right?
Normal population
Random Samples
Compare two
distributions
Known variance
Z test
Go to index
Compare observation
to a distribution
Variance estimated
from small sample
Variance estiamted
from large sample
Unequal variance
Independent samples
Equal variance
Independent samples
Repeated group
Dependent samples
Unequal variance t test
Equal variance t test
Paired t test
Z test
Test of Two Means
Small Sample, Equal Variance
•
•
•
•
•
Go to index
Normal population.
Independent sample observations.
Random sample.
Unknown variance.
Two distributions have same variance, as
per F test.
Test of Two Means (Cont.)
Small Sample, Equal Variance
• Test value is always calculated as: (observed value
minus expected value) / standard deviation.
• In this case the observed value is the difference
between two means.
• The expected value is zero as the two means are
expected to be equal.
• What is the standard deviation of the difference?
Go to index
Standard Deviation of Difference
Equal Variance
• Sd = square root {[(n1 -1)s1*s1 + (n2 -1)s2*s2)] /
n1 +n2-2)]}*square root (1/ n1 +1/ n2).
• Sd is standard deviation of the difference of
means.
• n1 is sample size and s1 is standard deviation
in 1st distribution.
• n2 is sample size and s2 is standard deviation
in 2nd distribution.
Go to index
Test of Two Means (Cont.)
Small Sample, Equal Variance
• Decide if one tail or two tailed test.
• Critical values depend on sample sizes and
are calculated at n1 +n2-2 degrees of
freedom.
• The hypothesis is rejected if the test value is
larger than positive critical value or smaller
than negative critical value.
Go to index
Do this in Excel
Which Test Is Right?
Normal population
Random Samples
Compare two
distributions
Known variance
Z test
Go to index
Compare observation
to a distribution
Variance estimated
from small sample
Variance estiamted
from large sample
Unequal variance
Independent samples
Equal variance
Independent samples
Repeated group
Dependent samples
Unequal variance t test
Equal variance t test
Paired t test
Z test
Test of Two Means
Small Sample, Unequal Variance
•
•
•
•
•
Go to index
Normal population.
Independent sample observations.
Random sample.
Unknown variance.
Two distributions have different variance, as
per F test.
Test of Two Means (Cont.)
Small Sample, Unequal Variance
• Test value is always calculated as: (observed value
minus expected value) / standard deviation.
• In this case the observed value is the difference
between two means.
• The expected value is zero as the two means are
expected to be equal.
• What is the standard deviation of the difference?
Go to index
Standard Deviation of Difference
Unequal Variance
• Sd = square root (s1*s1/n1 + s2*s2/n2).
• Sd is standard deviation of the difference of
means.
• n1 is sample size and s1 is standard deviation
in 1st distribution.
• n2 is sample size and s2 is standard deviation
in 2nd distribution.
Go to index
Test of Two Means (Cont.)
Small Sample, Unequal Variance
• Decide if one tail or two tailed test.
• Critical values depend on the smaller
sample size minus one.
• The hypothesis is rejected if the test value is
larger than positive critical value or smaller
than negative critical value.
Go to index
Example
• Are nurses in
Private Government
government owned
Average
26000
25400
hospitals paid less than
Standard
privately owned
deviation
600
450
hospitals?
Number of
observations
10
8
Go to index
Do this in Excel
From Bluman A. Elementary statistics. McGraw Hill, 1998.
Solution
• Hypothesis: 1 2.
• Alternative hypothesis: 1  2.
• Critical value for =0.01, one tailed test, with
equal variances with 10+8-2 degrees of freedom is
2.583.
• Standard deviation of difference = 256.
• Test value = 5.47.
• Null hypothesis is rejected. Private hospitals do
not pay nurses less than or equal to government
hospitals.
Go to index
Which Test Is Right?
Normal population
Random Samples
Compare two
distributions
Known variance
Z test
Go to index
Compare observation
to a distribution
Variance estimated
from small sample
Variance estiamted
from large sample
Unequal variance
Independent samples
Equal variance
Independent samples
Repeated group
Dependent samples
Unequal variance t test
Equal variance t test
Paired t test
Z test
Test of Two Means
Small Dependent Sample
• Normal population.
• Dependent sample observations on same or
matched case, before and after.
• Random selection of cases.
• Unknown variance.
• By definition, distributions before and after
have same variance.
Go to index
Test of Two Means (Cont.)
Small Dependent Sample
• Test value is always calculated as: (observed value
minus expected value) / standard deviation.
• The observed value is the mean of paired
differences.
• The expected value is zero as the mean of the
paired differences is zero when the two means are
the same.
• What is the standard deviation of the difference?
Go to index
Standard Deviation of Difference
Small Dependent Sample
•
•
•
•
•
•
Go to index
Sd = square root [d2 – (d)2/n] /(n-1).
Sd = standard deviation of differences.
d = paired difference for one case.
n = number of paired differences.
SEd = standard error of differences.
SEd = Sd / n.
Test of Two Means (Cont.)
Small Dependent Sample
• Decide if one tail or two tailed test.
• Critical values depend on the sample size
minus one.
• The hypothesis is rejected if the test value is
larger than positive critical value or smaller
than negative critical value.
Go to index
Example
• Did clinician improve risk score for his
patient after switching their medication
(Higher scores are better scores)?
After, 2
Before, 1
Patient
Go to index
219
210
1
236
230
2
179
182
3
204
205
4
270
262
5
250
253
6
222
219
7
216
216
8
Solution
• Hypothesis: mean 1 -2 is greater than or
equal to zero.
• Alternative hypothesis mean of difference
is less than zero.
• Critical value for a one tailed t-distribution
at 8-1=7 degrees of freedom is –1.895.
Go to index
Solution: Compute Test Value
• Calculate sum of pair
wise difference
• Calculate sum of
squared pair wise
differences
Go to index
Patient Before
1
210
2
230
3
182
4
205
5
262
6
253
7
219
8
216
After Difference
219
-9
236
-6
179
3
204
1
270
-8
250
3
222
-3
216
0
Total
-19
Square of
difference
81
36
9
1
64
9
9
0
209
Solution: Computing Test Value
Continued
• Compute mean as (d)/n.
• Compute standard
deviation as Sd = square
root [d2 – (d)2/n] /(n-1).
• Compute standard error as
SEd = Sd / n.
• Computer test statistic as
mean (minus expected
mean of zero) divided by
standard error.
Go to index
Do this in Excel
Mean
Standard deviation
Standard error
Test statistic
-2.375
4.84
1.711198
-1.38792
•Hypothesis is not rejected.