Docsity

Two Sample Tests - Intermediate Statistical Methods - Lecture Notes | BIOS 662, Exams of Data Analysis & Statistical Methods

Partial preview of the text

Download Two Sample Tests - Intermediate Statistical Methods - Lecture Notes | BIOS 662 and more Exams Data Analysis & Statistical Methods in PDF only on Docsity!

Two Sample Tests Bios 662

Michael G. Hudgens, Ph.D. [email protected]

http://www.bios.unc.edu/∼mhudgens

2006-09-26 15:

Two Sample Test Settings

  • Single cross-sectional sample, comparing two sub-samples
  • Compare samples from two different populations (2 cross- sectional samples, case control study)
  • Single sample; subjects randomly allocated to different interventions (experiment, clinical trials)

Fundamentals

  • Result 5.2 If Y 1 and Y 2 are independent rvs that are normally distributed, then W = a 1 Y 1 + a 2 Y 2 is nor- mally distributed with mean and var given by Result
  • Corrollary: If Y¯ 1 and Y¯ 2 are based on two independent random samples of size n 1 and n 2 from two normal dis- tributions with means μ 1 and μ 2 and variances σ 12 and σ^22 , then

Y¯ 1 − Y¯ 2 ∼ N

μ 1 − μ 2 ,

σ 12 n 1 +^

σ^22 n 2

Fundamentals

  • Result 5.3 If Y¯ 1 and Y¯ 2 are based on two independent random samples of size n 1 and n 2 from two normal dis- tributions with means μ 1 and μ 2 and the same variances σ^21 = σ 22 = σ^2 , then ( Y¯ 1 − Y¯ 2 ) − (μ 1 − μ 2 ) sp

1 /n 1 + 1/n 2

∼ tn 1 +n 2 − 2

where s^2 p =

(n 1 − 1)s^21 + (n 2 − 1)s^22 n 1 + n 2 − 2

  • Note n 1 = n 2 implies

s^2 p =^12 (s^21 + s^22 )

Two Sample t-test Example

  • Let 1=drug, 2=placebo
  • H 0 : μ 1 = μ 2 vs HA : μ 1 > μ 2
  • Cα = {t : t > t 1 −α;28}
  • C. 05 = {t : t > 1. 7 }

Two Sample t-test Example

  • 6.9 6. Drug Placebo
  • 7.6 6.
  • 7.3 5.
  • 7.6 8.
  • 6.8 5.
  • 7.2 6.
  • 8.0 5.
  • 5.5 5.
  • 5.8 6.
  • 7.3 7.
  • 8.2 7.
  • 6.9 6.
  • 6.8 5.
  • 5.7 4.
  • 8.6 6.

Two Sample t-test: BW example

  • R

t.test(bw$drug,bw$placebo,var.equal=TRUE,alternative="greater")

Two Sample t-test

data: bw$drug and bw$placebo t = 2.4136, df = 28, p-value = 0. alternative hypothesis: true difference in means is greater than 0

Two Sample t-test: BW example

  • SAS proc ttest; class trt; var bw;

The TTEST Procedure T-Tests

Variable Method Variances DF t Value Pr > |t|

bw Pooled Equal 28 2.41 0. bw Satterthwaite Unequal 27.9 2.41 0.

F Distribution

0 1 2 3 4 5 6

0.^ 0.^ 0.^ 0.^

f

density

1,1 df

4,4 df

4,25 df

Homogeneity of Variance

  • Let

Xk =

(nk − 1)s^2 k σ^2 k

for k = 1, 2

  • It follows that

Y = X X^1 /(n^1 −^ 1) 2 /(n 2 −^ 1)^

∼ Fn 1 − 1 ,n 2 − 1

  • Thus

Y =

s^21 /σ 12 s^22 /σ 22

∼ Fn 1 − 1 ,n 2 − 1

Homogeneity of Variance

  • Note: Fv 1 ,v 2 ,α = 1/Fv 2 ,v 1 , 1 −α
  • Table A.5 and A.6 of text for two-sided α = .10 and α =. 02
  • R

qf(.975,14,14) [1] 2.

  • SAS

data; y = finv(.975,14,14);

Homogeneity of Variance: BW example

  • H 0 : σ 12 = σ^2 ; HA : σ 12 6 = σ 22
  • For α = .05,

C. 05 = {f : f < F 14 , 14 ,. 025 or f > F 14 , 14 ,. 975 }

= {f : f < 0 .34 or f > 2. 98 }

  • Observed test statistic

f =.^8994

2

. 96052

  • Therefore, do not reject H 0

p = 2 ∗ F 14 , 14 (.8768) = 0. 809

Homogeneity of Variance: BW example

  • R

var.test(bw$drug,bw$placebo)

F test to compare two variances

data: bw$drug and bw$placebo F = 0.8767, num df = 14, denom df = 14, p-value = 0. alternative hypothesis: true ratio of variances is not equal to 1

Homogeneity of Variance

  • Cf page 133 of text: restricted to genuine interest in whether vars equal
  • WRT testing H 0 : μ 1 = μ 2
    • For small samples, cannot detect relatively large dif- ferences
    • For large samples, CLT/Slutsky