Download 10-11 lecture

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
no text concepts found
Transcript
Two-sample t-tests
10/11
Independent-samples t-test
• Often interested in whether two groups have same mean
– Experimental vs. control conditions
– Comparing learning procedures, with vs. without drug, lesions, etc.
– Men vs. women, depressed vs. not
• Comparison of two separate populations
– Population A, sample A of size nA, mean MA estimates mA
– Population B, sample B of size nB, mean MB estimates mB
– mA = mB?
• Example: maze times
– Rats without hippocampus: Sample A = [37, 31, 27, 46, 33]
– With hippocampus: Sample B = [43, 26, 35, 31, 28]
– MA = 34.8, MB = 32.6
– Is difference reliable? mA > mB?
• Null hypothesis: mA = mB
– No assumptions of what each is (e.g., mA = 10, mB= 10)
• Alternative Hypothesis: mA ≠ mB
Finding a Test Statistic
• Goal: Define a test statistic for deciding mA = mB vs. mA ≠ mB
• Constraints (apply to all hypothesis testing):
– Must be function of data (both samples)
– Sampling distribution must be fully determined by H0
• Can only assume mA = mB
• Can’t depend on mA or mB separately, or on s
– Alternative hypothesis should predict extreme values
• Statistic should measure deviation from mA = mB
• so that if mA ≠ mB, we’ll be able to reject H0
• Answer (preview):
– Based on MA – MB (just like M – m0 for one-sample t-test)
MA  MB
"Standard Error"
– .

– (MA – MB) has Normal distribution
– Standard error has (modified) chi-square distribution
– Ratio has t distribution
Likelihood Function for MA – MB
• Central Limit Theorem
 
MA ~ Normal m,
s
nA
 
MB ~ Normal m,
s
nB
• Distribution of MA – MB
– Subtract themeans: E(MA – MB) = E(MA) – E(MB) = m – m = 0

– Add the variances:
SE  s
1
nA
2
nA
 sn B  s 2
2
 n1
B
– .M A  M B ~ Normal0, s
 
•

s
1
nA

1
nB

1
nA

1
nB




Just divide by standard error?

– . M A 1 M1B
s
nA

nB
~ Normal0,1
– Same problem as before: We don’t know s
– Need to estimate from data

Estimating s
• Already know best estimator for one sample
X  M 
s
2
n 1
• Could just use one sample or the other

– sA or sB
– Works, but not best use of the data
• Combining sA and sB
– Both come from averages of (X – M)2
– Average them all together:
• Degrees of freedom
– (nA – 1) + (nB – 1) = nA + nB – 2

 X  M    X  M 
2
A
A
2
B
nA  nB  2
B

Independent-Samples t Statistic
t
Difference between sample means
MA  MB
Standard Error

Typical difference expected by chance
Variance of MA – MB
Estimate of s2
Variance from MA


MS  n1  n1 
 A
B 
Standard Error 
Variance from MB

 A X  M A   B X  M B 
2
MS 
n A  nB  2
2
Sum of squared deviations
Degrees of freedom
Mean Square; estimates s2
Steps of Independent Samples t-test
1.
2.
State clearly the two hypotheses
Determine null and alternative hypotheses
• H0: mA = mB
• H1: mA ≠ mB
3.
Compute the test statistic t from the data
•
t .
M A  MB


MS n1  n1 
 A
B 
• Difference between sample means, divided by standard error
4.

5.
6.
7a.
7b.
Determine likelihood function for test statistic according to H0
• t distribution with nA + nB – 2 degrees of freedom
Choose alpha level
Find critical value
t beyond tcrit: Reject null hypothesis, mA ≠ mB
t within tcrit: Retain null hypothesis, mA = mB
Example
–
–
–
–
Rats without hippocampus: Sample A = [37, 31, 27, 46, 33]
With hippocampus: Sample B = [43, 26, 35, 31, 28]
MA = 34.8, MB = 32.6, MA – MB = 2.2
df = nA + nB – 2 = 5 + 5 – 2 = 8
 A X  M A   B X  M B 
