Statalist


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

Re: st: predictions


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: predictions
Date   Fri, 7 Sep 2007 08:09:29 -0400

Johannes Geyer <JGeyer@diw.de>:

The most powerful way to compare predictions at different X values is
to add "fake" observations to the end of your data, and -predict- y
for those obs.

You can add four obs with

g byte real=1
set obs `=_N+4'

and -replace- each variable in X as appropriate, or

edit x* age*  in `=_N-3'/`=_N'

to type them in the Data Editor. If it is tedious to calculate all the
X variables from age and other primitives, you can put all those
calculations inside a little program to be run both on your real data
and any fake data you may append later. Then

predict yhat
li yhat x* age* in `=_N-3'/`=_N'

to see the predictions.  You will want to drop the obs after you're
done listing, graphing, whatever, so that you don't include as real
data in a subsequent regression.  You can

drop in `=_N-3'/`=_N'

but I find starting with making an indicator of real data safer and
easier, in which case you can just

drop if mi(real)
drop real

On 9/7/07, Johannes Geyer <JGeyer@diw.de> wrote:
> Dear all,
>
> I would like to estimate a linear model with several interactions:
>
> reg y age age2 age3 age4 x1 x2 x3 x4 age*x1 age*x2 .... age4*x3 age4*x4
>
> Then I would like to compare results for different x, i.e. I have four
> groups (and a base category) and they may differ in their age-profile. So
> far I used Excel to calculate different profiles but I it is very
> cumbersomely... That is why I am looking for a more convenient
> post-estimation command. (I think the spost package does something similar
> for categorical variables.) The problem arises because I do not want to
> compare at sample means.
>
> I would be happy if somebody had an idea which command could help,
>
> thank you
>
> regards
>
> Johannes
>
>
>
>
>
>
>
> ----------------------
> Johannes Geyer
> Deutsches Institut für Wirtschaftsforschung (DIW Berlin)
> German Institute for Economic Research
> Graduate Center
> DIW Berlin
> Mohrenstraße 58
> 10117 Berlin
> Tel: +49-30-89789-258
>
> *
> *   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/
>

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index