Announcement

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

  • Can't Predict Out of Sample Using a Panel Spatial Autoregression for Prediction

    Hello all,
    I am currently trying to predict out-of-sample values after using a panel SAR. Here is the example code:


    spmatrix create contiguity W if tm == 1

    spxtregress y x

    predict y if e(sample) == 1 (In sample prediction)

    predict y2 if e(sample) == 1 (out of sample prediction)

    error: id() in time 13 is inconsistent with W

    As you can see, I can predict within the sample but not outside of it.

  • #2
    Originally posted by Frank Milbourn View Post
    spmatrix create contiguity W if tm == 1
    When you are creating your weighting matrix with this restriction, it is possible that not all units are observed. You should go back and pick a time period in which all units are observed.

    Code:
    xttab tm
    will tell you how many units are observed for each period.
    Last edited by Andrew Musau; 18 Dec 2022, 15:50.

    Comment

    Working...
    X