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 on April 23, and its replacement, 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" <>
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.


On Fri, Apr 15, 2011 at 12:51 PM, Nick Cox <> 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
> <> 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:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index