Announcement

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

  • SMA and SARMA models for Spatial Econometrics

    To see patterns of spatial distribution of error in production data, I have to perform a regression with SMA and SARMA models. The data is below:


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str7 CD_MUN str33 Município double(Latitude Longitude) int Ano float(lProduction lTotalTillage) int _ID double(_CX _CY) str33 NM_MUN str2 SIGLA_UF double AREA_KM2 byte _merge
    "5100102" "Acorizal"                                 -15.199491       -56.3701493 2006  8.017322  8.675222   1  -56.31803576052537 -15.177269347572569 "Acorizal"                          "MT"   850.763 3
    "5100201" "Água Boa"                               -14.0572665       -52.1615971 2006 11.152132 10.700026   2  -52.50025307405131 -13.977564266606636 "Água Boa"                         "MT"  7549.308 3
    "5100250" "Alta Floresta"                             -9.886111        -56.087222 2006  9.677647  8.772145   3   -56.3677085015132 -10.055804544827458 "Alta Floresta"                     "MT"   8955.41 3
    "5100300" "Alto Araguaia"                           -17.3139183       -53.2157003 2006 10.847063   10.4122   4  -53.46699680769031 -17.449504075864365 "Alto Araguaia"                     "MT"  5402.308 3
    "5100359" "Alto Boa Vista"                             -11.6739          -51.3878 2006  8.952722  7.757906   5  -51.75022344389769 -11.811502343869748 "Alto Boa Vista"                    "MT"  2248.414 3
    "5100409" "Alto Garças"                             -16.947562       -53.5299889 2006  11.96214 11.177998   6 -53.580939157514216   -16.8882416242314 "Alto Garças"                      "MT"  3858.153 3
    "5100508" "Alto Paraguai"                           -14.5054055       -56.4840012 2006  9.660492  8.983941   7  -56.66124171186436  -14.75979737533704 "Alto Paraguai"                     "MT"  1847.354 3
    "5100607" "Alto Taquari"                            -17.8340709       -53.2844274 2006 11.977698 10.723752   8  -53.29657364265147 -17.827206230304515 "Alto Taquari"                      "MT"  1436.582 3
    "5100805" "Apiacás"                                  -9.543889        -57.448889 2006 8.6333685  6.066108   9  -57.82599821155492  -8.758635833004735 "Apiacás"                          "MT" 20489.024 3
    "5101001" "Araguaiana"                               -15.716667            -51.85 2006  6.033151  7.606884  10  -51.80670519627334 -15.130288195114774 "Araguaiana"                        "MT"    6380.7 3
    "5101209" "Araguainha"                              -16.8593724       -53.0343861 2006  6.703825         .  11  -53.12127538252165 -16.750515378368284 "Araguainha"                        "MT"   675.231 3
    "5101258" "Araputanga"                              -15.4645725       -58.3482517 2006  7.797011  7.574045  12  -58.45910265825619  -15.25301626908964 "Araputanga"                        "MT"  1639.733 3
    "5101308" "Arenápolis"                             -14.4617866       -56.8436658 2006  8.122857  7.398174  13  -56.85934161098203 -14.507091018513233 "Arenápolis"                       "MT"   417.337 3
    "5101407" "Aripuanã"                                -10.172113        -59.454925 2006  9.188461  9.468542  14  -59.85630768985148 -10.179663940790038 "Aripuanã"                         "MT" 24678.135 3
    "5101605" "Barão de Melgaço"                         -16.2789          -55.9578 2006  7.459124  5.624018  15  -56.02952144464605 -16.810379188441335 "Barão de Melgaço"                "MT" 11374.872 3
    "5101704" "Barra do Bugres"                         -15.0643133       -57.1789938 2006 11.809958 10.500702  16 -57.559572190838466 -15.067759883087641 "Barra do Bugres"                   "MT"  5976.864 3
    "5101803" "Barra do Garças"                             -15.89        -52.256667 2006 10.387944 10.095346  17  -52.44274439676174 -15.363055206520071 "Barra do Garças"                  "MT"  8363.149 3
    "5101852" "Bom Jesus do Araguaia"                   -12.1723666        -51.504648 2006 10.323436 10.254884  18  -51.73947800015276 -12.217808976551934 "Bom Jesus do Araguaia"             "MT"  4266.636 3
    "5101902" "Brasnorte"                                   -12.155          -57.9789 2006 12.008122 11.472697  19   -57.9988367440737 -12.423103820486345 "Brasnorte"                         "MT" 15968.355 3
    "5102504" "Cáceres"                                 -16.183333        -57.666667 2006  10.28901  9.179572  20  -57.83360803824163 -16.537401689925552 "Cáceres"                          "MT"  24495.51 3
    "5102603" "Campinápolis"                              -14.5158           -52.895 2006  8.787923  8.780634  21 -53.128380900788216 -14.374608041591198 "Campinápolis"                     "MT"  5978.985 3
    "5102637" "Campo Novo do Parecis"                   -13.6521806       -57.8986482 2006 13.260242 12.749783  22  -57.93095334755364  -13.68829960669082 "Campo Novo do Parecis"             "MT"  9428.586 3
    "5102678" "Campo Verde"                             -15.5498535       -55.1729923 2006 13.249767 12.281263  23 -54.958086029644896 -15.344785322092953 "Campo Verde"                       "MT"  4770.631 3
    "5102686" "Campos de Júlio"                        -13.7186383       -59.2598693 2006 12.864604  12.08906  24   -59.1930544053875 -13.579846016688718 "Campos de Júlio"                  "MT"  6792.808 3
    "5102694" "Canabrava do Norte"                         -11.0539          -51.8308 2006  9.984089  10.57393  25  -51.82363386870563 -11.201583086620245 "Canabrava do Norte"                "MT"  3449.037 3
    "5102702" "Canarana"                                -13.5415868       -52.2763472 2006 11.709828  11.41179  26 -52.398915405797034 -13.329839414126925 "Canarana"                          "MT" 10855.181 3
    "5102793" "Carlinda"                                 -9.9709503       -55.8274321 2006  8.658739  7.772332  27  -55.83415924215409  -10.10638308543036 "Carlinda"                          "MT"  2421.788 3
    "5102850" "Castanheira"                              -11.132778        -58.602778 2006  8.276559  7.129298  28 -58.602797236353304 -10.940726038839813 "Castanheira"                       "MT"  3713.466 3
    "5103007" "Chapada dos Guimarães"                   -15.460833            -55.75 2006 10.639653  9.270212  29  -55.55214645024638  -15.12100901357706 "Chapada dos Guimarães"            "MT"  6603.252 3
    "5103056" "Cláudia"                                    -11.515          -54.8908 2006  10.46853 10.839365  30  -55.04769829710479  -11.44815466636803 "Cláudia"                          "MT"  3843.561 3
    "5103106" "Cocalinho"                                  -14.3969          -50.9958 2006  8.014261  7.290293  31 -51.148446233171384  -13.86982300618364 "Cocalinho"                         "MT" 16563.136 3
    "5103205" "Colíder"                                -10.8045299       -55.4560027 2006  7.969949  9.443989  32  -55.46858408111061 -10.630984871126461 "Colíder"                          "MT"  3112.091 3
    "5103254" "Colniza"                                    -9.54389         -57.44889 2006  10.63428  9.796125  33  -60.30419381146491  -9.292440664844445 "Colniza"                           "MT" 27960.237 3
    "5103304" "Comodoro"                                     -13.65        -59.783333 2006 10.983845  10.70983  34  -59.75136486495116  -13.19366522302567 "Comodoro"                          "MT" 21485.018 3
    "5103353" "Confresa"                                   -10.6439          -51.5689 2006 10.901003  9.448569  35  -51.69857253382331 -10.404166625127791 "Confresa"                          "MT"  5802.314 3
    "5103361" "Conquista D'Oeste"                          -14.5578          -59.5719 2006  8.022112  7.205635  36  -59.33223622057129 -14.634682022705455 "Conquista D'Oeste"                 "MT"  2684.676 3
    "5103379" "Cotriguaçu"                                -9.85778          -58.4139 2006  9.126931    9.0524  37  -58.67515455546982  -9.537854004730054 "Cotriguaçu"                       "MT"  9469.957 3
    "5103403" "Cuiabá"                                 -15.5951004       -56.0922649 2006  8.443094  7.864036  38  -55.81823178948488 -15.592792334833925 "Cuiabá"                           "MT"  4327.448 3
    "5103437" "Curvelândia"                                  -15.6          -57.9219 2006   8.34992  6.785588  39  -57.87644937159904 -15.617112751350701 "Curvelândia"                      "MT"   357.128 3
    "5103452" "Denise"                                       -14.74        -57.053889 2006 11.129818  9.545955  40  -56.96161614004239 -14.730076095138605 "Denise"                            "MT"  1273.178 3
    "5103502" "Diamantino"                              -14.4083277       -56.4469562 2006  13.01846  12.30903  41 -56.804568699175086 -14.095738292053072 "Diamantino"                        "MT"  8263.397 3
    "5103601" "Dom Aquino"                              -15.8094662       -54.9211653 2006  11.70691 10.657495  42 -54.776527994316034 -15.656315394145844 "Dom Aquino"                        "MT"  2183.603 3
    "5103700" "Feliz Natal"                                -12.3858            -54.92 2006 10.651691  10.49861  43  -54.18480386007494 -11.932901236688751 "Feliz Natal"                       "MT" 11661.514 3
    "5103809" "Figueirópolis D'Oeste"                      -15.445            -58.74 2006  7.138092  5.817111  44  -58.70257463350431 -15.527386368577965 "Figueirópolis D'Oeste"            "MT"   891.448 3
    "5103858" "Gaúcha do Norte"                        -13.1781626       -53.2573598 2006 10.588897 11.037258  45  -53.45617697189669 -12.995961583346347 "Gaúcha do Norte"                  "MT" 16908.375 3
    "5103908" "General Carneiro"                        -15.7116589       -52.7550968 2006 10.554974 11.124347  46  -53.34280146316657 -15.520137717056143 "General Carneiro"                  "MT"  4514.917 3
    "5103957" "Glória D'Oeste"                            -15.7678          -58.3558 2006  7.134933  6.580639  47  -58.32529256834483 -15.839196549509095 "Glória D'Oeste"                   "MT"    833.13 3
    "5104104" "Guarantã do Norte"                       -9.9504872       -54.9086065 2006  8.906805  8.194229  48  -54.62110531757516  -9.776268561549207 "Guarantã do Norte"                "MT"  4725.281 3
    "5104203" "Guiratinga"                              -16.3460831       -53.7639538 2006 11.680716  11.22905  49  -53.59007555376754  -16.38474677539504 "Guiratinga"                        "MT"  5043.899 3
    "5104500" "Indiavaí"                               -15.4962225       -58.5772805 2006  7.869914  5.857933  50 -58.597591976519496 -15.335201906134524 "Indiavaí"                         "MT"   592.495 3
    "5104526" "Ipiranga do Norte"                       -12.2382263       -56.1519237 2006  12.12909 11.955327  51 -56.058659209735715 -12.017026205902928 "Ipiranga do Norte"                 "MT"  3422.016 3
    "5104542" "Itanhangá"                              -22.9935711       -43.3030875 2006 10.901978 10.536433  52  -56.75487811207127   -12.1403921830551 "Itanhangá"                        "MT"  2909.745 3
    "5104559" "Itaúba"                                  -11.061944        -55.275833 2006 10.010605  10.08364  53 -55.589811272387806 -11.110991787676367 "Itaúba"                           "MT"   4521.79 3
    "5104609" "Itiquira"                                -17.2077149       -54.1484433 2006 12.672383 12.226404  54  -54.59732059468429 -17.333887811898993 "Itiquira"                          "MT"  8698.814 3
    "5104807" "Jaciara"                                 -15.9681811       -54.9650947 2006  11.70607  10.07912  55 -55.191949318682695 -15.975734998443773 "Jaciara"                           "MT"  2429.678 3
    "5104906" "Jangada"                                  -15.235833        -56.488889 2006  9.106726  7.846199  56 -56.572739937216205 -15.337843480699332 "Jangada"                           "MT"  1114.302 3
    "5105002" "Jauru"                                   -15.3403041       -58.8680861 2006  6.854258  6.666957  57  -58.86566571816707  -15.30479478445535 "Jauru"                             "MT"  1345.411 3
    "5105101" "Juara"                                       -11.255            -57.52 2006  8.109811  8.008698  58  -57.61840292139564 -11.023732242887027 "Juara"                             "MT" 22632.713 3
    "5105150" "Juína"                                  -11.4181597       -58.7606808 2006  9.557362   9.42529  59  -59.32449524903365 -11.532094690729512 "Juína"                            "MT" 26397.173 3
    "5105176" "Juruena"                                  -12.847227        -58.926895 2006   8.67583  7.483244  60 -58.624825608458615 -10.397452403025552 "Juruena"                           "MT"  3207.837 3
    "5105200" "Juscimeira"                                 -16.0508          -54.8839 2006 11.033854 10.791687  61  -54.90422490559096 -16.182878614878533 "Juscimeira"                        "MT"  2291.307 3
    "5105234" "Lambari D'Oeste"                            -15.3228          -58.0039 2006 10.870088  9.848503  62  -57.77917941232637 -15.377071910877069 "Lambari D'Oeste"                   "MT"  1810.547 3
    "5105259" "Lucas do Rio Verde"                      -13.0650649       -55.9197032 2006 12.940404 12.051726  63  -56.16745525463448  -13.03726268780817 "Lucas do Rio Verde"                "MT"  3674.596 3
    "5105309" "Luciara"                                      -10.75          -50.5667 2006  6.559099  7.077498  64 -50.945799462612754 -11.014675149775984 "Luciara"                           "MT"  4282.733 3
    "5105507" "Vila Bela da Santíssima Trindade"       -15.0064254       -59.9509173 2006  9.678061  8.933928  65  -59.99083159458444 -15.190622406435162 "Vila Bela da Santíssima Trindade" "MT"  13484.71 3
    "5105580" "Marcelândia"                            -11.0779159       -54.5249384 2006  9.498886  8.938532  66  -54.05341565755499  -10.88626411688603 "Marcelândia"                      "MT" 12285.486 3
    "5105606" "Matupá"                                 -10.1703001       -54.9301852 2006 10.335283  9.487821  67  -54.35687471880219 -10.013975782245053 "Matupá"                           "MT"  5228.272 3
    "5105622" "Mirassol d'Oeste"                        -15.6738138       -58.1028107 2006   9.99242 10.534307  68 -58.054959408060164 -15.654156205746865 "Mirassol d'Oeste"                  "MT"  1085.486 3
    "5105903" "Nobres"                                   -14.733333        -56.333333 2006 10.258801  9.630103  69  -55.81247900880092 -14.376970632428002 "Nobres"                            "MT"  3908.739 3
    "5106000" "Nortelândia"                                -14.455          -56.8028 2006  9.809299  9.373989  70  -56.72249293552059 -14.347737218305834 "Nortelândia"                      "MT"  1336.754 3
    "5106109" "Nossa Senhora do Livramento"              -15.758333        -56.345556 2006   9.60237  8.787678  71 -56.484039826651085 -15.839004810794503 "Nossa Senhora do Livramento"       "MT"  5537.413 3
    "5106158" "Nova Bandeirantes"                          -9.81389          -57.8619 2006   8.72606  8.107419  72 -58.076941272229966   -9.76844110652515 "Nova Bandeirantes"                 "MT"  9556.661 3
    "5106174" "Nova Nazaré"                            -13.9898149       -51.7999477 2006  8.306748  8.466531  73  -51.88994973042275 -14.156237629110615 "Nova Nazaré"                      "MT"  4034.539 3
    "5106182" "Nova Lacerda"                            -14.4745301       -59.5853047 2006  8.269799 10.043206  74  -59.77145731681706 -14.299833489461097 "Nova Lacerda"                      "MT"  4780.426 3
    "5106190" "Nova Santa Helena"                            -10.82          -53.3508 2006  8.330644  7.977282  75  -54.90666915892022 -10.918919875679421 "Nova Santa Helena"                 "MT"  2385.611 3
    "5106208" "Nova Brasilândia"                          -14.9569          -54.9658 2006  7.875965  8.035927  76 -55.050812904581484 -14.784476976479716 "Nova Brasilândia"                 "MT"  3290.032 3
    "5106216" "Nova Canaã do Norte"                       -10.5578          -55.9528 2006  9.368186  9.098515  77  -56.04172790476304 -10.700279070473451 "Nova Canaã do Norte"              "MT"  5953.099 3
    "5106224" "Nova Mutum"                              -13.8224921       -56.0820242 2006 13.102957 12.476367  78 -56.106054264445994  -13.62959906963144 "Nova Mutum"                        "MT"  9536.814 3
    "5106232" "Nova Olímpia"                            -14.796944        -57.287778 2006  11.05797 11.037516  79  -57.42145129387154 -14.804433282139199 "Nova Olímpia"                     "MT"  1327.266 3
    "5106240" "Nova Ubiratã"                              -12.9908           -55.255 2006 12.535655  12.55221  80  -54.75951988518504   -12.9964263801945 "Nova Ubiratã"                     "MT" 12460.736 3
    "5106257" "Nova Xavantina"                           -27.083333        -52.333333 2006  10.56783  10.30578  81 -52.406817653258365 -14.596957840422526 "Nova Xavantina"                    "MT"  5491.972 3
    "5106265" "Novo Mundo"                                    -9.95        -55.197778 2006  8.744581  8.003697  82 -55.403680784796954  -9.752155069295247 "Novo Mundo"                        "MT"  5800.759 3
    "5106273" "Novo Horizonte do Norte"                    -11.4128          -57.3519 2006  8.570369   6.54535  83  -57.30351868839538 -11.383601539861393 "Novo Horizonte do Norte"           "MT"   920.048 3
    "5106281" "Novo São Joaquim"                          -14.9058          -53.0178 2006 11.575048 11.331415  84  -53.25848056637146 -15.078102405600308 "Novo São Joaquim"                 "MT"  5225.595 3
    "5106299" "Paranaíta"                               -9.6669618       -56.4765937 2006  9.415656  8.335192  85  -56.68258880238319  -9.593574365676968 "Paranaíta"                        "MT"  4814.149 3
    "5106307" "Paranatinga"                             -14.4270271       -54.0484815 2006 10.837068 10.606412  86  -54.10899016439388 -13.677654086919363 "Paranatinga"                       "MT" 24166.632 3
    "5106315" "Novo Santo Antônio"                      -5.2879036       -41.9347567 2006  7.303446  7.334329  87  -50.88794647729436 -12.313386364338797 "Novo Santo Antônio"               "MT"   4394.78 3
    "5106372" "Pedra Preta"                              -16.622778        -54.473889 2006 12.104973 10.902868  88   -54.2492077635204 -16.795172590944194 "Pedra Preta"                       "MT"  3841.672 3
    "5106422" "Peixoto de Azevedo"                        -10.22306         -54.97972 2006  9.255196  8.144098  89  -53.59394723960452 -10.149515070847944 "Peixoto de Azevedo"                "MT" 14433.775 3
    "5106455" "Planalto da Serra"                       -14.6611435       -54.7742498 2006  8.529107  8.822322  90  -54.67396753584173  -14.58878237013204 "Planalto da Serra"                 "MT"   2437.59 3
    "5106505" "Poconé"                                      16.267           -56.633 2006  10.88783 10.315133  91 -56.944702804473565 -16.782844143165036 "Poconé"                           "MT" 17156.759 3
    "5106653" "Pontal do Araguaia"                         -15.9339          -52.3169 2006  7.355541  6.755769  92  -52.72139944246705 -15.931955953502433 "Pontal do Araguaia"                "MT"  2742.482 3
    "5106703" "Ponte Branca"                                 -16.45        -52.666667 2006  6.559099  5.303305  93  -52.93657485182785   -16.6589499810553 "Ponte Branca"                      "MT"   701.138 3
    "5106752" "Pontes e Lacerda"                        -15.2347084       -59.3314294 2006   9.85034  9.365719  94  -59.45774229708416 -15.516822641980657 "Pontes e Lacerda"                  "MT"  8545.292 3
    "5106778" "Porto Alegre do Norte"                   -10.8839261       -51.6438106 2006  9.932587  9.331318  95  -51.71357869457031 -10.826170934798789 "Porto Alegre do Norte"             "MT"  3971.721 3
    "5106802" "Porto dos Gaúchos"                       -11.512103        -57.358192 2006  10.99555 10.766335  96  -56.74569835674646 -11.734958209352534 "Porto dos Gaúchos"                "MT"  6846.668 3
    "5106828" "Porto Esperidião"                            -15.85        -58.466667 2006  8.105024  7.034388  97  -58.98236115628332 -15.956674126288624 "Porto Esperidião"                 "MT"  5835.278 3
    "5106851" "Porto Estrela"                           -15.3315179       -57.2071067 2006  8.719161  7.134891  98  -57.21550456449232 -15.521176377296204 "Porto Estrela"                     "MT"  2045.467 3
    "5107008" "Poxoréo"                          -15.8691790439575 -56.0941622007565 2006 11.481133  10.87106  99   -54.1860187680725 -15.851006113067427 "Poxoréu"                          "MT"  6915.298 3
    "5107040" "Primavera do Leste"                      -15.5570739       -54.2991272 2006 12.882947 12.128943 100  -54.21995435480085 -15.096682749044543 "Primavera do Leste"                "MT"  5470.383 3
    "5107065" "Querência"                              -12.6088398       -52.2203065 2006 12.163307 11.969324 101  -52.74343692079102  -12.15871956109589 "Querência"                        "MT" 17799.989 3
    "5107107" "São José dos Quatro Marcos"               -15.6208          -58.1758 2006   8.95255  8.009695 102  -58.29711454398718 -15.566563548493875 "São José dos Quatro Marcos"      "MT"  1282.763 3
    "5107156" "Reserva do Cabaçal"                          -15.08          -58.4658 2006  5.977672  6.270988 103 -58.457779875682235 -14.928428814345661 "Reserva do Cabaçal"               "MT"  1331.677 3
    "5107180" "Ribeirão Cascalheira"                      -12.9419          -51.8239 2006  9.408189  8.866863 104  -51.56833100795913 -12.874753877471061 "Ribeirão Cascalheira"             "MT" 11354.555 3
    "5107198" "Ribeirãozinho"                              -16.485          -52.6919 2006  9.368751  9.423676 105 -52.759776383961096 -16.494009996534466 "Ribeirãozinho"                    "MT"   624.997 3
    "5107206" "Rio Branco"                                 -15.2408          -58.1158 2006  6.887228  6.326149 106  -58.14977248590821 -15.272967111852564 "Rio Branco"                        "MT"   539.287 3
    "5107248" "Santa Carmem"                            -11.9708672       -55.2773202 2006 10.804562  10.90375 107   -54.8996958914011  -11.93466339316526 "Santa Carmem"                      "MT"   3812.09 3
    "5107263" "Santo Afonso"                             -14.495849         -57.00416 2006 9.0893955  6.410175 108  -57.34672491573192 -14.450329247820386 "Santo Afonso"                      "MT"  1166.382 3
    "5107297" "São José do Povo"                       -16.465428       -54.2539931 2006  7.597126  5.777652 109 -54.268082283753735  -16.47095574101996 "São José do Povo"                "MT"   489.737 3
    "5107305" "São José do Rio Claro"                    -13.4469          -56.7208 2006 11.878203 11.413216 110  -56.80818783118475 -13.551233869020855 "São José do Rio Claro"           "MT"  4525.304 3
    "5107354" "São José do Xingu"                     -10.8067837       -52.7320201 2006   9.58541 8.2179785 111 -52.616918522852295   -10.6964531263542 "São José do Xingu"               "MT"  7465.563 3
    "5107404" "São Pedro da Cipa"                       -16.000833        -54.920833 2006  9.272513  7.833204 112  -54.74030434148665 -15.954073496537008 "São Pedro da Cipa"                "MT"    344.33 3
    "5107578" "Rondolândia"                                  -14.5           -55.417 2006  7.368152  7.582229 113  -61.00996585622152 -10.463059747958123 "Rondolândia"                      "MT" 12658.341 3
    "5107602" "Rondonópolis"                            -16.466667        -54.633333 2006 11.822528  11.35257 114  -54.68479349791749  -16.56748513681301 "Rondonópolis"                     "MT"   4824.02 3
    "5107701" "Rosário Oeste"                          -14.8304294       -56.4293283 2006 10.206658  8.830104 115 -55.936586489912926 -14.764343289160598 "Rosário Oeste"                    "MT"  7339.443 3
    "5107743" "Santa Cruz do Xingu"                     -10.1542193       -52.3885891 2006  9.272389  9.013351 116 -52.541462988283236  -10.06449901683852 "Santa Cruz do Xingu"               "MT"   5623.39 3
    "5107750" "Salto do Céu"                           -15.1276551       -58.1265767 2006  7.267144  8.435115 117  -58.05085551080863 -15.050859709116128 "Salto do Céu"                     "MT"  1753.378 3
    "5107768" "Santa Rita do Trivelato"                    -13.8119          -55.2669 2006 12.045576 11.426626 118  -55.29409408490499 -13.833035160933767 "Santa Rita do Trivelato"           "MT"  4747.042 3
    "5107776" "Santa Terezinha"                              -10.47        -50.502778 2006  9.349815  8.675905 119  -50.79231388648661 -10.332638069595417 "Santa Terezinha"                   "MT"  6466.223 3
    "5107792" "Santo Antônio do Leste"                    -14.8058          -53.6058 2006  12.09695 11.503734 120 -53.669927258876605 -14.805150075423374 "Santo Antônio do Leste"           "MT"  3403.593 3
    "5107800" "Santo Antônio do Leverger"         -15.818135556981 -54.4007326559538 2006 10.538027 10.706923 121  -55.44714104551915 -16.535827731049437 "Santo Antônio de Leverger"        "MT"  9469.139 3
    "5107859" "São Félix do Araguaia"                  -11.616944        -50.668889 2006  9.889292 10.059337 122  -51.96959949117963 -11.454590421281612 "São Félix do Araguaia"           "MT" 16682.473 3
    "5107875" "Sapezal"                                 -13.5451373       -58.8199426 2006  13.58504 12.532062 123  -58.65354990915228 -13.154436366942125 "Sapezal"                           "MT" 13614.552 3
    "5107883" "Serra Nova Dourada"                      -12.0913383       -51.4018026 2006  6.802671  6.747587 124 -51.362097711779526 -12.023007025476323 "Serra Nova Dourada"                "MT"  1490.793 3
    "5107909" "Sinop"                                    -11.848056        -55.649167 2006 11.919634 11.703753 125 -55.501519039346434 -11.710854122284497 "Sinop"                             "MT"   3990.87 3
    "5107925" "Sorriso"                                 -12.5586223       -55.7145561 2006 13.575216 13.123325 126  -55.68137548387759 -12.737310038456284 "Sorriso"                           "MT"  9293.629 3
    "5107941" "Tabaporã"                               -11.3075282       -56.8291197 2006 11.692267  10.97231 127   -56.4964420264125 -11.214129480683122 "Tabaporã"                         "MT"   8439.05 3
    "5107958" "Tangará da Serra"                       -14.6300658       -57.5053398 2006  12.00098 11.158263 128  -58.29147784033346 -14.430618176607542 "Tangará da Serra"                 "MT" 11636.825 3
    "5108006" "Tapurah"                                 -12.7460539       -56.5082344 2006  11.96685 11.703794 129 -56.531764270105974 -12.568008595477458 "Tapurah"                           "MT"  4492.539 3
    "5108055" "Terra Nova do Norte"                        -10.5169          -55.2308 2006  8.903212  8.813885 130  -54.98406200270669  -10.51256232608938 "Terra Nova do Norte"               "MT"  2399.736 3
    "5108105" "Tesouro"                                 -16.0809626       -53.5531116 2006 10.447544 10.334556 131  -53.45638034181174 -15.906647172579193 "Tesouro"                           "MT"  4244.073 3
    "5108204" "Torixoréu"                                   -16.25          -52.4333 2006  9.551354  9.359019 132  -52.88992899301261  -16.29473132281461 "Torixoréu"                        "MT"  2398.383 3
    "5108303" "União do Sul"                              -11.5328          -54.3528 2006  9.277477  9.679281 133  -54.31644728313904 -11.527675996741667 "União do Sul"                     "MT"  4590.628 3
    "5108352" "Vale de São Domingos"                   -15.2957756       -59.0654256 2006  6.617404 9.1769905 134  -58.96310740297459 -14.966106185323092 "Vale de São Domingos"             "MT"  1901.545 3
    "5108402" "Várzea Grande"                               -15.65        -56.133333 2006  8.525963  6.836259 135 -56.242751074081696 -15.562478504735749 "Várzea Grande"                    "MT"   724.279 3
    "5108501" "Vera"                                       -12.3058          -55.3169 2006 11.687598 11.422476 136  -55.34263307930938 -12.441859392847439 "Vera"                              "MT"  3058.364 3
    "5108600" "Vila Rica"                                  -10.0119          -51.1158 2006  9.392644 11.476397 137  -51.40634922635017   -9.98064715966419 "Vila Rica"                         "MT"  7436.383 3
    "5108808" "Nova Guarita"                            -10.3091251       -55.4038754 2006  8.696845  7.496653 138 -55.338178278528474 -10.293863145395896 "Nova Guarita"                      "MT"  1121.928 3
    "5108857" "Nova Marilândia"                           -14.3639          -56.9689 2006  9.595188   8.70616 139 -57.257443742980804  -14.29042973998055 "Nova Marilândia"                  "MT"  1905.744 3
    "5108907" "Nova Maringá"                              -13.0258          -57.0739 2006 11.095002 11.110715 140  -57.22027425157531 -12.783863064985173 "Nova Maringá"                     "MT" 11553.479 3
    "5108956" "Nova Monte verde"                         -9.9788249        -57.467691 2006  8.761937  8.747193 141  -57.24565622181161  -9.970185723056694 "Nova Monte Verde"                  "MT"  5139.307 3
    end
    label values _merge _merge
    label def _merge 3 "matched (3)", modify



    The spatial matrix is defined as:

    Code:
    //matrix of spatial weights
    //rook not specified = matrix type is queen
    //second = second order neighbors
    spmatrix create contiguity W if  !missing(lProduction) & !missing(lTotalTillage), second

    To run SMA model, I tried the code:

    Code:
     spregress lProduction lTotalTillage, ml dvarlag(W) errorlag(W)  
     predict e, residuals if e(sample)
    Notwithstanding, an error appears:
    Code:
    prediction sample must be a subset of e(sample)
    How is it possible to fix the code to run a SMA model and, later, a SARMA model?
Working...
X