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

Re: st: predicting fitted values after ivtobit

From   Maarten buis <>
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 <> 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
and than adapt it one step at a time to your problem.

Hope this helps,

*------------------ 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'
*------------------- end example ------------------------
(For more on how to use examples I sent to the Statalist, see )

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

Sent from Yahoo! Mail - a smarter inbox

*   For searches and help try:

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