Statalist


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

Re: st: predicting fitted values after ivtobit


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: predicting fitted values after ivtobit
Date   Wed, 6 Feb 2008 09:17:04 +0000 (GMT)

--- Maarten wrote:
> > Leave z as is, and manually replace all other variables with their
> > mean, than predict, than plot predicted value against z.

--- Alejandro Delafuente <[email protected]> wrote:
> Thanks Maarten, is this what you are suggesting then:
> 
> ivtobit remittance a b (z = d e), ll(0) first
> 
> foreach x in a b z {
>         sum `x' if e(sample)
>         gen `x'_bis = `x'
>         replace `x' = r(mean)
>        }
> predict remittance_predict, e(0,.) 
> twoway (scatter z_predict z, sort

No, leave z as is, means do NOT change it, i.e. it should NOT be part
of your -foreach- loop. I suggest you first run the example below as is
discussed here http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html#work
and than adapt it one step at a time to your problem.

Hope this helps,
Maarten

*------------------ begin example --------------------
webuse laborsup, clear
ivtobit fem_inc fem_educ kids (other_inc=male_educ), ll

// Notice that other_inc is NOT included
foreach var in fem_educ kids {
	sum `var' if e(sample), meanonly
	clonevar t`var' = `var'
	replace `var' = r(mean)
}

predict fem_inc_hat, ystar(10,.)
twoway line fem_inc_hat other_inc, sort

// return fem_educ and kids to their original values
foreach var in fem_educ kids {
	replace `var' = t`var'
	drop t`var'
}
compress
*------------------- 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/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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