Announcement

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

  • spwmatrix gecon

    Hi all,

    I want to create a spatial weight matrix using commnd spwmatrix, while I get the error:

    Spherical latitudes must be in [-90,90]

    Then I put in the command:
    Code:
    sum latitude
    However the result is [-36.3,64.1]. I don't figure out why the error happended. This is the data:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(longitude latitude) int id
                69.11            34.29   1
                19.49            41.18   2
                 3.08            36.42   3
                13.15             -8.5   4
                  -60            -36.3   5
                44.31             40.1   6
               149.08           -35.15   7
                16.22            48.12   8
                49.56            40.29   9
                 50.3             26.1  10
                90.41            23.81  11
                 27.3            53.52  12
                 4.21            50.51  13
               -88.75            17.25  14
                 2.42             6.23  15
                -68.1            -16.2  16
                18.41            43.86  17
                25.57           -24.45  18
               -47.55           -15.47  19
                  115             4.52  20
                 23.2            42.45  21
                -1.51            12.37  22
                29.18            -3.16  23
               104.55            11.33  24
                11.35              3.5  25
               -75.42            45.27  26
               -23.51            14.93  27
     18.5549222819816 4.39651006534511  28
                14.59             12.1  29
                -70.4           -33.24  30
                116.2            39.55  31
    -74.0776064620728 4.71945636042059  32
                    .                .  33
                    .                .  34
    -84.0910297975204 9.92996391640346  35
                15.58             45.5  36
               -82.22            23.08  37
                33.25             35.1  38
     14.4189245589111 50.0939569951817  39
                    .                .  40
    -5.29590171586637 6.81708459268891  41
    -89.2240071966989 13.7023164166501  42
                12.34            55.41  43
                 42.2            11.08  44
                    .                .  45
               -78.35             -.15  46
                31.14            30.01  47
     8.77898331482706 3.75516325764787  48
                38.55            15.19  49
                24.48            59.22  50
                38.42             9.02  51
                178.3           -18.06  52
                25.03            60.15  53
                  2.2             48.5  54
                 9.26              .25  55
                -16.4            13.28  56
                 44.5            41.43  57
                    .                .  58
                13.25             52.3  59
                 -.06             5.35  60
                23.46            37.58  61
               -90.22             14.4  62
               -13.49             9.29  63
               -15.45            11.45  64
               -58.12              6.5  65
                -72.2             18.4  66
               -87.14            14.05  67
                19.05            47.29  68
               -21.57             64.1  69
                77.13            28.37  70
               106.49            -6.09  71
                 51.3            35.44  72
                 44.3             33.2  73
                -6.15            53.21  74
                35.12            31.47  75
                12.29            41.54  76
                -76.5               18  77
     139.771757191407 35.6837804087879  78
                35.52            31.57  79
                 71.3             51.1  80
                36.48            -1.17  81
                    .                .  82
                    .                .  83
     21.1637049395701 42.6552659965988  84
                   48             29.3  85
                74.46            42.54  86
               102.36            17.58  87
                24.08            56.53  88
                35.31            33.53  89
                 27.3           -29.18  90
               -10.47             6.18  91
     13.1802862985563 32.8955738129876  92
                25.19            54.38  93
                 6.09            49.37  94
                47.31           -18.55  95
                33.48              -14  96
               101.41             3.09  97
                -7.55            12.34  98
                14.31            35.54  99
                 57.3            -20.1 100
    end
    Thank you for your advice!

  • #2
    This is the command:

    Code:
     spwmatrix gecon latitude longitude, wname(weight) wtype(inv) alpha(1) rowstand
    And I find that a small sample of the data can get a result under this command but the whole data can't. There might be some problems in data, but I can't see why.

    Comment


    • #3
      In the Stata world, missing is greater than 90. Don't believe it? Ask Stata:

      Code:
      assert 90>=.
      Res.:

      Code:
      . assert 90>=.
      assertion is false
      r(9);
      
      .
      So drop missing values and you should be good to go.

      Comment


      • #4
        Originally posted by Andrew Musau View Post
        In the Stata world, missing is greater than 90. Don't believe it? Ask Stata:

        Code:
        assert 90>=.
        Res.:

        Code:
        . assert 90>=.
        assertion is false
        r(9);
        
        .
        So drop missing values and you should be good to go.
        That's it! Thank you so much!

        Comment

        Working...
        X