Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: predlog?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: predlog?
Date   Thu, 9 Oct 2003 11:07:39 +0100

lcrawley
 
> Can someone help me figure out how to best use "predlog".  
> The help page 
> says it" estimates, but does not display, the regression 
> implied by the
> varlist before calculating the predictions."  If I need to 
> calculate and 
> display percentage change after transforming coefficients 
> back from log 
> scale, will that command help?

-predlog- was written by Rich Goldstein (STB-29). 

I wrote on -predlog- on 30 Sept 2003. I'll 
repeat first some of my comments there which might well 
apply here: 

================= 
... if you want this, it is arguable
that you are better off with

. glm response covariate, link(log)
. predict predicted

There's a large literature in this field. The papers
of W.G. Manning in health economics are one valuable
resource. He is, or at least was, a member of Statalist.
=================

As for the question, percent change from what to what? 
I am not clear what you want to calculate 

As for suppressing the regression output, the 
central idea of -predlog- can be taken out of the 
code and modernised thus: 

gen log<response> = log(<response>)
regress log<response> <covariates>   
scalar rmse = e(rmse) 
predict yhatraw 
predict resid, res  
gen resid2 = exp(resid)
su resid2, meanonly 
scalar meanres = r(mean)
gen YHATRAW = exp(yhatraw)
la var YHATRAW "Straight Retransformation"
gen YHTNAIVE = exp(yhatraw+(rmse^2/2))
la var YHTNAIVE "Naive Retransformation"
gen YHTSMEAR = YHATRAW * meanres 
la var YHTSMEAR "Duan's Smearing Retransformation"

Taking similar code and putting it into 
a do file will let you see the output 
you want to see. Evidently you need to plug 
in your own names for <response> and <covariates>. 

Nick
[email protected]


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