2
MS 
2
df
208.8 181.2

 48.75
8


s (M A M B )  MS   1 
n A
 48.75 
t

1
nB



   4.42
1
5
1
5
M A  MB
2.2

 .498
s (M A M B ) 4.42
X
XMA
(X-MA)2
37
2.2
4.84
31
-3.8
14.44
27
-7.8
60.84
46
11.2
125.44
33
-1.8
3.24
SA(X-MA)2
= 208.80
t8
X
X-MB
(X-MB)2
43
10.4
108.16
26
-6.6
43.56
35
2.4
5.76
31
-1.6
2.56
28
-4.6
21.16
SB(X-MB)2 = 181.20
tcrit = 1.86
Mean Squares
• Average of squared deviations
• Used for estimating variance
 X  m
2
MS 
Population

Sample
N
 X  M 
2
MS 

Sample variance, s2
Estimates s2
n 1

 X  M A   B X  M B 
MS  A
n A  nB  2
2
Two samples
Population variance, s2
2
Also estimates s2
Degrees of Freedom
•
Applies to any sum-of-squares type formula
A X A  M A   B X B  M B 
X  M 
2
2
•

•
2

X  Xˆ
Tells how many numbers are really being added
– n = 2: only one number


– In general: one number determined by the rest
X
3
7

2
X–M
-2
2
Every statistic in formula that’s based on X removes 1 df
– M, MA, MB
– Algebraically rewriting formula in terms of only X results in fewer summands
•
I will always tell you the rule for df for each formula
•
To get Mean Square, divide by df
 X  M 
s2 
•

 A X A  M A   B X B  M B 
2
2
MS 
n 1
2
n A  nB  2
Distribution of a statistic depends on its degrees of freedom
– c2, t, F

(X – M)2
4
4
Independent vs. Paired Samples
• Independent-samples t-test assumes no relation
between Sample A and Sample B
– Unrelated subjects, randomly assigned
– Necessary for standard error of (MA – MB) to be correct
• Sometimes samples are paired
– Each score in Sample A goes with a score in Sample B
– Before vs. after, husband vs. wife, matched controls
– Paired-samples t-test
Paired-samples t-test
• Data are pairs of scores, (XA, XB)
– Form two samples, XA and XB
– Samples are not independent
• Same null hypothesis as with independent samples
– mA = mB
– Equivalent to mean(XA – XB) = 0
• Approach
– Compute difference scores, Xdiff = XA – XB
– One-sample t-test on difference scores, with m0 = 0
Example
• Breath holding underwater vs. on land
– 8 subjects
– Water:
XA = [54, 98, 67, 143, 82, 91, 129, 112]
– Land:
XB = [52, 94, 69, 139, 79, 86, 130, 110]
• Difference:
Xdiff = [2, 4, -2, 4, 3, 5, -1, 2]
å Xdiff = 17 = 2.13
Mean: M diff =
n
Standard Error:
s M diff =
8
sdiff
6.13
=
= .88
n
8
• Critical value
> qt(.025,7,lower.tail=FALSE)
[1] 2.364624
•
Reliably longer underwater
Mean Square:
2
sdiff
Test Statistic:
t=
=
å( Xdiff - M diff )
2
n -1
M diff 2.13
=
= 2.43
s M diff .88
= 6.13
Comparison of t-tests
Samples
One
2-Indep.
2-Paired
Data
t
Standard Error
X
M -m 0
sM
s
1
= MS
n
n
XA, XB
Xdiff = XA - XB
MA - MB
s M A -M B
M diff
s M diff
MS
(
1
nA
+ n1B
Mean Square
s =
2
)
å( X - M )
df
2
n-1
df
å( X A - M A )
2
+å ( X B - M B )
2
nA + nB – 2
df
sdiff
1
= MS
n
n
2
sdiff
=
å ( Xdiff - M diff )
df
2
n-1
Related documents