Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compute level predictions from log-dependent-variable regression with with endogenous covariate and sample selection

    Dear all,

    I am using eregress in Stata 15 to estimate a linear regression, with an endogenous covariate and sample selection. The dependent variable is in logs. My question is how one can correctly predict the levels of the dependent variable in this kind of models.

    Cameron and Trivedi (2009) discuss how one can perform predictions when the dependent variable is in logs after regress and after heckman. I wonder if it is correct to adopt the solution they suggest after heckman in my case, i.e. after eregress with endogenous covariate and sample selection. An implementation of this is offered below taking advantage of margins expression option.

    Any suggestion is more than welcome.

    Thank you in advance,
    Nikos

    Cameron, A.C. Trivedi, P., 2009. Microeconometrics using Stata. Stata Press.

    Code:
    webuse womenwk , clear
    gen s = !missing(wage)
    gen lny = ln(wage)
    
    
    version 15.1
    //==> Heckman model
    eregress lny education age, select(s = children education age)
    // Pr(y)
    margins, expression(exp(predict(xb) + 0.5*((sqrt(_b[/:var(e.lny)]))^2))*(1 - normal(-predict(xb eq(s))-(_b[/corr(e.s,e.lny)])*(sqrt(_b[/var(e.lny)]))^2)))
    // Pr(y|s=1)
    margins, expression((exp(predict(xb) + 0.5*((sqrt(_b[/:var(e.lny)]))^2))*(1 - normal(-predict(xb eq(s))-(_b[/corr(e.s,e.lny)])*(sqrt(_b[/var(e.lny)]))^2)))/(predict(pr eq(s))))
    
    
    // Heckman model with endogenous variable
    eregress lny education age, endogenous(education = married children age , nomain) select(s = children education age)
    // Pr(y)
    margins, expression(exp(predict(mean) + 0.5*((sqrt(_b[/:var(e.lny)]))^2))*(1 - normal(-predict(xb eq(s))-(_b[/corr(e.s,e.lny)])*(sqrt(_b[/var(e.lny)]))^2)))
    // Pr(y|s=1)
    margins, expression((exp(predict(mean) + 0.5*((sqrt(_b[/:var(e.lny)]))^2))*(1 - normal(-predict(xb eq(s))-(_b[/corr(e.s,e.lny)])*(sqrt(_b[/var(e.lny)]))^2)))/(predict(pr eq(s))))
Working...
X