Unit 7 Introduction to Analysis of Variance

Similar documents
Unit 7 Introduction to Analysis of Variance

ST 524 NCSU - Fall 2008 One way Analysis of variance Variances not homogeneous

Chapter 6 Student Lecture Notes 6-1

Analyzing Frequencies

Logistic Regression I. HRP 261 2/10/ am

Review - Probabilistic Classification

EEC 686/785 Modeling & Performance Evaluation of Computer Systems. Lecture 12

A Note on Estimability in Linear Models

Soft k-means Clustering. Comp 135 Machine Learning Computer Science Tufts University. Mixture Models. Mixture of Normals in 1D

COMPLEX NUMBER PAIRWISE COMPARISON AND COMPLEX NUMBER AHP

te Finance (4th Edition), July 2017.

10/7/14. Mixture Models. Comp 135 Introduction to Machine Learning and Data Mining. Maximum likelihood estimation. Mixture of Normals in 1D

Econ107 Applied Econometrics Topic 10: Dummy Dependent Variable (Studenmund, Chapter 13)

Today s logistic regression topics. Lecture 15: Effect modification, and confounding in logistic regression. Variables. Example

The Hyperelastic material is examined in this section.

Outlier-tolerant parameter estimation

Lecture 14. Relic neutrinos Temperature at neutrino decoupling and today Effective degeneracy factor Neutrino mass limits Saha equation

Lecture 3: Phasor notation, Transfer Functions. Context

Lucas Test is based on Euler s theorem which states that if n is any integer and a is coprime to n, then a φ(n) 1modn.

Grand Canonical Ensemble

8-node quadrilateral element. Numerical integration

Fakultät III Univ.-Prof. Dr. Jan Franke-Viebach

Naresuan University Journal: Science and Technology 2018; (26)1

Observer Bias and Reliability By Xunchi Pu

A primary objective of a phase II trial is to screen for antitumor activity; agents which are found to have substantial antitumor activity and an

2. Grundlegende Verfahren zur Übertragung digitaler Signale (Zusammenfassung) Informationstechnik Universität Ulm

ACOUSTIC WAVE EQUATION. Contents INTRODUCTION BULK MODULUS AND LAMÉ S PARAMETERS

Unit 7 Introduction to Analysis of Variance Always graph results of an analysis of variance - Gerald van Belle.

SCITECH Volume 5, Issue 1 RESEARCH ORGANISATION November 17, 2015

BLOCKS REPLICATION EXPERIMENTAL UNITS RANDOM VERSUS FIXED EFFECTS

CHAPTER 33: PARTICLE PHYSICS

Introduction to logistic regression

Fakultät III Wirtschaftswissenschaften Univ.-Prof. Dr. Jan Franke-Viebach

A Probabilistic Characterization of Simulation Model Uncertainties

Lecture Outline Biost 517 Applied Biostatistics I

Higher order derivatives

EXST Regression Techniques Page 1

??? Dynamic Causal Modelling for M/EEG. Electroencephalography (EEG) Dynamic Causal Modelling. M/EEG analysis at sensor level. time.

You already learned about dummies as independent variables. But. what do you do if the dependent variable is a dummy?

Heisenberg Model. Sayed Mohammad Mahdi Sadrnezhaad. Supervisor: Prof. Abdollah Langari

ph People Grade Level: basic Duration: minutes Setting: classroom or field site

CHAPTER 7d. DIFFERENTIATION AND INTEGRATION

An Overview of Markov Random Field and Application to Texture Segmentation

MCB137: Physical Biology of the Cell Spring 2017 Homework 6: Ligand binding and the MWC model of allostery (Due 3/23/17)

Economics 600: August, 2007 Dynamic Part: Problem Set 5. Problems on Differential Equations and Continuous Time Optimization

GPC From PeakSimple Data Acquisition

A NEW GENERALISATION OF SAM-SOLAI S MULTIVARIATE ADDITIVE GAMMA DISTRIBUTION*

UNIT 8 TWO-WAY ANOVA WITH m OBSERVATIONS PER CELL

An Appropriate F -Test for Two-Way Balanced Interactive Model

167 T componnt oftforc on atom B can b drvd as: F B =, E =,K (, ) (.2) wr w av usd 2 = ( ) =2 (.3) T scond drvatv: 2 E = K (, ) = K (1, ) + 3 (.4).2.2

Discrete Shells Simulation

Jones vector & matrices

Polytropic Process. A polytropic process is a quasiequilibrium process described by

First derivative analysis

Collisions between electrons and ions

x = , so that calculated

Lecture 23 APPLICATIONS OF FINITE ELEMENT METHOD TO SCALAR TRANSPORT PROBLEMS

A Propagating Wave Packet Group Velocity Dispersion

22/ Breakdown of the Born-Oppenheimer approximation. Selection rules for rotational-vibrational transitions. P, R branches.

Physics 256: Lecture 2. Physics

The Matrix Exponential

Relate p and T at equilibrium between two phases. An open system where a new phase may form or a new component can be added

Statistics for Economics & Business

The Matrix Exponential

are given in the table below. t (hours)

Applied Statistics II - Categorical Data Analysis Data analysis using Genstat - Exercise 2 Logistic regression

From Structural Analysis to FEM. Dhiman Basu

Application of Local Influence Diagnostics to the Linear Logistic Regression Models

Dealing with quantitative data and problem solving life is a story problem! Attacking Quantitative Problems

September 27, Introduction to Ordinary Differential Equations. ME 501A Seminar in Engineering Analysis Page 1. Outline

Solution of Assignment #2

Α complete processing methodology for 3D monitoring using GNSS receivers

On Selection of Best Sensitive Logistic Estimator in the Presence of Collinearity

u x v x dx u x v x v x u x dx d u x v x u x v x dx u x v x dx Integration by Parts Formula

NON-SYMMETRY POWER IN THREE-PHASE SYSTEMS

Radial Cataphoresis in Hg-Ar Fluorescent Lamp Discharges at High Power Density

General Notes About 2007 AP Physics Scoring Guidelines

Households Demand for Food Commodities: Evidence from Kurunegala Divisional Secretarial Division, Sri Lanka

Study of Dynamic Aperture for PETRA III Ring K. Balewski, W. Brefeld, W. Decking, Y. Li DESY

EECE 301 Signals & Systems Prof. Mark Fowler

Search sequence databases 3 10/25/2016

1 Minimum Cut Problem

/ n ) are compared. The logic is: if the two

Estimation of apparent fraction defective: A mathematical approach

Questions k 10k 100k 1M Speaker. output

ME 321 Kinematics and Dynamics of Machines S. Lambert Winter 2002

~ Outline ~ 1. Normalization Quality filtering Rank-Invariant selection for non-differentially expressed genes Fit normalization curve

Lecture 6: Introduction to Linear Regression

R-Estimation in Linear Models with α-stable Errors

Physics of Very High Frequency (VHF) Capacitively Coupled Plasma Discharges

Optimal Ordering Policy in a Two-Level Supply Chain with Budget Constraint

ON THE COMPLEXITY OF K-STEP AND K-HOP DOMINATING SETS IN GRAPHS

Using Markov Chain Monte Carlo for Modeling Correct Enumeration and Match Rate Variability

Elements of Statistical Thermodynamics

Einstein Equations for Tetrad Fields

HORIZONTAL IMPEDANCE FUNCTION OF SINGLE PILE IN SOIL LAYER WITH VARIABLE PROPERTIES

u r du = ur+1 r + 1 du = ln u + C u sin u du = cos u + C cos u du = sin u + C sec u tan u du = sec u + C e u du = e u + C

Electrochemical Equilibrium Electromotive Force. Relation between chemical and electric driving forces

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018

Lecture 4 BLUP Breeding Values

