24
Classroom Simulation: Are Variance- Stabilizing Transformations Really Useful?

Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Embed Size (px)

Citation preview

Page 1: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Classroom Simulation: Are

Variance-StabilizingTransformations Really Useful?

Page 2: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Bruce E. Trumbo *

Eric A. SuessRebecca E. Brafman

Department of StatisticsCalifornia State University, Hayward

† Presentation, JSM 2004, Toronto

* [email protected]

Page 3: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Introduction to One-way ANOVA

In a one-way ANOVA, we test the null

hypothesis that all group means i are equal

against the alternative hypotheses that all group

means are not equal.

ANOVA TableSource DF SS MS F-Ratio .

Factor I – 1 SS(Fact) MS(Fact)

MS(Fact)/MS(Err)

Error IJ – I SS(Err) MS(Err) .

Total IJ – 1

Page 4: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Model and Assumptions

We use the model: Xij i.i.d. NORM(i, 2),

for i = 1, …, I and j = 1, …, J.

Assumptions:

– normal data

– independent groups

– independent observations within groups

– equal variances

Page 5: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

When Data Are Not Normal…

• If H0 True: Distributional difficulties arise

– MS(Factor) and MS(Error) not chi-squared

– MS(Factor) and MS(Error) not independent

– F-ratio not distributed as F

• If H0 False:

– Different means may imply

– Different variances

Page 6: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Commonly Recommended Method For Transformating Data to

Stabilize Variances

Based on two-term Taylor-series approximations.

Given relationship between mean and variance:

2 = ().

The following transformation makes variances

approximately equal — even if means differ:

Y = f(X), where f’() = [()]–1/2

Page 7: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Some Types of Nonnormal Data and Their Variance-Stabilizing Transformations

Type of Distribution

Relationship of

Mean & Variance

Type of

Transformation

Poisson Variance = Mean Square Root

Binomial

Proportions

Mean = p

Variance = p(1–p)/n

Arcsine of

Square Root

Exponential SD = Mean Log and

Rank

Page 8: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Square Root Transformations (Right) of Three Poisson Samples Have Similar

Variances

0 10 20 30 40

05

01

50

Mean = 3.02 Var = 2.98

Sample 1 from POIS(3)

0 2 4 6 8

01

00

30

0

Mean = 1.81 Var = 0.227

Log Transform of Sample 1

0 10 20 30 40

05

01

50

25

0

Mean = 9.86 Var = 9.5

Sample 2 from POIS(10)

0 2 4 6 8

01

00

30

0

Mean = 3.18 Var = 0.242

Log Transform of Sample 2

0 10 20 30 40

05

01

00

Mean = 20.1 Var = 20.3

Sample 3 from POIS(20)

0 2 4 6 8

01

00

30

0Mean = 4.51 Var = 0.248

Log Transform of Sample 3

Page 9: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Arcsine of Square Root Transformations (Right) of Three Binomial Samples Have Similar Variances

0.0 0.2 0.4 0.6 0.8 1.0

02

00

60

0

Mean = 0.0485 Var = 0.00238

Sample 1 from BINOM(20,.05)

0.0 0.5 1.0 1.5

01

00

30

0

Mean = 0.214 Var = 0.00904

Log Transform of Sample 1

0.0 0.2 0.4 0.6 0.8 1.0

05

01

50

Mean = 0.147 Var = 0.00643

Sample 2 from BINOM(20,.15)

0.0 0.5 1.0 1.50

10

03

00

Mean = 0.379 Var = 0.0142

Log Transform of Sample 2

0.0 0.2 0.4 0.6 0.8 1.0

01

00

30

0

Mean = 0.358 Var = 0.0112

Sample 3 from BINOM(20,.35)

0.0 0.5 1.0 1.5

01

00

30

0

Mean = 0.638 Var = 0.013

Log Transform of Sample 3

Page 10: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Log Transformations (Right) of Three Exponential Samples Have Similar Variances

