/******************* power.do Example file demonstrating increase in power from multiple imputation Written by Russell Dimond, Summer 2012 for the Social Science Computing Cooperative at UW-Madison ********************/ clear all set more off // generate random data // x1-x10 drawn independently from standard normal distribution // y is sum of x's, plus normal error term set obs 1000 set seed 17 forval i=1/10 { gen x`i'=invnorm(runiform()) } egen y=rowtotal(x*) replace y=y+8*invnorm(runiform()) // drop values at random forval i=1/10 { replace x`i'=. if runiform()<.1 } // complete cases analysis reg y x* // run the imputation models to see how they perform // note the low R-squared values unab vars: * foreach x of varlist x* { local xvars: list vars - x reg `x' `xvars' } // impute mi set wide mi register imputed x* mi register regular y mi impute chained (regress) x*=y, add(10) // results after multiple imputation mi estimate: reg y x*