Created
May 7, 2019 14:36
-
-
Save bbdaniels/5c91085d75af336db49416e51e57a62b to your computer and use it in GitHub Desktop.
Power estimates for clustered samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Power calcs start here | |
sum l_household_income_total if (treatment == 0 & round == 1) | |
local mean1 = r(mean) //mean in control | |
local sd1 = r(sd) //SD in control | |
sum l_household_income_total if ((treatment == 1 | treatment == 2) & round == 1) | |
local mean2 = r(mean) //mean in AFSP | |
local sd2 = r(sd) //SD in AFSP | |
loneway l_household_income_total hhid_dvdc //--> 0.13 | |
local rho = r(rho) // intra-cluster correlation | |
local obsclus = 10 | |
local ratio = 1 | |
reg l_household_income_total bl_w_total_income | |
local r0 = _b[bl_w_total_income] | |
local r1 = `r0' | |
local r01= `r0' | |
//r0 is supposed to be correlation btw pre-T rounds | |
//r1 is supposed to be correlation btw post-T rounds | |
//r01 is supposed to be correlation btw pre and post | |
//Assuming all 3 to be equal for simplicity | |
local pre = 1 // Number of pre-treatment rounds | |
local post = 2 // Number of post-treatment rounds | |
di "mean1: `mean1' mdes rho: `rho' gamma: `r0'" | |
//Going to look for samp sizes for a number of potential effect sizes. The mean log-income is about 11.5, so going to work on that basis. | |
foreach effect in 1 1.5 2 2.5 3 3.5 4 4.5{ | |
qui { | |
local mdes = `effect' // MDES | |
di "mdes = " `mdes' | |
local mean2 = `mean1' + `mdes' | |
sampsi `mean1' `mean2', sd1(`sd1') sd2(`sd2') ratio(`ratio') pre(`pre') post(`post') r0(`r1') r1(`r1') r01(`r01') method(ancova) | |
} | |
di `effect' | |
sampclus, rho(`rho') obsclus(`obsclus') | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment