Hi Ken. I recently did just this by editing the STATA
imputation files (to give them a m id tag), appending them (to convert into flong format), and then importing into STATA. Below is my code. NOTE: This was done in STATA 12.
Best,
Michelle
----
Michelle Phelps
Ph.D. Candidate
Sociology & Social Policy
Princeton University
www.princeton.edu/~phelps
****Appending imputed data sets****
* 1) Adding m terms to each file
use "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_0"
gen m=0
save, replace
clear
use "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_1"
gen m=1
save, replace
clear
use "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_2"
gen m=2
save, replace
clear
use "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_3"
gen m=3
save, replace
clear
use "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_4"
gen m=4
save, replace
clear
use "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_5"
gen m=5
save, replace
clear
* 2) Appending files together
use "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_0"
append using "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_1"
append using "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_2"
append using "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_3"
append using "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_4"
append using "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_5"
*Check
tab m
*Sorting
sort state year
* 3) Saving data (NOTE: Stata requires this step -- data must be saved before importing)
save "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_FINAL", replace
* 4) Importing into STATA as MI
mi import flong, m(m) id(state year) imputed(drug_arrest_rate_all_urb per_cap perc_foreign perc_leg_repub perc_urban prison_adm_tot prison_rel_tot prob_rate prob_tot unempl_ratio_blacktowht)
*NOTE: Use the "imputed" to note which variables had missing data. All imputed vars should be declared.
mi describe
mi varying
*See STATA help on the import command re: what these commands should produce if data are properly identified
* 5) XT models
*Setting data as MI time series
mi xtset state_no time
*Using MI xtreg
mi estimate: xtreg f.inc_rate crimerate drug_arrest_rate_all_urb p1524 fisc_cap lag10x_fiscap log_totexpend_percap ///
p_police p_welf perc_leg_repub repgov per_cap rtws south gini perc_black perc_hisp perc_foreign ///
perc_urban unempl_rate_total pov_rate statepop000 time time_sq if decade==1, re
drop m
*Saving
save "H:\AMELIA MI\Imputation Files\State Vars for AMELIA_FINAL", replace
Dear Amelia users
I'm using Amelia 2 in R to do the multiple imputation. I have
successfully run the imputation and saved them into Stata files. Is
there any way I can load the completed data sets back to Stata without
using the Clarify package? I am asking because Clarify does not
support models such as xtmixed, which I'd like to use for my analysis.
I'm also not sure whether I can just calculate the coefficients and
standard errors by hand when it comes to Multi-level models.
Thanks for your help,
Ken
--
Amelia mailing list served by HUIT
[Un]Subscribe/View Archive: http://lists.gking.harvard.edu/?info=amelia
More info about Amelia: http://gking.harvard.edu/amelia
Amelia mailing list
Amelia@lists.gking.harvard.edu
https://lists.gking.harvard.edu/mailman/listinfo/amelia