Announcement

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

  • Adding confidence intervals and standard error values on multiple regression expected value line

    Hi,
    I ran a multiple regression with three variables: yvar (continuous, dependent variable), xvar (continuous, independent variable), Hetero (dummy variable) and the interaction of xvar and Hetero (Heteroxvar). I created two graphs with the scatterplot of yvar and xvar given Hetero == 0 and Hetero == 1 and added the expected value lines in both cases. More specifically, I used the following code:

    Code:
    reg yvar xvar Hetero Heteroxvar
    scalar coeff1 = _b[xvar]
    scalar coeff2 = _b[Heteroxvar]
    scalar coeff3 = _b[Hetero]
    scalar constant = _b[_cons]
    scalar slope = coeff1 + coeff2
    scalar adder = constant + coeff3
    graph twoway (scatter yvar xvar if Hetero == 1) (function y = adder + slope*x, range(xvar)), name(interactiontermregression)
    graph twoway (scatter yvar xvar if Hetero == 0) (function y = constant + coeff1*x, range(xvar)), name(noninteractiontermregression)
    Does anyone know how can I add a confidence interval around the expected value lines? In addition, how can I write the value of the standard error of the coefficient on xvar on the graph? That is, I want to extract this standard error with e.g.

    Code:
     local SEvariable = _se[xvar]
    and then put a textbox on the graph or write on the borders of the graph something along the lines of "The standard error is equal to `SEvariable' ".
Working...
X