0 10 20 30 40 50

01

00

20

03

00

40

0Mean = 0.951 Var = 0.971

Sample 1 from EXP(1)

-6 -4 -2 0 2 4 6

01

00

20

03

00

Mean = -0.648 Var = 1.66

Log Transform of Sample 1

0 10 20 30 40 50

02

00

40

06

00

Mean = 4.85 Var = 24.5

Sample 2 from EXP(5)

-6 -4 -2 0 2 4 6

01

00

20

03

00

Mean = 1 Var = 1.65

Log Transform of Sample 2

0 10 20 30 40 50

02

00

40

06

00

Mean = 9.83 Var = 104

Sample 3 from EXP(10)

-6 -4 -2 0 2 4 6

01

00

20

03

00

Mean = 1.66 Var = 1.81

Log Transform of Sample 3

Page 11: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Additional Transformations

We also consider rank transformations for

exponential data.

Possible future work (no results given here): Box-Cox Transformation of the type Y = Xa,

where a is based on the data. Examples:

• Square root if a = 1/2• Reciprocal if a = –1• Interpreted as log transformation if a = 0

Page 12: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Simulation Study

1. Simulations are based on data with knowndistributions: Poisson, binomial, or exponential.

2. Use R, S-Plus, and Minitab. (SAS can also be used but is very time consuming.)

3. In each simulation we generate 20,000 datasets from the nonnormal distribution under study.

4. Each dataset consists of I = 3 groups, usually with J = 5 or 10 observations per group.

5. For each distribution: Datasets under H0,

and for a variety of cases with Ha.

Page 13: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Comparisons to JudgeUsefulness of Transformations

All tests have nominal size = 5%.

P{Rej} is estimated as the proportion of 20,000

simulated datasets in which H0 is rejected.

With and without transformation:

When is H0 is true, does P{Rej} = 5% ?

For various alternatives: When is P{Rej} larger, with or withouttransformation?

Page 14: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

R / S-Plus Code for Exponential Simulationr <- 5; m <- 20000 # r = no. of obs./group, m = no.of datasets mu1 <- 10; mu2 <- 10; mu3 <- 10 # set means of ea. group mu <- c(rep(mu1,r), rep(mu2,r), rep(mu3,r)) # combine means x <- rexp(3*r*m, rate=1/mu) # form vector of random exponential data DTA <- matrix(x, m, byrow=T) # transform vector into matrix of m datasets #DTA <- log(DTA) # Activate line above for log transf. #DTA <- t(apply(DTA, 1, rank)) # Activate line above for rank transf. m1 <- rowMeans(DTA[,1:r]) m2 <- rowMeans(DTA[,(r+1):(2*r)]) m3 <- rowMeans(DTA[,(2*r+1):(3*r)]) v1 <- rowSums((DTA[,1:r] - m1)^2)/(r-1) v2 <- rowSums((DTA[,(r+1):(2*r)] - m2)^2)/(r-1) v3 <- rowSums((DTA[,(2*r+1):(3*r)] - m3)^2)/(r-1) g <- (m1 + m2 + m3)/3 #calculates group means,group variances,& row mean MSF <- r * rowSums((cbind(m1,m2,m3) - g)^2)/2 # calculates MSF MSE <- rowMeans(cbind(v1, v2, v3)) # calculates MSE F.rat <- MSF/MSE # calculates F-ratio rej <- (F.rat > qf(.95, 2, 3*(r-1))) # vector of T/F for reject/don’t reject mean(rej) # rejection probability or proportion of T in rej vector.

Page 15: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Summary of Findings

Within the limited scope of our study…

For Poisson data, the square root transformation seems ineffective.

For binomial data, the “arcsine” transformation seems ineffective.

For exponential data, both the log and the rank transformations seem to be useful in some cases—particularly for small samples.

Page 16: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Some Specific Results: P{Rej} for Poisson Data

Three groups, each with 5 observations

Pattern of Group Means

