Announcement

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

  • Spatial Weight Matrix Error spwmatrix

    Hi all,

    I have successfully created a spatial weight matrix. I also was successful exporting the matrix as a txt file. See the result messages here:

    -Spatial weights matrix created as Stata object(s): winvsq.

    -Spatial weights matrix saved to .txt file, /Users/stevenarchambault/aquifer_wells_dtw/well_weight.txt, for use with other Stata packages.

    However, when I try to import the matrix, using the following code:

    spwmatrix import using /Users/stevenarchambault/aquifer_wells_dtw/well_weight.txt, wname(winvsq)

    I get this error:

    spwmatrix_CalcSPweightM(): 3301 subscript invalid
    <istmt>: - function returned error

    Does anybody know how I might trouble shoot this? My matrix is nearly 5000x5000.

    Thanks!






    Last edited by Steven Archambault; 23 Dec 2016, 12:02. Reason: Spatial Weight Matrix, spwmatrix

  • #2
    I have run into this same problem and have not been able to figure out what the problem is. my matrix is only 100x100, so I don't think it is a memory issue. I also tried changing the matrix's file name, thinking that it had something to do with the special characters there (underscores), but that did not help either. So, I just wanted to document that I had the same issue. If you've found a solution, I would love to hear about it.

    - JC

    Comment


    • #3
      Hello all,

      I ran across this thread, as I had the same problem. I contacted the author of the command (P. Wilner Jeanty) and he was kind enough to troubleshoot the problem for me. The problem with the spatial weight matrix that I was trying to import from Geoda was that the ID variable that I was using started at 0, instead of 1. Note that if you use a shape file directly from the Census Bureau, I think some of them use an identifying vairable (FID) that starts at 0. So, I fixed that and was able to import the matrix just fine with the spwmatrix command.

      Although I could have edited the gal file manually in Notepad or in Stata, I decided to just edit the shape file to create a new ID variable, using the old ID variable + 1 (I did it this in ArcMap), and then recreate the spatial weight matrix in Geoda.

      Hopefully this will help others with the same issue.

      Comment


      • #4
        Hi Mr Miller,
        Thanks for your explanations, I have the same problem to import spatial matrix. I would like you to help me. I am a beginner in Spatial Econometrics Panel Data with Stata. Indeed, I would like to import a spatial weight matrix with the command spwmatrix but unfortunately this generates an error. Here is the syntax command used:

        spwmatrix import using "C:\Users\Firmin\Desktop\matrice.csv", wn(W)

        And this shows me this error message.

        J(): 3300 argument out of range
        spwmatrix_CalcSPweightM(): - function returned error
        <istmt>: - function returned error

        For example in weightmatrix, a dataset is
        A B C D E F G H
        A 0 1 0 0 0 1 0 1
        B 1 0 1 0 1 1 0 1
        C 0 1 0 0 1 0 0 0
        D 0 0 0 0 0 0 1 0
        E 0 1 1 0 0 1 1 0
        F 1 1 0 0 1 0 0 0
        G 0 0 0 1 1 0 0 0
        H 1 1 1 0 0 0 0 0

        I have a panel of 8 countries and temporal data from 1990 to 2015.

        Thank you.

        Best regards,
        Firmin.
        Attached Files

        Comment

        Working...
        X