Announcement

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

  • spregress unable to find weighting matrix

    Dear Statlists,
    I am working spregress. I was able to build the spatial weighting matrix by using the following command:
    Code:
    spmat contiguity W using regions_shp.dta, id(_ID)
    warning: spatial-weighting matrix contains 12 islands
    however, when I try to run the code for the regression I get an error message:
    Code:
    spregress SI_nuovo log_gdp_2008_percap log_tertiary_2008 patent_app_pc_2008 agri_2008 indu_2008 EQI_2010, gs2sls dvarlag(W)
    weighting matrix W not found
    Any suggestions about this? Is there an intermediate step that I am not doing?
    Thank you and best regards,

  • #2
    I think this will tell you if the matrix was created.

    Code:
    spmat summarize W, links

    Comment


    • #3
      Originally posted by George Ford View Post
      I think this will tell you if the matrix was created.

      Code:
      spmat summarize W, links
      Dear George, thank you for your feedback.
      The matrix seems to actually exist. When I run the code you suggested I get the following:
      Code:
      spmat summarize W, links
      
      Summary of spatial-weighting object W
      --------------------------------------
              Matrix |          Description
      ---------------+----------------------
          Dimensions |            209 x 209
           Stored as |            209 x 209
       Links         |
               total |                  890
                 min |                    0
                mean |             4.258373
                 max |                   11
      --------------------------------------
      warning: spatial-weighting matrix contains 12 islands

      Comment


      • #4
        I've had similar issues. It could be missing data. The W matrix has to be the exact size of the sample used in estimation. One missing observation throws the whole thing off.

        Comment


        • #5
          Hello Chiara,

          It looks like you are mixing the user-written spmat command with Stata's spregress. Make sure to use Stata's spmatrix command if you want to use spregress.

          Comment

          Working...
          X