Transcription:

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag of 7 Unt 7 Introducton to Analyss of Varanc Always graph rsults of an analyss of varanc - Grald van Bll. Analyss of varanc s a spcal cas of rgrsson (s Unt, Rgrsson and Corrlaton). Th dstncton s that, n analyss of varanc, all of th prdctors ar catgorcal and ar calld factors. Rcall that n rgrsson, gnrally, th prdctors can b thr contnuous or dscrt or a mx. Th common fatur of analyss of varanc and normal thory lnar rgrsson s that th outcom varabl s contnuous and assumd dstrbutd normal. * factor wth 3 or mor lvls s a on way analyss of varanc. * factor wth just lvls s a two sampl t-tst. * factors (rgardlss of th numbr of lvls) s a two way analyss of varanc. * 3 factors s a thr-way analyss of varanc. And so on. In a factoral dsgn, thr ar obsrvatons at vry combnaton of lvls of th factors. Th analyss s usd to xplor ntractons (ffct modfcaton) btwn factors. An ntracton btwn factor I and factor II s sad to xst whn th rspons to factor II dpnds on th lvl of factor I and vc vrsa. In a nstd or hrarchcal dsgn, such as a two-lvl nstd dsgn, th analyss s of unts (g-patnts) that ar clustrd by lvl of factor I (g- hosptal) whch ar n turn clustrd by lvl of factor II (g cty). A spcal typ of nstd dsgn s th longtudnal or rpatd masurmnts dsgn. Rpatd masurmnts ar clustrd wthn subjcts and th rpatd masurmnts ar mad ovr a manngful dmnson such as tm (g growth ovr tm n chldrn) or spac. Th analyss of rpatd masurmnts data s ntroducd n unt 8. Unt 7 s an ntroducton to th bascs of analyss of varanc.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag of 7 Tabl of Contnts Topc Larnng Objctvs.. Th Logc of Analyss of Varanc... Introducton to Analyss of Varanc.. 3. On Way Fxd Effcts Analyss of Varanc...... 4. Chckng Assumptons of th On Way Analyss of Varanc.... a. Tsts for Homognty of Varanc... b. Graphcal Assssmnts and Tsts of Normalty... 5. Introducton to Mor Complcatd Dsgns.. a. Balancd vrsus Unbalancd. b. Fxd vrsus Random c. Factoral vrsus Nstd.. 6. Som Othr Analyss of Varanc Dsgns... a. Randomzd Block Dsgn.... b. Two Way Fxd Effcts Analyss of Varanc Equal n... c. Two Way Hrarachcal or Nstd Dsgn.... 3 4 0 4 0 0 4 6 6 7 9 3 3 35 44 Appndx Rfrnc Cll Codng v Dvaton from Mans Codng... Appndx Multpl Comparsons Adjustmnt Procdurs... Appndx 3 - Varanc Componnts and Expctd Man Squars... Appndx 4 - Varanc Componnts: How to Construct F Tsts.. 48 49 65 7

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 3 of 7 Larnng Objctvs Whn you hav fnshd ths unt, you should b abl to: Explan how analyss of varanc s a spcal cas of normal thory lnar rgrsson. Prform and ntrprt a on way analyss of varanc. Explan what s mant by a mult-way analyss of varanc. Explan what s mant by a factoral dsgn analyss of varanc. Explan th manng of ntracton of two factors. Explan what s mant by a nstd dsgn analyss of varanc. Prform and ntrprt a two-way factoral analyss of varanc, ncludng an assssmnt of ntracton.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 4 of 7. Th Logc of Analyss of Varanc Analyss of varanc s an analyss of th varablty of mans. Consdr th followng pctur that rprsnts two scnaros. In scnaro (lft), th mans ar dffrnt. In scnaro (rght), th mans ar th sam. Scnaro mans ar dffrnt µ µ S and S ach summarz nos controllng for locaton. Scnaro mans ar th sam µ = µ S and S ach summarz nos controllng for locaton. Th sz of X X s largr than nos X X s wthn th nghborhood of nos. S s largr than S and S bcaus t s mad largr by th xtra varablty among ndvduals du to chang n locaton. S s smlar n sz to S and S bcaus t dos not hav to accommodat an xtra sourc of varablty bcaus of locaton dffrncs btwn th two groups.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 5 of 7 A Spcal Cas That s Convnnt for Illustraton s Balancd (Equal sampl szs n ach group) - Whn th sampl szs ar th sam n ach group, t s asr to s how analyss of varanc s an analyss of th varablty of th mans. Consdr th followng xampl (not th algbra s not so tdy whn th sampl szs ar not qual) Exampl - Strss and Hart Rat (sourc: Grstman BB. Basc Bostatstcs: Statstcs for Publc Halth Practc, pp59-6. Th data usd by Grstman ar from Alln t al (99) Prsnc of human frnds and pt dogs as modrators of autonomc rsponss to strss n womn. J. Prsonalty and Socal Psychology 6(4); 58-589. It has bn hypothszd that th companonshp of a pt provds psychologcal rlf to ts ownrs whn thy ar xprncng strss. An xprmnt was conductd to addrss ths quston. Consntng partcpants wr randomzd to on of thr condtons: - Pt Prsnt, -Frnd Prsnt, or 3-Nthr frnd nor pt prsnt. Each partcpant was thn xposd to a strssor (t happnd to b mntal arthmtc). Th outcom masurd was hart rat. Slctd Summary Statstcs, by Group: Group Pt Prsnt Group Frnd Prsnt Group 3 Nthr Pt nor Frnd n n = 5 n = 5 n 3 = 5 X X = 73. 48 X = 9. 33 X = 8. 5 3 S S = 9.97 S = 8.34 S 3 = 9.4 S S = 99.40 S = 69.57 S 3 = 85.4 ( n ) S = ( X X) ( n )S = n j= ( X X ) j =,39.57 ( n )S n j= = ( X X ) = 974.05 j ( n 3 )S 3 n 3 j= = ( X X ) 3 j 3 =,95.70 Do ths data provdd statstcally sgnfcant vdnc that th mans ar dffrnt, that µ, µ, and µ 3 ar not qual?

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 6 of 7 Th Rasonng n an Analyss of Varanc Proof by Contradcton Sgnal-to-Nos W llustrat wth a on way fxd ffcts analyss of varanc.. Bgn wth th null hypothss assumpton that th mans ar th sam W ll assum th null hypothss s tru, thn apply ths modl to th obsrvd data, and look to s f ts applcaton has ld to an unlkly rsult, warrantng rjcton of th null hypothss of qualty of µ, µ, and µ 3.. Stat th assumptons ncssary for computng probablts. X X n ar dstrbutd Normal ( µ, ) X X n ar dstrbutd Normal ( µ, ) X 3 X 3n3 ar dstrbutd Normal ( µ 3, ) Th varancs ar all qual to. Th obsrvatons ar all ndpndnt. 3. Spcfy H O and H A. H O : µ = µ = µ 3 H A : not 4. Rason an approprat tst statstc (Sgnal-to-Nos). Wthn Group Varablty = Nos It s th varablty of ndvduals wthn ach group. Nos: Obtan sparat stmats of th common, on from ach of th 3 sampls: S, S, and S 3 Nos stmats th varablty among ndvduals, controllng for locaton. Obtan an stmat of th common varanc, by combnng th sparat stmats S, S, and S 3 nto a wghtd avrag. Th wghts ar th dgrs of frdom of ach of S, S, and S 3 Estmat of = ˆ wthn 3 = = 3 ( n ) ( n ) = S

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 7 of 7 Btwn Group Varablty = Sgnal. It s th varablty among mans. Nxt, consdr a spcal sampl of sz = 3. Th 3 data ponts n ths spcal sampl ar X X X = n X = ( ) = n X = ( ) n X 3 3 3 5 73.483 = 84.5988 = = ( ) 5 9.35 = 353.70059 5 8.54 = 39.6446 Th sampl man of ths mans s X = 39.3046 W call th xpctd valu of th sampl varanc of X *, X *, and X 3 * th btwn. Whn th null hypothss H O s tru, and only whn H O s tru, th sampl varanc of X *, X *, and X 3 * s an stmat of. E 3 = ( X X ) ( 3 ) = = btwn Whn th altrnatv hypothss H A s tru, th sampl varanc of X *, X *, and X 3 * s an stmat of a quantty ( btwn ) that s largr than. ( X X ) ( 3 ) 3 = E = btwn = + Δ whr Δ = functon ( µ, µ, µ ) > 0 3 ths s th amount largr! Thus, th sgnal s Δ = functon(µ,µ,µ 3 ) > 0

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 8 of 7 Th Sgnal-to-Nos analyss compars th Btwn group mans varablty to th Wthn groups varablty. In th analyss of varanc applcaton, th comparson that s mad s actually Nos + Sgnal = Varablty among a functon of th group mans Nos Varablty of ndvduals wthn groups = Var(X *, X *, X 3 * ) df wghtd sum of S, S, and S 3 = ˆ btwn ˆ wthn = 3 ( X X ) ( 3 ) = 3 3 ( n ) S ( n ) = = 5. Prform th calculatons. Usng th valus n th tabl on pag 5, w hav 3 = ˆ = wthn 3 ( n ) = = 84.79 ( n ) S = ( 39.57 + 974.05 + 95.70) ( 4 + 4 + 4) ˆ Usng th valus of th 3 ( X X ) ( 3 ) * X on pag 7, w also hav = = =,93.836 btwn

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 9 of 7 W us th F dstrbuton to compar th two varancs. Luckly, th two varancs ar ndpndnt. Whn th null hypothss H O s tru: Ovrall F ˆ btwn = ˆ wthn s dstrbutd F wth Numrator dgrs of frdom = (k ) = (3-) = Dnomnator dgrs of frdom = (n ) = (3)(5-)= 4 Expctd Valu of F p-valu! wthn! btwn!! btwn wthn H O tru Larg H A tru + Δ > > Small For our data, F = 93.836 / 84.79 = 4.08 Th accompanyng p-valu s Probablty[ F df=,4 > 4.08 ] =.0000. 6. Evaluat fndngs and rport. Th assumpton of th null hypothss of qual mans has ld to an xtrmly unlkly rsult! Th null hypothss chancs wr approxmatly, chancs n 00,000 of obtanng 3 mans of groups that ar as dffrnt from ach othr as ar 73.48, 9.33, and 8.5. Th null hypothss s rjctd. 7. Intrprt n th contxt of bologcal rlvanc. Ths analyss provds statstcally sgnfcant vdnc of group dffrncs n hart rat, dpndng on companonshp by pt or by frnd. But w do not know whch, or f both, provds th bnft!!

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 0 of 7. Introducton to Analyss of Varanc Prlmnary not - In th pags that follow, I am usng th notaton X to rfr to th outcom varabl n analyss of varanc. Analyss of varanc modls, lk rgrsson modls, hav an dntfabl basc structur. Structur of Analyss of Varanc Modl Obsrvd = man + random rror X = µ + ε Obsrvd Expctd Random rror data valu Ths s modld µ - Ths s th xpctd valu of X whch w wrt as µ = E [X] = lnar modl(stuff) ε - Ths s th da of random rror, rror n masurmnt, nos Subscrpts Subscrpts kp track of group mmbrshp and prsons wthn groups. E.g. - X j = Obsrvd valu for j th prson n th th group. A spcal fatur of analyss of varanc modls ar thr us of subscrpts. Exampl On way fxd ffcts analyss of varanc. Structur of On Way Fxd Effcts Analyss of Varanc Modl Obsrvd = man + random rror Subscrpts: kps track of th group. j kps track of th ndvdual wthn th group. X j = µ + ε j Obsrvd Expctd Random rror data valu valu s th for jth obsrvaton for j th prson man of th of th th group man. n th group group

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag of 7 Introducton to Dfnng an ANOVA Modl Th On Way Fxd Effcts Anova In a on way fxd ffcts analyss of varanc (anova) modl, th modl prmts th mans to b dffrnt from on group to th nxt howvr thy may dffr. Thr s no straght ln modl nor any sort of curvy modl assumpton for that mattr. Instad, th man outcom for ach group E( X j ) = µ s compltly gnral. E( X j ) = µ s not rlatd n any way to an assumd functonal form (byond a dpartur from an ntrcpt). Exampl Hart rat and strss, contnud - In ths analyss, th null hypothss was that th mans ar all th sam. Th altrnatv hypothss was th compltly gnral hypothss µ µ µ 3. Mor gnrally, suppos th numbr of groups = K, nstad of 3 n th hart rat xampl. Dfn subscrptng as follows. Th frst subscrpt wll b and wll ndx th groups usng =,, K. Th scond subscrpt wll b j and wll ndx th jth ndvdual n th th group usng j =,, n. Kp track of th group spcfc sampl szs. Lt n rprsnt th sampl sz for th th group. Lt µ = man for prsons n th th group µ = ovrall man, wthout rgard for group mmbrshp Dvaton from mans modl. Ths s a nfty r-wrt that rwrts µ as a nw xprsson that s qual to tslf. Ths s don by addng and subtractng µ to µ. µ = µ + ( µ - µ ) man for ovrall dvaton from group man man spcfc to th group Sam nfty trck to obtan a rwrt of th obsrvd X j. Notc (blow) that w ar addng and subtractng two thngs ths tm: ( X ) + ( j X ) X = X + X X j

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag of 7 On mor manpulaton lts us xprss th varablty of ndvduals about th ovrall man as th sum of two contrbutons. Ths s usful for analyss purposs. (X j X) = ( X X) + ( X j X ) Each sourc (btwn or wthn) contrbuts ts own shar to th total varablty va th followng (wondrful) rsult. n K K K ( X ) ( ) ( ) j X = X X + X j X = j= = j= = j= n total varablty varablty varablty btwn groups wthn groups W kp track of all ths n an analyss of varanc tabl. Sourc df a Sum of Squars Man Squar Varanc Rato = F n K n Btwn groups ( K- ) ( ) K n X X ( X X) ( K ) Wthn Groups ( n ) = j= K K n ( ) Xj X = = j= = j= =! btwn K ( Xj X ) ( n ) n = j= = K F =!! btwn wthn =! wthn Total N a dgrs of frdom K n ( ) Xj X = j=

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 3 of 7 Exampl contnud from pag 5: Strss and Hart Rat (sourc: Grstman BB. Basc Bostatstcs: Statstcs for Publc Halth Practc, pp59-6. Th data usd by Grstman ar from Alln t al (99) Prsnc of human frnds and pt dogs as modrators of autonomc rsponss to strss n womn. J. Prsonalty and Socal Psychology 6(4); 58-589. (pts.dta) Tratmnt Pt Prsnt Frnd Prsnt Nthr Pt, Nor Frnd 69.7 99.69 84.74 68.86 9.35 87.3 70.7 83.40 84.88 64.7 00.88 80.37 58.69 0.5 9.75 79.66 89.8 87.45 69.3 80.8 87.78 75.98 98.0 73.8 86.45 0.06 84.5 97.54 76.9 77.80 85.00 97.05 70.88 69.54 88.0 90.0 70.08 8.60 99.05 7.6 86.98 75.48 65.45 9.49 6.65 Stata Illustraton.* onway outcomvarabl factorvarabl. onway hrt_rat group Sourc df a Sum of Squars Man Squar Varanc Rato = F Among groups 387.69! btwn Wthn Groups 4 356.30! wthn Total 44 5948.99 a dgrs of frdom = 93.84 = 84.79 btwn F =! = 4.08! wthn MATCH! My hand calculaton of th on way anova matchs th Stata rsults

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 4 of 7 3. Th On Way Fxd Effcts Analyss of Varanc Fxd vrsus Random Effcts ar Introducd n Scton 5b Th xampl usd to ntroduc th logc of analyss of varanc s a on way fxd ffcts analyss of varanc. Thus, w hav a fl for th on way analyss of varanc alrady. A two sampl t-tst s a on way analyss of varanc whr th numbr of groups K=. Th PubHlth 540 Vw Is th sgnal ( X X ) larg rlatv to nos whr nos = SE( X X )? t = (X X ) SE(X X ) = masur of dstanc of (X X ) from 0, xprssd on SE scal. Th ANOVA Vw Is th varablty of (X, X ) larg rlatv to nos whr nos = wghtd avrag of S, S functon of varablty of data X,X F= functon of varablty of "nos" S,S = masur of varablty among X, X ( sgnal ) to varablty of ndvduals wthn groups ( nos ) Sttng. Normalty. Th obsrvd outcoms ar dstrbutd normal. Group : X...X n ar a smpl random sampl from a Normal(µ,) Group : X...X n ar a smpl random sampl from a Normal(µ,) Etc. Group K: X K...X n ar a smpl random sampl from a Normal(µ K, ) K. Constant varanc. Th K sparat varanc paramtrs ar qual 3. Indpndnc Th obsrvatons ar ndpndnt

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 5 of 7 Th K sparat populaton mans ar H O :µ =...=µ K H A : At last som ar unqual µ,µ,...,µ K Rcall - kps track of th group. j kps track of th ndvdual wthn th group. Modl for th man n th th group - On Way Fxd Effcts Analyss of Varanc Modl of E[ X j l = µ () E [ X j ] = µ = [ µ + τ ] whr () K = τ = 0 Ky: Th dffrnt-nss of ach man s capturd n th τ,, τ K. Notc th followng: - By dfnton, µ = + µ - µ = µ + τ µ says that [ µ µ ] = τ µ says that [ µ K µ ] = τ K Group: [ ] µ = + µ - µ = µ + τ Group K: k [ K ] K K = τ = 0 - If th mans ar NOT EQUAL, thn at last on τ = [ µ µ ] 0

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 6 of 7 On Way Analyss of Varanc Fxd Effcts Modl Sttng: K groups ndxd =,,. K Group spcfc sampl szs: n, n,.., n K X j = Obsrvaton for th jth ndvdual n th th group Th on way analyss of varanc fxd ffcts modl of X j s dfnd as follows: X j = µ + τ + ε j whr and µ = grand man τ = µ - µ [ ] K = τ = 0 ε j s random rror dstrbutd Normal(0,) Estmaton Paramtr Estmat usng µ X.. µ X. τ = [µ µ] [X. X]! wthn! btwn ˆ K = wthn = K (n )S = (n ) Expctd Valu of!! F p-valu btwn wthn H O tru Larg H A tru + Δ > > Small Exampl

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 7 of 7 Thr groups of physcal thrapy patnts wr subjctd to dffrnt tratmnt rgmns. At th nd of a spcfd prod of tm ach was gvn a tst to masur tratmnt ffctvnss. Th sampl sz was 4 n ach group. Th followng scors wr obtand. X * = X =70 Tratmnt 3 75 5 00 80 75 80 75 5 00 50 75 40 X =50 X =80 * X = n X =()(70)=40 3 = X * 3 = 33.33 * X = n X =()(50)=00 3 * X 3= n X 3 =()(80)=60 H O : µ = µ = µ 3 H A : not Stp : Tst th assumpton of qualty of varancs. Tsts of th assumpton of qualty of varancs ar dscussd n Scton 4a. Ths ar of lmtd usfulnss for two rasons: () Tsts of qualty of varanc tnd to b snstv to th assumpton of normalty. () Analyss of varanc mthodology s prtty robust to volatons of th assumpton of a common varanc. Stp : Estmat th wthn group varanc ( nos ). Ths wll b a wghtd avrag of th k sparat sampl varancs. K = 3 = ˆ wthn = 3 ( n ) = ( n ) S = 5450.00 9 = 605.56

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 8 of 7 Stp 3: Estmat th btwn group varanc ( nos + sgnal ). Ths wll b a sampl varanc calculaton for a spcal data st comprsd of X= nx, X= nx, X= nx s * * * 3 3 ˆ btwn = 3 = ( X X ) ( 3 ) = 866.67 = 933.33 Stp 4: Summarz n an analyss of varanc tabl. Prform F-tst of null hypothss of qual mans. Sourc df a Sum of Squars Man Squar Varanc Rato = F K n Btwn groups ( K- ) = ( ) X X Wthn Groups ( n ) = = j= = 866.67 K K n = 9 ( ) X X = j= j K n ( X X) ( K ) = j= =! btwn n = 933.33 K K ( Xj X ) ( n ) = j= = btwn F =! =.54! wthn = 5450.00 =! wthn = 605.56 Total N a dgrs of frdom K n ( ) Xj X = j= = 736.67 p-valu = Pr [F DF=,9 >.54 ] =.7 Concluson. Th null hypothss s not rjctd. Ths data do not provd statstcally sgnfcant vdnc that ffctvnss of tratmnt s dffrnt, dpndng on th typ of tratmnt rcvd ( vrsus vrsus 3 ).

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 9 of 7 Stp 5: Don t forgt to look at your data!.. * Stata llustraton. * dotplot outcom, ovr(groupng) cntr nogroup nx(30).dotplot scor, ovr(txgroup) cntr nogroup nx(30).* Stata llustraton. graph box outcom, ovr(groupng). graph box scor, ovr(txgroup).* Stata llustraton. onway outcom groupng, tabulat. onway scor txgroup, tabulat Rspons to Tratmnt Among Physcal Thrapy Patnts, by Tratmnt Rgm (N=) a Rspons Tratmnt n Avrag Standard Dvaton 4 70 3.54 4 50 8.87 3 4 80 8.8 a On way analyss of varanc, p=.7; Bartltt tst of qualty of varanc, p=.46 Nots - For small sampls, try a sd-by-sd dot plot usng th Stata command dotplot. For largr sampls, do a sd-by-sd box and whskr plot usng th command graph box. Notc that th scattr of th data sms to dffr among th groups (n partcular, th magntud of th scattr s notcably smallr among patnts rcvng tratmnt #). Th small sampl szs may xplan ts lack of statstcal sgnfcanc. Also bcaus of small sampl sz (possbly), th dscrpancy n man rsponss (70 vrsus 50 vrsus 80) also fals to rach statstcal sgnfcanc.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 0 of 7 4. Chckng Assumptons of th On Way Analyss of Varanc a. Tsts for Homognty of Varanc Volaton of th assumpton of homognty of varancs s somtms, but not always, a problm. Rcall that th dnomnator of th ovrall F statstc n a on way analyss of varanc s th wthn group man squar. It s a wghtd avrag of th sparat wthn group varanc stmats S and, as such, s an stmat of th assumd common varanc.,,..., K ar at last rasonably smlar, thn th wthn group man squar s a good summary of th wthn group varablty. o Whn th wthn group varanc paramtrs Th ovrall F tst for qualty of mans n an analyss of varanc s rasonably robust to modrat volatons of th assumpton of homognty of varanc. Howvr, parws t-tsts and hypothss tsts of contrasts ar not robust to volatons of homognty of varanc, as whn th,,..., ar vry unqual. K Tsts of homognty of varanc ar approprat for th on way analyss of varanc only. Thr ar a varty of tsts avalabl. F Tst for Equalty of Two Varancs Ths was ntroducd n PubHlth540 Unt 7, Scton Hypothss Tstng (S p 50 undr http://www-unx.ot.umass.du/~bp540w/pdf/tstng.pdf) Bartltt s tst - Ths tst has hgh statstcal powr whn th assumpton of normalty s mt. Howvr, t s vry snstv to th assumpton of normalty. Lvn s tst Ths tst has th advantag of bng much lss snstv to volatons of normalty. Its dsadvantag s that t has lss powr than Bartltt s tst. Brown-Forsyth tst, also calld Lvn (md) tst Smlar to Lvn s Tst.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag of 7 Bartltt s Tst H: = =... = O K H: At last on s unqual to th othrs A Obtan th K sparat sampl varancs Obtan ˆ K = wthn = K ( n ) = ( n ) S S,...,S K th stmat of th (null hypothss) common K K Comput B = [ln( ˆ wthn )] ( n- ) - ( n-) ln( S ) not Som txts us ths as th tst. Comput C = + - 3(K-) n - = = K K = ( ) = ( n-) not Ths s a corrcton factor Comput Bartltt Tst Statstc = B C not th dstrbuton of B/C s bttr approxmatd by ch squar. Whn th null hypothss s tru, Bartltt Tst Statstc s dstrbutd Ch squar (df=k-) Rjct null for larg valus of Bartltt Tst Stata llustraton Bartltt s tst of qual varanc s provdd wth rsults of command onway.* onway yvarabl groupvarabl. onway scor txgroup Analyss of Varanc Sourc SS df MS F Prob > F ------------------------------------------------------------------------ Btwn groups 866.66667 933.333333.54 0.657 Wthn groups 5450 9 605.555556 ------------------------------------------------------------------------ Total 736.66667 665.555 Bartltt's tst for qual varancs: ch() =.560 Prob>ch = 0.458

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag of 7 Lvn s Tst ( Dsprson varabl Analyss of Varanc ) Th da of Lvn s tst and ts modfcaton s to crat a nw random varabl, a dsprson random varabl whch w wll rprsnt as d and that s a masur of how th varancs ar dffrnt. Lvn s tst (and ts modfcatons) ar a on way analyss of varanc on a dsprson random varabl d. H: = =... = O K H: At last on s unqual to th othrs A Comput d j = X j - X. Prform a on way analyss of varanc of th d j Whn th null hypothss s tru, th Lvn Tst On Way Analyss of Varanc s dstrbutd F (numrator df = K-, dnomnator df = N-K) Rjct null for larg valus of Lvn Tst On Way Anova F Stata llustraton Lvn tst s W0 n rsults of command robvar.* robvar outcomvarabl, by(groupvarabl). robvar scor, by(txgroup) W0 =.0563 df(, 9) Pr > F = 0.655967 W50 =.8000000 df(, 9) Pr > F = 0.000059 W0 =.0563 df(, 9) Pr > F = 0.655967 Brown and Forsyth Modfcaton of Lvn s Tst ( Dsprson varabl Analyss of Varanc ) Th Brown and Forsyth modfcaton of Lvn s tst utlzs as ts dsprson random varabl d th absolut dvaton from th group mdan. H: = =... = O K H: At last on s unqual to th othrs A Comput d j = X j - mdan(x,x,..., X n ).

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 3 of 7 Prform a on way analyss of varanc of th d j Whn th null hypothss s tru, th Brown and Forsyth On Way Analyss of Varanc s dstrbutd F (numrator df = K-, dnomnator df = N-K) Rjct null for larg valus of Brown and Forsyth Tst On Way Anova F Stata llustraton Brown-Forsyth tst s W50 n rsults of command robvar.* robvar outcomvarabl, by(groupvarabl). robvar scor, by(txgroup) W0 =.0563 df(, 9) Pr > F = 0.655967 W50 =.8000000 df(, 9) Pr > F = 0.000059 W0 =.0563 df(, 9) Pr > F = 0.655967 Statstcs n Practc: Gudlns for Assssng Homognty of Varanc Look at th varancs (or standard dvatons) for ach group frst! Compar th numrc valus of th varancs (or standard dvatons) If th rato of th standard dvatons s lss than 3 (or so), t s okay not to worry about homognty of varancs Construct a sd-by-sd box plot of th data and hav a look at th szs of th boxs. Scond, assss th rasonablnss of th normalty assumpton. Ths s mportant to th valdty of th tsts of homognty of varancs. Lvn s tst of qualty of varancs s last affctd by non-normalty; t s a good choc. Bartltt s tst should b usd wth cauton, gvn ts snstvty to volatons of normalty.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 4 of 7 b. Graphcal Assssmnts and Tsts of Normalty Graphcal assssmnts and tsts of normalty wr ntroducd prvously. S agan PubHlth 640 Unt, Rgrsson & Corrlaton, Scton 5b, pp 75-77. Analyss of Varanc mthods ar rasonably robust to volaton of th assumpton of normalty n analyss of varanc. Whl, strctly spakng, th assumpton of normalty n a on way analyss of varanc s that wthn ach of th K groups th ndvdual X j for j =,, n ar assumd to b a smpl random sampl from a Normal( µ, ), Th analyss of varanc s actually rlyng on normalty of th samplng dstrbuton of th mans X for =,,..., K. Ths s grat bcaus w can appal to th cntral lmt thorm. Thus, provdd that th sampl szs n ach group ar rasonabl ( say 0-30 or mor), and provdd th undrlyng dstrbutons ar not too too dffrnt from normalty, thn th analyss of varanc s rasonably robust to volaton of th assumpton of normalty. As wth normal thory rgrsson, assssmnts of normalty ar of two typs n analyss of varanc. Prlmnary s to calculat th rsduals: - For X j = obsrvaton for j th prson n group= - Rsdual r j = ( X-X) j. dffrnc btwn obsrvd and man for group. Graphcal Assssmnts of th dstrbuton of th rsduals: - Dot plots wth ovrlay normal - Quantl-Quantl plots usng rfrnt = normal. Numrcal Asssmnts: - Calculaton of skwnss and kurtoss statstcs - Shapro Wlk tst of normalty - Kolmogorov Smrnov/Lllfors tsts of normalty - Andrson Darlng/Cramr von Mss tsts of normalty

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 5 of 7 Statstcs n Practc: Gudlns for th Handlng of Volatons of Normalty Small sampl sz sttng (wthn group sampl sz n < 0, approxmatly): Rplac th normal thory on way analyss of varanc wth a Kruskal Walls nonparamtrc on way analyss of varanc. Ths wll b ntroducd n Topc 9, Nonparamtrcs Larg sampl sz sttng: If you rally must, consdr a normalzng data transformaton. Possbl transformatons nclud th followng: () Logarthmc Transformaton: * X = ln(x+) hlps postv skwnss () Squar Root Transformaton: * X = X + 0.5 hlps htroscdastcty (3) Arcsn Transformaton: * p = arcsn p for outcom 0 to 00 prcntag (4) If your data ar actual proportons of th typ X/n and you hav X and n consdr Anscomb Arcsn Transformaton: * p = arcsn 3 X+ 8 3 n+ 4

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 6 of 7 5. Introducton to Mor Complcatd Dsgns So far w hav consdrd just on analyss of varanc dsgn: th on way analyss of varanc dsgn. - or mor groups wr compard (.g. w compard 4 groups) - Howvr, th groups rprsntd lvls of just factor (.g. rac/thncty) Analyss of varanc mthods can bcom mor complcatd for a varty of rasons, ncludng but not lmtd to th followng- () Th modl may hav mor trms, ncludng ntractons and/or adjustmnt for confoundng - Fttng and ntrprtaton bcom mor challngng. () On or mor of th trms n th modl mght b masurd wth rror nstad of bng fxd Estmats of varanc, thr ntrprtaton and confdnc ntrval constructon ar mor nvolvd. (3) Th parttonng of total varablty mght not b as straghtforward as what w hav sn so far Undrstandng and workng wth analyss of varanc tabls and, spcally, knowng whch F tst to us, can b hard. a. Balancd vrsus Unbalancd Th dstncton prtans to th parttonng of th total varablty and, spcfcally, th complxty nvolvd n th varanc componnts and thr stmaton. BALANCED Th sampl sz n ach cll s th sam. Equalty of sampl sz maks th analyss asr. Spcfcally, th parttonng of SSQ s straghtforward A way balancd anova wth n= s calld th randomzd block dsgn

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 7 of 7 UNBALANCED Th sampl szs n th clls ar dffrnt. Th parttonng of SSQ s no longr straghtforward. Hr, a rgrsson approach (rfrnc cll codng) s somtms asr to follow b. Fxd vrsus Random Effcts Fxd vrsus random s mor complcatd than you mght thnk. - Th dstncton has to do wth how th nfrncs wll b usd - Th formal analyss of varanc s largly unchangd. Thr xst a numbr of dfntons of fxd vrsus random ffcts. Among thm ar th followng. - Fxd ffcts ar lvls of ffcts chosn by th nvstgator, whras Random ffcts ar slctd at random from a largr populaton - Fxd ffcts ar thr () lvls chosn by th nvstgator or () all th lvls possbl Random ffcts ar a random sampl from som unvrs of all possbl lvls. - Fxd ffcts ar ffcts that ar ntrstng n thmslvs, whras Effcts ar nvstgatd as random f th undrlyng populaton s of ntrst.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 8 of 7 Exampls - Exampls of Fxd Effcts () Tratmnt (mdcn v surgry) () Gndr (all gndrs) - Exampls of Random Effcts () lttr of anmals (ths s an xampl of a random block) () ntrvwr n a data collcton sttng whr thr mght b multpl ntrvwrs or ratrs. Illustraton - In fxd vrsus random, th ways w thnk about th null hypothss ar slghtly dffrnt. Consdr a on way anova analyss whch xplors varatons n SAT scors, dpndng on th unvrsty afflaton of th studnts. - Outcom s X j = SAT scor for j th ndvdual at Unvrsty - Factor s Unvrsty wth = f Unvrsty s Massachustts f Unvrsty s Wsconsn 3 f Unvrsty s Alaska - Subscrpt j ndxs studnt wthn th Unvrsty - FIXED ffcts prspctv Intrst prtans only to th 3 Unvrsts (MA, WI, and AK) H 0 : µ Massachustts = µ Wsconsn = µ Alaska - RANDOM ffcts prspctv Massachustts, Wsconsn, and Alaska ar a random sampl from th populaton of unvrsts n th US. H 0 : Man SAT scors ar qual at all Amrcan Unvrsts

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 9 of 7 c. Factoral vrsus Nstd Th dstncton factoral vrsus nstd s an mportant dstncton prtanng to th dscovry of ntracton or ffct modfcaton (factoral) vrsus control for confoundng (nstd). Consdr th contxt of a two way analyss of varanc that xplors Factor A at a lvls and Factor B at b lvls FACTORIAL All combnatons of factor A and factor B ar nvstgatd. Factoral dsgn prmts nvstgaton of A x B ntracton Thus, good for xploraton of ffct modfcaton, synrgsm, tc. Frquntly usd n publc halth, obsrvatonal pdmology Exampl - Factor A = Plant at a=3 lvls and Factor B = CO at b= lvls Not: All (3)() = 6 combnatons ar ncludd

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 30 of 7 NESTED Th lvls of th scond factor ar nstd n th frst. Confoundng (by Factor A) of th Factor B- Outcom rlatonshp s controlld through us of stratfcaton on Factor A Famlar xampls ar hrarchcal, splt plot, rpatd masurs, mxd modls. Nstd dsgns ar frquntly usd n bology, psychology, and complx survy mthodologs. Factor A, th stratfyng varabl, s somtms calld th prmary samplng unt. Exampl Factor A = Trs at 3 lvls and Factor B = Laf at 5 lvls, nstd Trs 3 Lavs 3 4 5 3 4 5 3 4 5

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 3 of 7 6. Som Othr Analyss of Varanc Dsgns What dsgn should you us? In brf, th answr dpnds on () th rsarch quston () knowldg of undrlyng bology and, spcfcally, knowldg of xtrnal nfluncs that mght b ffct modfyng or confoundng or both and (3) avalablty of sampl sz. Brfly, thr othr analyss of varanc dsgns ar ntroducd hr a. Th Randomzd Complt Block Dsgn b. Two Way Fxd Effcts Analyss of Varanc Equal cll numbrs c. Th Two Way Hrarchcal or Nstd Dsgn a. Th Randomzd Complt Block Dsgn Randomzd Complt Block Dsgn Modl Sttng: I groups or tratmnts ndxd =,,. I J blocks ndxd j=,,., J sz s n ach tratmnt x block combnaton X j = Obsrvaton for th on ndvdual n th jth block of th th group/tratmnt Th randomzd complt block dsgn modl of X j s dfnd as follows: X j = µ + α + β j + ε j whr and µ = grand man [ ] and α = 0 α = µ. - µ I = J β j = µ.j - µ and β j = 0 j= ε j s random rror dstrbutd Normal(0,)

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 3 of 7 Exampl - An nvstgator wshs to compar 3 tratmnts for HIV dsas. Howvr, t s suspctd that rspons to tratmnt mght b confoundd by basln cd4 count. Th nvstgator sks to control (bttr yt, lmnat) confoundng. To accomplsh ths, consntng subjcts ar groupd nto 8 homognous blocks accordng to cd4 count. Wthn ach block, basln cd4 counts ar assumd to b smlar. Wthn ach block, thr ar 3 subjcts, on pr tratmnt. Assgnmnt of subjct to tratmnt wthn ach block s randomzd. Layout Block s stratum of cd4 count Patnt 8 st Drug 3 Drug Drug nd Drug Drug Drug 3 3rd Drug Drug 3 Drug Whl thr ar two factors.. - Only on factor s of ntrst Tratmnt (drug) at 3 lvls. - Th othr factor s calld a blockng factor; ts nflunc on outcom s not of ntrst. But w do want to control for ts possbl confoundng ffct. A charactrstc of a randomzd complt block dsgn s that th sampl sz s ONE n ach Tratmnt x Block combnaton.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 33 of 7 Randomzd Complt Block Dsgn Analyss of Varanc ndxs tratmnt, =. I j ndxs block, j =. J µ j = Man [ Outcom ] for drug n block j =.. I In ths xampl, I = 3 j =,,, J In ths xampl, J = 8 E[ X j ] = µ j = µ + α + β j à X j = µ + α + β j + ε j whr () () I α = [ µ - µ ] and α = 0. = J β = [ µ - µ ] and β = 0 j.j j j= X j = X.. + [ X. - X.. ] + [ X.j - X.. ] + [ X j - X. - X.j + X.. ] algbrac dntty ε j s assumd dstrbutd Normal(0, ) Bcaus n= n ach cll, block x tratmnt ntractons, f thy xst, cannot b stmatd.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 34 of 7 Total SSQ and ts Parttonng X j = X.. + [ X. - X ] + [ X.j - X ] + [ X j - X. - X.j + X.. ] à [ X j - X.. ] = [ X. - X ] + [ X.j - X ] + [ X j - X. - X.j + X.. ]. Squarng both sds and summng ovr all obsrvatons ylds (bcaus th cross product trms sum to zro!) I J = j= [ X - X ] j.. I J I J I J....j.. j..j.. = j= = j= = j= = [ X - X ] + [ X - X ] + [ X - X - X + X ] I J I J....j.. j..j.. = j= = j= = J [ X - X ] + I [ X - X ] + [ X - X - X + X ] Analyss of Varanc Tabl Sourc df a Sum of Squars E (Man Squar) F Du tratmnt ( I- ) J ( X-X... ) Du block (J-) I = J I ( X-X.j..) j= + J = + I I α ( I-) J j= β j ( J-) MSQ F= MSQ tratmnt rsdual df = (I-), (I-)(J-) MSQ F= MSQ block rsdual df = (J-), (I-)(J-) Rsdual (I-)(J-) I J ( j..j..) X - X - X + X = j= Total IJ a dgrs of frdom I J ( X-X j..) = j=

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 35 of 7 b. Th Two Way Fxd Effcts Analyss of Varanc Two Way Analyss of Varanc Fxd Effcts Modl Sttng: I lvls of Factor # and ar ndxd =,,. I J lvls of Factor # and ar ndxd ndxd j=,,., J Th sampl sz for th group dfnd by Factor at lvl and Factor at lvl j s n j k ndxs th kth obsrvaton n th j th group X jk = Obsrvaton for th k th ndvdual n th jth block of th th group/tratmnt Th two way analyss of varanc fxd ffcts modl of X jk s dfnd as follows: X jk = µ + α + β j + ( αβ ) j + ε jk whr µ = grand man [ ] and α = 0 α = µ. - µ I = J β j = µ.j - µ and β = 0 j j= ( αβ ) j = µ j µ + α + β j = µ j µ α β j = µ j µ [ µ. µ ] µ. j µ I ( αβ ) j = 0 and ( αβ ) j = 0 = j j= and ε j s random rror dstrbutd Normal(0,)

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 36 of 7 Exampl (unt7_fshgrowth.dta) - An nvstgator wshs compar th fsh growth mans among 6 groups n a way factoral dsgn factor # bng lght at lvls and factor # bng watr tmpratur at 3 lvls. Two Way Fxd Effcts Analyss of Varanc Lt ndx lght, =,. j ndx watr tmpratur, j =,, 3. k ndx ndvdual n th (, j) th group, k =,, n j. µ j = Expctd man growth at 6 wks for fsh rasd undr condtons of lght = and watr tmpratur = j. µ j = µ + [ µ. - µ ] + [ µ. j - µ ] + [ µ j - µ - (µ. - µ) (µ. j - µ)] µ = Ovrall populaton man β = [ µ. - µ ] s th lght ffct. It s stmatd by X X..... τ j = [ µ. j - µ ] s th watr tmpratur ffct. It s stmatd by X X. j.... (βτ) j = [ µ j - µ- (µ. - µ) (µ. j - µ) ] s th xtra, jont, ffct of th th lght lvl and j th watr tmpratur. It s stmatd by X j. X... X.. X... ( ) ( ) X. j. X... Thus, an ndvdual rspons X j s modld X jk = µ j + ε jk = µ + [ µ. - µ ] + [ µ. j - µ ] + [ µ j - µ - (µ. - µ) (µ. j - µ) ] + ε jk = µ + α + β j + (αβ) j + ε jk

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 37 of 7 Assumptons I α =0 β j =0 = I J j= (αβ) j =0 (αβ) j =0 = J j= Analyss of Varanc Sourc df a Sum of Squars Man Squar F I J n Du lght ( I- ) ( ) j I J X.. X ( ) ( )... X.. X... I = j= k= n j = j= k= = ˆlght F ˆ = ˆ lght Du tmpratur (J-) I J n ( ) j X. j. X... = j= k= n j I J ( X. j. X... ) ( J ) = j= k= = ˆtmp F ˆ = ˆ tmp Du ntracton (I-)(J-) I J nj = j= k = ( X j. X.. X. j. + X... ) I = J nj j= k = ( X j. X.. X. j. + X... ) I ( )( J ) F ˆ = ˆ lght* tmp = ˆlght * tmp Wthn Groups I J = j= ( n j ) n j I n ( X jk X j. ) I J n j X jk X j. = j= k= = j= k= I J = j= ( ) ( n j ) =! Total N a dgrs of frdom n j I J ( X ) jk X... = j= k=

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 38 of 7 Exampl, contnud Rcall that t s of ntrst to study th ffct of watr tmpratur and lght on fsh growth. - Outcom X = fsh growth at sx wks - Factor I s Lght at lvls (low and hgh) - Factor II s Watr Tmpratur at 3 lvls (cold, lukwarm, warm) Followng ar th data (unt7_fshgrowth.dta). Lght Watr Tmp X = Fsh Growth =low =cold 4.55 =low =cold 4.4 =low =lukwarm 4.89 =low =lukwarm 4.88 =low 3=warm 5.0 =low 3=warm 5. =hgh =cold 5.55 =hgh =cold 4.08 =hgh =lukwarm 6.09 =hgh =lukwarm 5.0 =hgh 3=warm 7.0 =hgh 3=warm 6.9 Thr ar 3 analyss qustons and, thus, thr null hypothss of ntrst: () Ho: No ffct du to lght,.g. man lngth s th sam ovr th two lvls of lght () Ho: No ffct du to tmpratur.g. man lngth s th sam ovr th thr lvls of tmpratur (3) Ho: Not a dffrntal ffct of on tratmnt ovr th lvls of th othr (.g. no ntracton)

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 39 of 7 A manngful analyss mght procd n ths ordr. Stp. Tst for no ntracton - If thr s ntracton, ths mans that th ffct of lght on growth dpnds on th watr tmpratur and vc vrsa. - Accordngly, th manng that can b gvn to an analyss of ffcts of lght (Factor I) or an analyss of th ffcts of watr tmpratur (Factor II) dpnd on an undrstandng of ntracton - Th corrct F statstc s du ntracton - Numrator df = (I-)(J-). I J - Dnomnator df = ( n- j ) = j= F= ˆ lght*tmpratur ˆ If ntracton s NOT sgnfcant Stp. Tst for man ffct of Factor I Us ˆ F= ˆ factor I Numrator df = (I-). I J Dnomnator df = ( n- j ) = j= If ntracton s SIGNIFICANT Analyst must dcd whthr thr s manng to tst for man ffcts, as th rspons to on lvl of a factor (g. Factor II = watr tmpratur) dpnds on th lvl of anothr factor (g. Factor I = lvl of lght) If th analyst dcds to collaps th data to a on way analyss of varanc, thn th manng of th analyss of a man ffct s that t ylds an stmat of th avrag man ffct, takn ovr th lvls of th othr factor. Ths may or may not b of ntrst Rpat for Factor II.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 40 of 7 Exampl contnud.* Numrcal dscrptvs. * tabulat factor factor, summarz(outcomvarabl). tabulat tmp lght, summarz(growth) Mans, Standard Dvatons and Frquncs of growth lght tmp =low =hgh Total -----------+----------------------+---------- =cold 4.395 4.85000 4.605.9034.039447.659508 4 -----------+----------------------+---------- =lukwar 4.885 5.550000 5.7500.00707089.7636757.58465807 4 -----------+----------------------+---------- 3=warm 5.060000 6.965000 6.0500.070706.0636397.08 4 -----------+----------------------+---------- Total 4.780000 5.7766668 5.783334.350847.3587.95083 6 6.* Graphcal dscrptvs. labl varabl growth Growth at 6 Wks.sort tmp.graph box growth, ovr(tmp). sort lght.graph box growth, ovr(lght)

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 4 of 7.* Two way anova man ffcts + ntracton. * anova outcom factor factor factor#factor. anova growth tmp lght tmp#lght Numbr of obs = R-squard = 0.87 Root MSE =.535537 Adj R-squard = 0.6830 Sourc Partal SS df MS F Prob > F -----------+---------------------------------------------------- Modl 8.39677 5.64639354 5.74 0.076 tmp 3.984375.995875 6.95 0.074 lght.98003383.98003383 0.39 0.08 tmp#lght.676639.63380897. 0.909 Rsdual.7080044 6.86800074 -----------+---------------------------------------------------- Total 9.957686.90479706 Sourc df a Sum Squars Man Squar F Du lght ( - ) =.98.98 = ˆ lght F ˆlght = 0.39 ˆ = rror P =.08 Du watr tmp (3-) = 3.984.99 = ˆ tmp F ˆtmp = 6.95 ˆ = rror p=.07 Du ntracton (I-)(J-) =.68 0.634 = ˆ lght*tmp F ˆlght* tmp =. ˆ = rror p=.9 Error I J ( n j ) = 6 = j=.7 0.868 = ˆ rror Total N = 9.953 a dgrs of frdom Ky: - st assss output for vdnc of ntracton. F-statstc =. on df =,6. Th p-valu s.9, suggstng that thr s NO statstcally sgnfcant vdnc of ntracton. Not surprsng, gvn th small sampl sz! - Nxt assss output for strngth of man ffcts. Man Effct of TEMP: F=6.95 on df=,6. p-valu =.03. Conclud statstcally sgnfcant - Man Effct of LIGHT: F=0.39 on df=,6. p-valu =.0. Conclud statstcally sgnfcant.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 4 of 7 Exampl contnud..* Post ANOVA modl stmaton Stata usrs: us command margns to obtan CI s for th mans. * margns factor factor factor#factor. margns tmp lght tmp#lght Prdctv margns Numbr of obs = Exprsson : Lnar prdcton, prdct() ------------------------------------------------------------------------------------ Dlta-mthod Margn Std. Err. t P> t [95% Conf. Intrval] -------------------+---------------------------------------------------------------- tmp =cold 4.605.677686 7.0 0.000 3.949794 5.6006 =lukwarm 5.75.677686 9.49 0.000 4.5694 5.87706 3=warm 6.05.677686.45 0.000 5.35794 6.667706 lght =low 4.78.863.86 0.000 4.4506 5.34974 =hgh 5.776667.863 6.4 0.000 5.4693 6.364 tmp#lght =cold#=low 4.395.37868.6 0.000 3.468399 5.360 =cold#=hgh 4.85.37868.7 0.000 3.888399 5.7460 =lukwarm#=low 4.885.37868.90 0.000 3.958399 5.860 =lukwarm#=hgh 5.55.37868 4.66 0.000 4.63399 6.47660 3=warm#=low 5.06.37868 3.36 0.000 4.33399 5.98660 3=warm#=hgh 6.965.37868 8.39 0.000 6.038399 7.8960 ------------------------------------------------------------------------------------.* Post ANOVA modl stmaton Us command anovaplot to vsualz th mans.* You may not alrady hav t. Issu th command fndt anovaplot and thn follow nstructons to download. fndt anovaplot * anovaplot x-axsvarabl stratfcaton, scattr(msym(non)). anovaplot tmp lght, scattr(msym(non)) ylabl(0()0) * anovaplot x-axsvarabl stratfcaton, scattr(msym(non)). anovaplot lght tmp, scattr(msym(non)) ylabl(0()0)

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 43 of 7.* Post ANOVA modl stmaton Smpl Man Effcts Tsts usng command sm.* You may not alrady hav t. Issu th command fndt sm and thn follow nstructons to download. fndt sm * Man ffct of tmp stratfyng on lght. sm tmp lght * Man ffct of lght stratfyng on lght. sm lght tmp Tst of tmp at lght(): F(/6) =.88664 Tst of tmp at lght(): F(/6) = 8.37464 Tst of lght at tmp(): F(/6) =.650683 Tst of lght at tmp(): F(/6) =.54987 Tst of lght at tmp(3): F(/6) =.65350 Crtcal valu of F for alpha =.05 usng... Dunn's procdur = 6.6548938 Marasculo & Lvn = 8.050945 pr famly rror rat = 7.598557 smultanous tst procdur = 6.949435 Crtcal valu of F for alpha =.05 usng... Dunn's procdur = 8.00839 Marasculo & Lvn = 9.8763647 pr famly rror rat = 0.80736 smultanous tst procdur =.389887 At low lght, th ffct of watr tmpratur s NOT sgnfcant. At hgh lght, th ffct of watr tmpratur s bordrln. At both cold and lukwarm tmpraturs, th ffct of lght s NOT sgnfcant. At warm tmpratur, th ffct of lght s bordrln. Summary - Th analyss of varanc tabl tlls us th followng.. Fal to rjct th hypothss of no ntracton. Thus w can tst for man ffcts usng th MSE.. Th statstcal tst of th null hypothss of no tmpratur ffct s bordrln sgnfcant. 3. Th statstcal tst of th null hypothss of no lght ffct s also bordrln sgnfcant. 4. Bottom ln? NOT ENOUGH SAMPLE SIZE TO DO MUCH HERE

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 44 of 7 c. Th Two Way Hrarchcal (Nstd) Dsgn Th Two Way Hrarchcal (Nstd) Dsgn Modl Sttng: I groups or tratmnts ndxd =,,. I J prmary samplng unts nstd wthn ach tratmnts and ndxd j=,,., J sz s n n ach tratmnt x block combnaton; ths ar scondary samplng unts k ndxs th scondary samplng unts and ar ndxd k =,,., n X jk = Obsrvaton for th k th scondary samplng unt of th jth prmary samplng unt n th th group/tratmnt Th two way hrarchcal (nstd) dsgn modl of X jk s dfnd as follows: X jk = µ + α + b () j + ε (j )k whr µ = grand man [ ] and α = 0 α = µ. - µ I = and b ()j s random and dstrbutd Normal(0, b ) ε j s random rror dstrbutd Normal(0,) b and ε ar mutually ndpndnt ()j (j)k Exampl - An nvstgator wshs compar 3 sprays appld to lavs on trs. Each tratmnt s appld to 6 lavs of 4 trs. Thus, th total numbr of obsrvatons s (3 tratmnts)(4 trs)(6 lavs) = 7 In an xampl such as ths, samplng s don n multpl stags. Hr () In stag, a random sampl of trs s slctd (thus tr s th prmary samplng unt) and () n stag, wthn ach tr, a random sampl of lavs s slctd for masurmnt.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 45 of 7 In a two way hrarchcal (nstd) dsgn, I = # tratmnts. In ths xampl, I=3 J = # prmary samplng unts In ths xampl, J=4 n = # scondary samplng unts, nstd In ths xampl, n=6 - Only on factor s of ntrst Tratmnt (spray) at 3 lvls. - Th ffct of tr s random and s not of ntrst. - Smlarly, th ffct of laf s random and s not of ntrst. Two Way Hrarchcal (Nstd) Analyss of Varanc Th nstd modl, for th rason of havng random ffcts, looks a lttl dffrnt from a fxd ffcts modl. µ = Man [ Outcom ] for spray = µ + α X jk = µ + α + b ()j + ε (j)k whr - Th parnthss notaton ()j tlls us that tr j s nstd n spray - Th parnthss notaton (j)k tlls us that laf k s nstd n th jth tr rcvng spray I α = [ µ - µ ] and α = 0. = X jk = X.. + [ X.. - X... ] + [ X j. - X.. ] + [ X jk - X j. ] algbrac dntty Assumptons Th Th b ar ndpndnt and dstrbutd Normal(0, ) ()j ε ar ndpndnt and dstrbutd Normal(0, ) (j)k Th b ()j and ε (j)k ar mutually ndpndnt b

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 46 of 7 Total SSQ and ts Parttonng X jk = X.. + [ X.. - X... ] + [ X j. - X.. ] + [ X jk - X j. ] à [ X jk - X.. ] = [ X.. - X... ] + [ X j. - X.. ] + [ X jk - X j. ]. Squarng both sds and summng ovr all obsrvatons ylds (bcaus th cross product trms sum to zro!) I J n = j= k= [ X - X ] jk... I J n I J n I J n..... j... jk j. = j= k= = j= k= = j= k= = [ X - X ] + [ X - X ] + [ X - X ] I I J I I n..... j... jk j. = = j= = j= k= = Jn [ X - X ] + n [ X - X ] + [ X - X ]

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 47 of 7 Analyss of Varanc Tabl Sourc df a Sum of Squars E (Man Squar) F Du tratmnt ( I- ) Jn ( X.. -X...) I = + n b + Jn I = α ( I-) F= MSQ MSQ df = (I-), I(J-) tratmnt wthn tratmnt among sampls Wthn tratmnt Among sampls I J I (J-) n ( Xj. -X..) = j= + n b MSQ F= wthn tratmnt among sampls MSQ rsdual df = (J-), IJ(n-) Rsdual IJ(n-) I J n ( X jk - Xj. ) = j= k= Total IJn a dgrs of frdom I J n ( Xjk -X... ) = j= k= Not: Th corrct F tst for tratmnt has n th dnomnator th man squar for wthn tratmnt among sampls. Ths can b apprcatd as th corrct dfnton by lookng at th xpctd man squars.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 48 of 7 Appndx Rfrnc Cll Codng vrsus Dvaton from Man Rfrnc cll codng and dvaton from man codng ar two ways of xprssng th sam modl. In analyss of varanc, w us dvaton from man. In rgrsson, oftn, w usd rfrnc cll. Each paramtrzs group dffrncs n mans wthout th us of an xplct functonal form (such as a lnar modl); that s, th chang n man rspons wth chang n group s compltly gnral or modl fr. Dvaton from man. Good whn cll sampl szs ar qual Prmts straghtforward parttonng of sums of squars Good for undrstandng analyss of varanc Rfrnc cll codng. Espcally good whn cll sampl szs ar NOT qual Prmts straghtforward ntrprtaton of stmatd btas Illustraton for th ONE WAY Analyss of Varanc Dvaton from mans µ = µ + (µ - µ) τ µ µ = µ + (µ - µ) τ = µ + τ for = to K µ Rfrnc cll codng. µ K µ = β + β (Indcator for Group "") 0 = β µ

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 49 of 7 Appndx Multpl Comparsons Adjustmnt Procdurs Opnons vary on th appropratnss of multpl comparsons adjustmnts. It s qut corrct to says that f many tsts ar prformd, thn th chancs of drawng an ncorrct nfrnc ncrass. Howvr, t s also tru that ovr th cours of a day, or a projct, or a yar, or a lftm, analysts prform many tsts. Undr what crcumstancs of multpl hypothss tsts s t ncssary to acknowldg and adjust for th prformanc of many statstcal tsts? An mportant consdraton n th prformanc of multpl hypothss tsts s to undrstand th corrct probablty modl framwork. For xampl - w somtms pursu a statstcal hypothss tst comparson aftr havng sn th data (hnc th trm data drvn ) and aftr havng notcd som group dffrncs. Ths s a post-hoc analyss stuaton. Th probablty modls whch wr approprat for th ovrall F tst may no longr b approprat. Ths confuss th thory of multpl comparsons adjustmnts. (For th ntrstd radr A mor approprat probablty modl framwork n ths stuaton utlzs th thory of ordr statstcs) Analyss of varanc s a sttng for whch th ssu of multpl comparsons s transparnt. Typcally th analyst bgns wth a global assssmnt to larn f thr s any dscrpancy among th group mans and thn procds to dntfy whr ths dscrpancs ar. In th analyss of varanc sttng, t s somtms suggstd that, wth rspct to th ssu of multpl comparsons, on should procd as follows µ µ... µ, at last rasonably so, basd on th ovrall F tst, IF K THEN thr s no nd to compar ndvdual mans. BUT IF at last som µ µ * basd on th ovrall F tst THEN, sur, go ahad and compar mans AND WHEN YOU DO, tak car to adjust for multpl comparsons. Othrs hav dffrnt vws. Ths scton s an ovrvw of th commonly ncountrd multpl adjustmnts procdurs.

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 50 of 7 Rcall that th manng of a typ I or II rror s basd on what s actually tru n natur: Typ I Error (α ) Typ II Error (β ) H O s tru W ncorrctly nfr H A H A s tru W ncorrctly nfr H O Th chancs of makng a mstak ncrass as th numbr of tsts prformd ncrass. Th lklhood of an ncorrct nfrnc ncrass w # tsts whn null s tru Svral tsts ar prformd, #=k Th tsts ar ndpndnt Th null hypothss s tru n vry tst Suppos ach tst utlzs a typ I rror=.05 rul. Thn Ovrall Typ I rror = - Probablty [ all accpt th null ] = - Pr[tst # accpts] x Pr[tst # accpts] x x Pr[tst #k accpts] = (.95) x (.95) x x (.95) = [.95] k # Indpndnt Tsts = k Ovrall Typ I Error = [.95] k 0 30.05.0975.403.7854 And th lklhood of an ncorrct nfrnc ncrass w # tsts whn th altrnatv s tru IF Thn Svral tsts ar prformd, #=k Th tsts ar mutually ndpndnt Th altrnatv hypothss s tru n vry tst Suppos that th powr to dtct th altrnatv s =.90 n vry cas. Ths mans that ach tst has typ II rror=.0. Ovrall Typ II rror = Probablty [ at last on ncorrct accptanc of th null ] = - Probablty [EVERY tst corrctly rjcts th null] = { prob[tst rjcts] x [prob[tst rjcts] x x prob[tst k rjcts] } = (.90) x (.90) x x (.90) = [.90] k

PubHlth 640 Sprng 05 7. Introducton to Analyss of Varanc Pag 5 of 7 # Indpndnt Tsts = k Ovrall Typ II Error.0.9 0.653 30.9576 Currntly avalabl multpl comparsons procdurs protct aganst typ I rror only. Thy afford no protcton aganst typ II rror. Scnaro # rcvs lttl attnton. On rason for ths s that th altrnatv hypothss rprsnts multpl possblts, thus rndrng stmaton of typ II rror dffcult. Anothr possbl rason s th opnon that t s wors to mak a typ I rror (rjctng th null hypothss by mstak) than to mak a typ II rror (rtanng th null hypothss by mstak). Scnaros # and # rprsnt xtrms that ar unlkly to occur n ralty. It s mor oftn th cas that th tsts prformd ar NOT ndpndnt and that only som of th H A ar tru whl th rmandr ar not.