Announcement

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

  • Storing vec coefficient

    Hi,

    I have tried to store the coefficient of the vec results.

    The code I used is as below.

    Code:
    use data_file, clear
    levelsof id, local(id)
    gen coefficient1 = .
    gen coefficient2 = .
    sort id date
    by id: gen time = _n
    xtset id time
    foreach c of local id {
        vec d.y d.x1 d.x2, lags(5), if id == `c'
        replace coefficient1 = _b[x1] if id == `c'
        replace coefficient2 = _b[x2] if id == `c'
    }
    The result indicates
    [x1] not found

    I am not sure what to put inside _b[x1], could someone kindly suggest please?
    Last edited by Chihiro Ogino; 20 Feb 2020, 23:11.

  • #2
    Use
    Code:
    vec, coefleg
    get the coefficient names.

    Of course, with vector error correction and lags you will have multiple equations and multiple coefficient based on x1 and x2.

    Comment


    • #3
      Thank you so much!

      Comment

      Working...
      X