20.4 Multilevel Power - Simplified 20.5 Simulation of Power Continuous response Set number of groups and number within groups. s σy2 σ2 SE(y ) = + α n J Recall split plot design and corCompSymm: 2 α ρ = σ2σ+σ 2 so let ni = m and y α q 2 σtotal SE(y ) = Jm [1 + (m − 1)ρ]. NYC example they pick ρ = 0.15. Reasoning? Stat 506 Gelman & Hill, Chapter 20 Quick & Dirty yjt ∼ N(αj + βj t, σy2 ) is the sqrt CD4% of children w/out zinc supplement. Using lmer we get σ by = 0.7, σ bα = 1.3, σ bβ = 0.7, ρb = 0.1, with means for intercepts and slopes of 4.8 and -0.5, respectively. Step 1: Does the fitted model generate data which looks like the original data? Fig 20.5. Step 2: Find sample size to detect a shift in mean for slope of +0.5 with 80% power atα = .05. nj = 7 for each kid. αj with correlation ρ and shift γ1β under Assume MVN for βj treatment. Stat 506 Gelman & Hill, Chapter 20 R function to simulate fake data βj ’s are data points – one per kid – with SD = .7. To detect a shift of ∆, we need σy2 2 · 2.8σ 2 2 · 2.8 2 2 J≥ = (σβ + )= ∆ ∆ SSX 2 · 2.8 ∆ 2 Build function taking J, K = 7 as inputs returns data matrix of fake data. Generate 1000 datasets, test each to see if H0 gets rejected. Keep track of rejection rate = power. power we need 130 kids. (0.72 + .7 × 1.13)2 = 150 Stat 506 Gelman & Hill, Chapter 20 Stat 506 Gelman & Hill, Chapter 20