Announcement

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

  • Reporting lincom output in regression table using ESTTAB

    Hi,

    I have a regression table with four specifications. My independent variables are 2 indicator dummy variables (social and environmental) and their interactions.
    I also need to report their linear combinations:
    1. social + social*Env
    2. environmental + social*Env

    I have managed to get the ouptut in the following table using the estout command but would like the lincom results to be below the constant results ideally with dashed line separating these from constants and observations.
    I also need the srandard errors to be in brackets like the rest of the output and the stars to represent significance.

    Would anyone have some tips on how to figure out the above?

    Here is my code

    Code:
    eststo clear
    eststo: quietly reg Too_Cheap i.Soc##i.Env pc1 if mon == 1
    lincom _b[1.Soc] + _b[1.Soc#1.Env]
    estadd scalar soc_soc_env=r(estimate)
    estadd scalar soc_soc_envSE = r(se)
    lincom _b[1.Env] + _b[1.Soc#1.Env]
    estadd scalar env_soc_env=r(estimate)
    estadd scalar env_soc_envSE = r(se)
    
    eststo: quietly reg Cheap i.Soc##i.Env pc1 if mon == 1
    lincom _b[1.Soc] + _b[1.Soc#1.Env]
    estadd scalar soc_soc_env=r(estimate)
    estadd scalar soc_soc_envSE = r(se)
    lincom _b[1.Env] + _b[1.Soc#1.Env]
    estadd scalar env_soc_env=r(estimate)
    estadd scalar env_soc_envSE = r(se)
    
    eststo: quietly reg Exp i.Soc##i.Env pc1 if mon == 1
    lincom _b[1.Soc] + _b[1.Soc#1.Env]
    estadd scalar soc_soc_env=r(estimate)
    estadd scalar soc_soc_envSE = r(se)
    lincom _b[1.Env] + _b[1.Soc#1.Env]
    estadd scalar env_soc_env=r(estimate)
    estadd scalar env_soc_envSE = r(se)
    
    eststo: quietly reg Too_Exp i.Soc##i.Env pc1 if mon == 1
    lincom _b[1.Soc] + _b[1.Soc#1.Env]
    estadd scalar soc_soc_env=r(estimate)
    estadd scalar soc_soc_envSE = r(se)
    lincom _b[1.Env] + _b[1.Soc#1.Env]
    estadd scalar env_soc_env=r(estimate)
    estadd scalar env_soc_envSE = r(se)
    
    
    esttab, scalars(soc_soc_env soc_soc_envSE env_soc_env env_soc_envSE) ar2 se, using regression.doc, replace varwidth(20) label nobaselevels nogaps title({Table 1.} {Regression Output for VW series}) ///
    nonumbers mtitles("Too Cheap" "Cheap" "Expensive" "Too Expensive") addnote("Source: merged.dta")
    eststo clear

  • #2
    Hi
    Your code is quite elaborate.

    Consider this code based on a foreach-loop and the use of matrices as containers.
    Code:
    capture matrix drop tbl
    foreach var of varlist Too_Cheap Cheap Exp Too_Exp {
      qui reg `var' i.Soc##i.Env pc1 if mon == 1
      qui lincom _b[1.Soc] + _b[1.Soc#1.Env]
      matrix row = r(estimate), r(se), (r(p) < 0.05) + (r(p) < 0.01)
      qui lincom _b[1.Env] + _b[1.Soc#1.Env]
      matrix row = row, r(estimate), r(se), (r(p) < 0.05) + (r(p) < 0.01)
      matrix rownames row = `var'
      matrix tbl = nullmat(tbl) \ row
    }
    matrix colnames tbl = mean1 se1 stars1 mean2 se2 stars2
    matlist tbl
    It is not exactly what you asked for, but maybe the code is to some help anyway
    Last edited by Niels Henrik Bruun; 02 Feb 2023, 07:15.
    Kind regards

    nhb

    Comment


    • #3
      xlincom from SSC could help here.

      Code:
      webuse gxmpl1
      reg gnp L(0/2).cpi
      xlincom (t = cpi) (t1 = cpi + l1.cpi) (t2 = cpi + l1.cpi + l2.cpi), repost
      esttab, eqlabels("Main" "Sum of coefficients", span)

      Comment

      Working...
      X