STAT 211 Topic 8

From Notes
Jump to navigation Jump to search
Lecture 16 Notes

« previous | Tuesday, April 5, 2011 | next »


Comparing 2 Samples

In topic 7, we did confidence intervals and hypothesis tests for a single sample with the population. Now we're comparing 2 samples with each other.

  • Two samples (X1..m and Y1..n) must be independent and from separate populations


Look at difference in averages X¯−Y¯ for estimate of difference of means μX−μY and compare these with the proposed difference Δ0:

E(X¯−Y¯)=E(X¯)+E(Y¯)=μX−μYV(X¯−Y¯)=V(X¯)+V(Y¯)=σX2m+σY2n

Cases 1&2: Normal Population or Large Sample

When the sample sizes are large, the distribution of X¯−Y¯ is also Normal.

Use the same methods as in STAT 211 Topic 7, substituting μ=μX−μY, μ0=Δ0 and σ2=σX2m+σY2n.

X¯−Y¯∼Normal(μX−μY, σX2m+σY2n)z=X¯−Y¯−Δ0σX2m+σY2n


Example

A realtor from the northeast claims that houses are more valuable (higher sales price) than anywhere else in the US.

  • μ1: average sales price in Northeast
  • μ2: average sales price anywhere but Northeast
  • H0:μ1−μ2=0
  • Ha:μ1−μ2>0
  • z=X¯−Y¯−0sX2/m+sY2/n


Case 3: Small Sample from Normal Population

We do different things depending on the two population variances (not necessarily known):

{σX2=σY2pooledt−testσX2≠σY2unpooledt−test

If smaller σ is greater than half of the bigger σ, then we say that they are the same:

σ1>σ22

Pooled Sample Variance

sp2=(m−1)sX2+(n−1)sY2n+m−2

Use t-test as normal with df ν=n+m−2

t=X¯−Y¯−Δ0sp1m+1n

Unpooled Sample Variance

t-test would be normal as expected, but degrees of freedom is more complicated (this is why the pooled test is more common):

t=X¯−Y¯−Δ0sp1m+1nν=(sX2m+sY2n)2(sX2/m)2m−1+(sY2/n)n−1


Paired Data

When two samples are related to each other by a third variable (e.g. mother of two children, student who takes two exams, etc.)

Use paired t-test:

  1. calculate differences between samples: Di=Xi−Yi
  2. calculate average and standard deviation of the differences
  3. use regular t-test on t=D¯−Δ0sD/n


Confidence Interval

D¯±tα/2, n−1sDn


Comparing Two Population Proportions

Lecture 17 Notes

Given two sample proportions p^X and p^Y from two different populations

We are interested in the difference between the two proportions (Normal distribution). Therefore, we can standardize and perform a z-test with the following parameters:

  • H0: pX−pY=Δ0
  • Ha: {pX≠pYpX>pYpX<pY
  • Test Statistic: z=p^X−p^Y−Δ0p^(1−p^)(1m+1n)

The only problem is that we don't know pX and pY so we estimate it with the second equation.

p^=mm+np^1+nm+np^2


Review

(See STAT 211 Topic 3→)

In general, the exact distribution of our sample proportions are Binomial:

p^1=∑i=1mXimp^2=∑i=1nYin ∑i=1mXi∼Bin(m,p1)∑i=1nYi∼Bin(m,p2)
E(∑i=1mXi)=mp1E(∑i=1nYi)=mp2 V(∑i=1mXi)=mp1(1−p1)V(∑i=1nYi)=mp2(1−p2)

p^1−p^2∼Normal(p1−p2, p1(1−p1)m+p2(1−p2)n)


Comparing Two Variances

Instead of using χ2 distribution, we use F distribution (F-test).

If we have two samples X1,…,Xm and Y1,…,Yn

  • H0: σX2=σY2
  • Test statistic: F=sX2sY2

Rejection Range:

Ha Reject H0 if
σX2>σY2 F>Fa, m−1, n−1
σX2<σY2 F<Fa, m−1, n−1
σX2≠σY2 F>Fa/2, m−1, n−1 or F<F1−a/2, m−1, n−1


Confidence Interval

(sX2/sY2Fa/2, m−1, n−1, sX2/sY2F1−a/2, m−1, n−1)