Skip to content

ENH: predict, get_prediction with log or transformed endog #2791

Open

Description

@josef-pkt

How do we get prediction and similar for models with transformed endog?
example log(y) ~ ... estimated with OLS

related to issue #1449 #1480
also related: use Poisson instead, several articles and FAQ
also GLM-Gamma is close to lognormal model

specific point: correcting the prediction of the original so we get E(y | x) or E(y | ?) for population.
We have an explicit expression for the correction under lognormality assumption.
in general we can use a smearing estimate

(I went through this some time ago, but don't know where the functions are. I don't see a specific issue. I just bumped into this blog again.)
see for example http://davegiles.blogspot.ca/2014/12/s.html
In equation (3) he uses the average exp residuals.
AFAIR, I averaged over sample x_i, which might (!) be somewhere in Wooldridge.

It's not clear yet how to connect this to the models (especially we don't know which transformation the user has used), but we can provide at least some helper function.
It fits most likely in the topic of various predict functions and methods. (PR #2296 )

Activity

  1. josef-pkt commented on Mar 16, 2016

    @josef-pkt
    MemberAuthor

    see also documentation for Stata boxcox postestimation: smearing is over the estimated residuals for each given exog.

    Stata cites the next reference. I only read parts of the second referency joint with Hausman

    Abrevaya, Jason. 2002. “Computing Marginal Effects in the Box–Cox Model.” Econometric Reviews 21 (3): 383–93. doi:10.1081/ETC-120015789.

    Abrevaya, Jason, and Jerry A. Hausman. 2004. “Response Error in a Transformation Model with an Application to Earnings-Equation Estimation*.” Econometrics Journal 7 (2): 366–88. doi:10.1111/j.1368-423X.2004.00135.x.

  2. josef-pkt commented on Mar 16, 2016

    @josef-pkt
    MemberAuthor

    question: Does smearing of estimated residuals really make much sense if there is heteroscedasticity, as in Poisson models, or log-linear if the distribution does not correspond to log-normal?

    e.g. variance as function of mean (mu) or of exog is mis- or unspecified.

    update: smearing in this way doesn't work with heteroscedasticity
    Google search finds several closely related items

    http://harris.uchicago.edu/sites/default/files/iHEA_Sydney_minicourse.pdf "Modeling Health Care Costs and Counts"
    slides that look like a good overview
    more recent version, Stata files and data
    http://econ.hunter.cuny.edu/parthadeb/teaching/health-econometrics-minicourse/

    slides of a talk https://courses.washington.edu/b572/TALKS/2013/ScottCoggeshall-1.pdf for the heteroscedastic case. there should be a article for it.

  3. changed the title [-]ENH: tools predict with log or transformed endog[/-] [+]ENH: predict, get_prediction with log or transformed endog[/+] on Nov 8, 2022
  4. josef-pkt commented on Nov 8, 2022

    @josef-pkt
    MemberAuthor

    before I mainly looked at this for mean prediction, mean or plim

    However, we also need inference, that is get_prediction

    https://stats.stackexchange.com/questions/594806/determine-uncertainty-of-regression-prediction-with-logged-explanatory-and-respo

    I don't know what's currently the quickest way to get params_table or prediction table with inference for this
    I went through this recently in the context of margins, nonlinear prediction where both endog and an exog could be transformed nonlinearily

    #7833 (comment)
    #5387

    we can do it generically with _get_wald_nonlinear
    but for the special case of "mean" prediction of transformed endog we could add bias correction, parametric or smearing.
    I'm not sure whether this bias correction should affect asymptotic standard errors and confint (I guess we can keep se unchanged and shift the confint)

    bump for 0.15 together with nonlinear prediction methods

  5. added this to the 0.15 milestone on Nov 8, 2022
  6. josef-pkt commented on Mar 12, 2025

    @josef-pkt
    MemberAuthor

    a reference found by chance

    Taylor, Jeremy M. G. 1986. “The Retransformed Mean After a Fitted Power Transformation.” Journal of the American Statistical Association 81 (393): 114–18. https://doi.org/10.2307/2287976.

    It includes an approximation to the retransformed mean for Box-Cox transformation (for lambda not close to zero, i.e. away from log tranform)
    comparison to smearing estimate in Monte Carlo
    (based on very brief skimming.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions