Announcement

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

  • Test sum of regression coefficients

    Having a hard time finding how to do this in Stata: test the sum of coefficients from a linear regression. The problem is that I have many coefficients, I want to avoid writing the whole equation:
    Ho) a1+a2+...+an = 0.

    Any suggestions?

  • #2
    Well, you either have to write out the whole equation or you have to write a loop that writes the equation. If the names of the coefficients are really systematic, like a1, a2, a3, ..., a12 (as an example), then it's:

    Code:
    local to_test a1
    forvalues i = 2/12 {
        local to_test `to_test' + a`i'
    }
    lincom `to_test'
    Evidently you need to modify this to use the actual names of the coefficients.

    If the coefficient names are not systematic, then there is really no more efficient way of doing this than just writing out the whole thing.

    Comment


    • #3
      While Clyde's solution works if you have the variables labelled sequentially, for the less adept at Stata, it is often easier to do a little text editing than to debug. You must have the variables listed somewhere to generate the regression, so copy them then do a replace of spaces with space + space (you can use a editor like Word if you find it easier).

      Comment

      Working...
      X