Announcement

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

  • cumulative summation of coefficient

    Hello statalists,

    I am trying to compute a tsset variable with observations equal to the cumulative summation of coefficients up to `i', i.e. φ0 for h = 0, φ0 + φ1 for h = 1, φ0 + φ1 + φ2 for h = 2, and so on.

    h=_n
    forvalues i=0/8 {
    qui reg F`i'.GDP_growth L(0/2).MPshock_CGK if t>=tq(1965q3) & t<=tq(2008Q4), r
    qui g GDP_response= _b[MPshock_CGK] if h==`i'
    }

    The above codes gives me the φi, unfortunately I don't know how to sum them up to `i', i.e. I need GDP_response be a time series as:
    t0 φ0
    t1 φ0 + φ1
    t2 φ0 + φ1 + φ2
    t3 φ0 + φ1 + φ2 + φ3
    t4 φ0 + φ1 + φ2 + φ3 + φ4

    Bests,

    ​​​​​​​G

  • #2
    Giacomo:
    I'd take a look at -lincom-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hello Carlo,

      I see that -lincom- is a command to compute linear combinations of coefficients of the same regression. However, here I need to compute 8 coefficients of 8 different regressions.

      Comment


      • #4
        Giacomo:
        have you considered -suest- or -sureg-?
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Carlo: actually -suest- is a command that could be usefull for my puposes, thanks!

          Giacomo

          Comment

          Working...
          X