Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: levpredict after areg


From   "Dimitriy V. Masterov" <dvmaster@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: levpredict after areg
Date   Fri, 15 Apr 2011 13:22:26 -0400

My apologies for forgetting to mention the origins of levpredict.

Consider this silly model:
/*************************************************/
sysuse auto, clear

foreach var of varlist price weight length {
	gen l`var'=ln(`var')
}

areg lprice lweight llength, absorb(rep78)
set trace on
levpredict pricehat1
set trace off

reg lprice lweight llength i.rep78

levpredict pricehat2

compare pricehat*
/*************************************************/

-areg- estimates a model where y = xb + d_absorbvar + e. I would like
to include both the effect of weight and length as well as the
relevant dummy for repair record in my prediction. From my
interpretation of the trace output, levpredict is only calculating the
xb part.

Unfortunately, I can't seem to get the second option to work in a
reasonable amount of time. areg takes about 5 minutes to run with my
data, while reg has been at it for most of the afternoon.

DVM


On Fri, Apr 15, 2011 at 12:51 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> -levpredict- is from SSC. Please remember...
>
> I don't know why intuition is invoked here. You can look at the code,
> and it's a short but sweet program. -levpredict- is indifferent to
> quite what lies beyond the fitted and residual values.
>
> In any case, what do you mean by "including the effect of the absorbed
> variable"?
>
> Nick
>
> On Fri, Apr 15, 2011 at 5:42 PM, Dimitriy V. Masterov
> <dvmaster@gmail.com> wrote:
>> I am estimating a model using -areg- where the dependent variable is
>> logged. I was hoping to use -levpredict- to transform my prediction
>> back to levels and I would like include the effect of the absorbed
>> variable. My intuition is that levpredict is just using the xb fitted
>> values and omitting d_absorbvar. Is there a way to do this?
>>
>> I tried to estimate the model using reg with a large set of factor
>> variable created dummies, but this seems a whole lot slower than areg.
> *
> *   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/
>

*
*   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   |   Site index