NotTransformed Transformed

Transf. Useful?

10, 10, 10 ~ 0.05 ~ 0.05 NO

10, 15, 20 ~ 0.91 ~ 0.91 NO

Page 17: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Some Specific Results: P{Rej} for Binomial ProportionsThree groups, each with 5 observations

Pattern of p = P(Success) in each group

Not

TransformedTransformed Transf.

Useful?

0.2, 0.2, 0.2 ~ 0.05 ~ 0.05 NO

0.1, 0.25, 0.4 ~ 0.82 ~ 0.82 NO

Page 18: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

For Exponential Data Log and Rank Transformations Sometimes Useful

Power = P{Rej|Ha} “often” larger for transformed data

(one borderline exceptional case shown) Transformation

Group Means None Log Rankr = 5

10, 10, 101, 2, 4

1, 5, 101, 10 ,101, 10, 100

0.0400.24 0.39 0.34 0.76

0.0460.28 0.65 0.76 0.986

0.0560.31 0.68 0.78 0.985

r = 1010, 10, 10

1, 2, 41, 5 ,10

1, 10, 10

0.0430.59 0.87 0.86

0.0470.54 0.94 0.976

0.0520.60 0.9760.991

Page 19: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Exponential: Power Against Ha: 1, 10, 100For Various Numbers of Replications

Log and rank transformations work well when r is small and population means are widely separated.

O = Original* = Log Transf+ = Rank Transf.

Page 20: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Exponential: Power Against Ha: 1, 2, 4For Various Numbers r of Replications

When means are not so widely separated, log and rank transformations do some harm unless r is small .

O = Original* = Log Transf+ = Rank Transf.

Page 21: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Exponential: Power for Various AlternativesWhen M = 1, H0 is true; when M = 2, the group means are

1, 2, 4; when M = 4, the group means are 1, 4 , 16; etc. For r = 5 and M > 2 transformations are useful.

Solid = OriginalDotted = Log TransfDashed = Rank Transf.

Page 22: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

Exponential: Power for Various AlternativesWhen M = 1, H0 is true; when M = 2, the group means are 1, 2, 4; when M = 4, the group means a are 1, 4 , 16; etc.

For r = 20, transformations may be harmful.

Solid = OriginalDotted = Log Transf

Dashed = Rank Transf.

Page 23: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

References / AcknowledgmentsREFERENCES ON VARIANCE STABILIZING TRANSFORMATIONS

G. Oehlert: A First Course in Design and Analysis of Experiments, Freeman (2000), Chapter 6.

D. Montgomery: Design and Analysis of Experiments, 5th ed., Wiley (2001), Chapter 3.

K. Brownlee: Statistical Theory and Methodology in Science and Engineering, 2nd ed., Wiley (1965). Chapter 3.

H. Scheffé: The Analysis of Variance, Wiley 1959, Chapter 10.

G. Snedecor and W. Cochran: Statistical Methods, 7th ed. Iowa State Univ. Press (1980), Chapter 15.

WEB PAGES including computer code and results for this paper:

www.sci.csuhayward.edu/~btrumbo/JSM2004/simtrans/.

THANKS TO Jaimyoung Kwan (UC Berkeley/CSU Hayward)

for suggestions, especially concerning the inclusion of power curves.

Rebecca Brafman’s graduate study supported by NSF Graduate Research Fellowship.

Page 24: Classroom Simulation: Are Variance-Stabilizing Transformations Really Useful?

About the Authors• Rebecca E. Brafman, presenting this poster at JSM

2004 in Toronto, has recently completed her M.S. in Statistics from CSU Hayward.

• Eric A. Suess received his Ph.D. in Statistics from U.C. Davis and is Associate Professor of Statistics at CSU Hayward. His interests include statistical computation, time series and Bayesian [email protected]

• Bruce E. Trumbo is a fellow of ASA and IMS and has been a professor in the Statistics Department at CSU State University, Hayward for over 30 [email protected]