Announcement

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

  • Panel data Spatial weights - spgen

    I am trying to generate spatial lagged variable for a panel data using the following code:

    Code:
    gen wvar_exp_75 =.
        forvalues i = 1980(10)2010 {
            spgen yvar if year == `i', lat(lat) lon(lon) swm(exp 0.75) dist(.) dunit(km) app
            replace wvar = yvar_e if year == `i'
            drop yvar_e
    }
    I am getting the following error: lon() must be within -180 to 180.

    But the longitude in my dataset goes from -180 to 179; the variable is stored as double (%9.0g).

    My data looks like this:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(lon yvar) float id double(t p)
    -180    .0111553558086116 1 . 0
    -180    .0120254920302367 1 . 0
    -180    .0153739964407522 1 . 0
    -180 3.17805712775318e-06 1 . 0
    -180    .0274206289399875 2 . 0
    end
    Any help/suggestions will be highly appreciated!

    Sincerely,

    Chiara

  • #2
    Dr. Kondo Keisuke (author of SPGEN) was kind enough to reply to my email. There was a bug, which has been fixed now!

    Chiara

    Comment

    Working...
    X