// MI Example 3
use "https://statisticalhorizons.com/wp-content/uploads/hip.dta", clear
drop if wave == 4 // Not sure these are the correct data
xtset sid
preserve
drop if missing(cesd, srh, adl, walk, pain)
bysort sid: drop if _N < 3
eststo clear
eststo: xtreg cesd srh walk adl pain ib3.wave, fe
restore
preserve
eststo: xtreg cesd srh walk adl pain ib3.wave, fe
restore
preserve
mi set mlong
mi register impute cesd srh walk adl pain wave
mi impute mvn cesd srh walk adl pain wave, ///
add(10) burnin(500) burnbetween(30)
eststo: mi estimate, post: xtreg cesd srh walk adl pain ib3.wave, fe
restore
preserve
reshape wide adl pain srh walk cesd, i(sid) j(wave)
mi set mlong
mi register impute cesd* srh* walk* adl* pain*
mi impute mvn cesd* srh* walk* adl* pain*, ///
add(10) burnin(500) burnbetween(200)
mi reshape long adl pain srh walk cesd, i(sid) j(wave)
eststo: mi estimate, post: xtreg cesd srh walk adl pain ib3.wave, fe
restore
// Table 6.4
esttab, wide se nonumbers mtitle("LD by person" "LD by person-wave" "MI by person-wave" "MI by person")
Showing posts with label mi estimate. Show all posts
Showing posts with label mi estimate. Show all posts
Feb 15, 2018
Multiple imputation of longitudinal data
This allows replicating the third example in Allison (2002, pp. 74-76).
Labels:
esttab,
mi estimate,
mi impute,
mi reshape,
Missing values,
Textbooks,
xtreg
Feb 13, 2018
Using additional variables in multiple imputation
This allows replicating Table 6.2 in Allison (2002).
// Table 6.2
use "https://statisticalhorizons.com/wp-content/uploads/college.dta", clear
mi set mlong
mi register imputed csat act gradrat
eststo clear
eststo: regress csat
// Impute using ACT
mi impute mvn csat act, ///
add(5) burnin(500) burnbetween(200) emlog emoutput
eststo: mi estimate, post: regress csat
// PCT25 is missing altogether in the data
// Impute using ACT and GRADRAT
mi impute mvn csat act gradrat, ///
add(5) burnin(500) burnbetween(200) emlog emoutput
eststo: mi estimate, post: regress csat
esttab, not se mtitle("No imputation" "ACT" "ACT and GRADRAT") nonumbers ///
coeflabel(_cons "Mean") modelwidth(15) title("Mean (and standard errors) of CSAT with different variables used in imputation")
Reference
Allison, Paul D. 2002. Missing Data. Sage. doi: 10.4135/9781412985079
Labels:
esttab,
mi estimate,
mi register,
mi set,
Missing values,
Textbooks
Feb 12, 2018
Interactions in multiple imputation
This replicates the analyses for Table 6.1 for Allison (2002).
// Table 6.1
// Method 1
use "https://statisticalhorizons.com/wp-content/uploads/college.dta", clear
mi set mlong
mi register imputed gradrat csat private lenroll stufac rmbrd act
mi impute mvn gradrat csat private lenroll stufac rmbrd act, ///
add(5) burnin(500) burnbetween(200) emlog emoutput
eststo clear
eststo: mi estimate, post: regress gradrat lenroll i.private##c.csat stufac rmbrd
// Method 2
use "https://statisticalhorizons.com/wp-content/uploads/college.dta", clear
mi set mlong
mi register imputed gradrat csat lenroll stufac rmbrd act
mi impute mvn gradrat csat lenroll stufac rmbrd act, ///
add(5) burnin(500) burnbetween(200) emlog emoutput ///
by(private)
eststo: mi estimate, post: regress gradrat lenroll i.private##c.csat stufac rmbrd
// Method 3
use "https://statisticalhorizons.com/wp-content/uploads/college.dta", clear
generate privateXcsat = private * csat
mi set mlong
mi register imputed gradrat csat private lenroll stufac rmbrd act privateXcsat
mi impute mvn gradrat csat private lenroll stufac rmbrd act privateXcsat, ///
add(5) burnin(500) burnbetween(200) emlog emoutput
eststo: mi estimate, post: regress gradrat lenroll i.private csat privateXcsat stufac rmbrd
esttab, not p wide nostar noobs varlabel(_cons "Intercept") ///
order(_cons csat lenroll stufac 1.private rmbrd) ///
rename(privateXcsat 1.private#c.csat) varwidth(25) nobaselevels ///
title(Regression with interaction terms--three methods) ///
mtitle("Method 1" "Method 2" "Method 3") nonumbers
Reference
Allison, Paul D. 2002. Missing Data. Sage. doi: 10.4135/9781412985079
Labels:
esttab,
mi estimate,
mi impute,
mi register,
mi set,
Textbooks
Subscribe to:
Posts (Atom)