Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: st: RE: st: correction of some data by age group andfor years:


From   carmen gamarra <carmengamarra@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: st: RE: st: correction of some data by age group andfor years:
Date   Mon, 4 Aug 2008 20:51:26 +0000

I am with your example that will create a multiply imputed dataset, I will read it calmly and attention to see if it play with my data, seems well dificl but what I will try.

Thank you very much for your time and dedication.



> Date: Mon, 4 Aug 2008 20:55:23 +0100
> From: maartenbuis@yahoo.co.uk
> Subject: Re: st: RE: st: RE: st: correction of some data by age group and for years:
> To: statalist@hsphsun2.harvard.edu
>
> --- carmen gamarra  wrote:
>> Now I wonder: could you help me in relation to commands in STATA to
>> make a sensible multiple imputation models? I did the corrections
>> using excel, but I'd like to use the STATA? I actually I just like to
>> know the commands that I use in STATA.
>
> Below is an example that will create a multiply imputed dataset that
> can be used by -mim-, see -findit mim-. I use -bsample- to make sure
> that the proportions I use are sampled from the sampling distribution
> of the proportions, in order to create what Rubin termed `proper'
> imputations. The use of -uniform()- is discussed in M.L. Buis (2007),
> "Stata tip 48: Discrete uses for uniform()", The Stata Journal, 7(3),
> pp. 434-435. http://home.fsw.vu.nl/m.buis/wp/discrete.html
>
> Notice that -ice- is easier to use, and more general, so I would use
> -ice- instead of trying to adapt this code to your problem.
>
> -- Maarten
>
> *------------------ begin example --------------------
> tempfile imp base
> sysuse nlsw88, clear
> replace married = 2 if uniform() < .25
> label define marlbl 2 "unknown", add
> label value married marlbl
> gen long _mi = _n
> gen byte _mj = 0
> save `imp'
> save `base'
>
> forvalues i = 1/5 {
> use `base', clear
> bsample
> drop if married == 2
> gen pr1 = married == 1
> collapse (mean) pr1, by(age)
> sort age
> tempfile pr
> save `pr'
>
> use `base', clear
> sort age
> merge age using `pr'
> replace married = uniform() < pr1 if married == 2
> replace _mj = `i'
> drop pr1 _merge
> append using `imp'
> save `imp', replace
> }
> use `imp', clear
> sort _mj _mi
> *------------------------ end example ---------------------
> (For more on how to use examples I sent to the Statalist, see
> http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
>
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room Z434
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
> __________________________________________________________
> Not happy with your email address?.
> Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/

_________________________________________________________________
Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest
http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index