My mistake Maarten, the example below was not meant to include z in the foreach
loop.
Alejandro
In message <[email protected]>
[email protected] writes:
> --- 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/
--
Alejandro de la Fuente
Department of International Development/QEH
University of Oxford, Mansfield Road, Oxford OX1 3TB
Tel: 01865 281836
*
* 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/