Edit confidence interval in Stata coefplot

824 views Asked by At

I am using the coefplot command in Stata to plot coefficients and confidence intervals from multiple regression models. I am plotting the same coefficient (X) from 4 different model specifications.

There is one model specification (alternative standard errors) that I cannot figure out how to estimate in Stata, but am able to estimate using R. That means that for one model specification, I have the standard error in R, but not in Stata.

Is there an easy way to manually alter the standard errors in coefplot?

My code is:

coefplot A B C D, drop(_cons) xline(0) keep(X)

How can I add to this code that the standard errors for coefficient X in model D should be Z?

1

There are 1 answers

1
Jonathan Old On BEST ANSWER

You can manually edit the e(V) (variance-covariance matrix) and e(b) vectors. For this, define a program:

est restore estimates1

 capture program drop changeeV
 program changeeV, eclass
   tempname b V 
   matrix `b' = e(b)
   matrix `V' = e(V)
   matrix `V'[1,1] = 1.1 // Add values of new variance-covariance matrix
   matrix `b'[1,1] = 10 // Add new coefficient vector
   ereturn post `b' `V' // Repost new vectors 
   ereturn local cmd "reg outcome treatment covariates"
          // Repost initial command (required)
 end
changeeV // Execute program

est store eaX  // Store new generated estimtes

Note that, to reach the covariance matrix, you need to take the square of the standard errors from your output in R. Good luck!