datatable(BD_MODELADO,class = 'cell-border stripe', options = list(
pageLength = 10, autoWidth = TRUE),colnames = c('X (UTM)','Y (UTM)','CE a 70cm','CE a 150cm','NDVI','DEM','Slope','Z (elevation)'))
fig_Z <- plot_ly(x = x, y = y, z = z, size = I(90))%>%
layout(
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "Elevation (M.A.S.L.)")
)
)%>%
add_markers(color = "cyan")
fig_Z
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
fig_DEM <- plot_ly(x = x, y = y, z = DEM, size = I(90))%>%
layout(
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "DEM")
)
)%>%
add_markers(color = "cyan")
fig_DEM
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
CEa75 CEa150 NDVI Slope Z DEM
X_x <- as.matrix(BD_MODELADO[,c(3:8)])
X_x
## Avg_CEa_07 Avg_CEa_15 NDVI DEM SLOPE Avg_z
## [1,] 7.237480 18.02656 0.863030 199.0000 6.385167 193.0512
## [2,] 6.787250 18.02737 0.866502 197.1667 1.981082 193.2986
## [3,] 6.848250 18.70444 0.874883 197.0000 0.577682 193.5659
## [4,] 7.135162 18.34237 0.845838 197.0000 1.175075 194.4116
## [5,] 6.826763 17.92409 0.797179 197.0000 0.210996 193.9931
## [6,] 6.699966 18.39441 0.758272 197.6667 4.357386 195.3814
## [7,] 6.180742 17.84332 0.763436 199.7500 6.628445 196.6780
## [8,] 8.539024 18.75812 0.823320 197.1667 1.462050 194.9936
## [9,] 8.869958 18.85396 0.759923 197.3333 1.663344 196.1356
## [10,] 7.231308 18.34269 0.757382 197.6667 3.541936 197.8522
## [11,] 7.372200 18.35662 0.775947 199.6667 5.092919 196.9330
## [12,] 7.556792 18.40508 0.757534 201.5000 2.800611 198.0175
## [13,] 6.613547 18.00057 0.786412 201.4444 2.361177 197.7762
## [14,] 8.707629 18.60609 0.822730 198.5000 4.355658 195.8610
## [15,] 8.619512 18.65902 0.751389 198.5000 2.763125 196.5075
## [16,] 9.443404 18.87923 0.782599 199.0000 2.106899 197.4861
## [17,] 7.948763 18.66895 0.837023 200.6667 3.431262 199.9242
## [18,] 7.617205 18.72236 0.827783 202.0000 1.192970 199.1996
## [19,] 6.952229 18.63938 0.815532 201.6667 1.590627 199.2844
## [20,] 8.900977 19.16011 0.849303 198.4444 5.012258 197.4021
## [21,] 8.362279 18.82934 0.784440 200.5000 2.915162 197.2999
## [22,] 9.246182 19.41561 0.792788 199.7778 2.759113 197.7400
## [23,] 9.565551 19.12467 0.830265 199.3333 2.352002 198.8052
## [24,] 9.514172 19.31950 0.836988 200.4444 3.071998 199.7561
## [25,] 7.765429 18.73330 0.856579 202.0000 2.045438 200.2470
## [26,] 7.740431 19.30920 0.848950 201.2222 3.057894 200.0841
## [27,] 8.005415 18.90811 0.846561 200.1667 3.000087 200.0516
## [28,] 6.561038 18.64561 0.851043 200.7778 3.986067 198.6690
## [29,] 6.283077 18.36692 0.854749 201.8333 2.074468 198.8767
## [30,] 8.319138 18.83954 0.808107 199.0000 4.708445 198.0322
## [31,] 9.039500 19.16427 0.704767 201.0000 1.474276 198.9863
## [32,] 8.967420 18.79867 0.829590 200.8333 1.545263 199.0529
## [33,] 10.180382 19.61115 0.796595 200.7500 3.036000 199.4091
## [34,] 10.306887 20.20234 0.800730 201.3333 3.673525 200.2416
## [35,] 10.387930 19.50311 0.822610 202.7500 3.780945 200.4325
## [36,] 8.079340 19.52706 0.812524 201.6667 5.572433 200.7606
## [37,] 7.416591 18.46507 0.851740 198.7500 6.139762 201.2179
## [38,] 7.794147 18.55415 0.861789 199.0000 6.402925 201.1689
## [39,] 6.358915 18.25549 0.855028 200.5000 5.598307 198.6975
## [40,] 7.251424 19.10358 0.868394 199.0000 6.668860 197.1639
## [41,] 9.239875 20.23771 0.863231 198.4444 3.801271 195.1000
## [42,] 8.808246 19.87461 0.842880 199.0000 3.790430 195.2742
## [43,] 9.690171 19.67751 0.821701 198.3333 4.396922 195.7090
## [44,] 10.155757 19.46209 0.798429 196.8333 3.904072 196.6163
## [45,] 8.804591 19.08687 0.737705 199.3333 2.923768 196.6843
## [46,] 8.434166 19.03361 0.750449 200.5000 2.458677 197.5293
## [47,] 9.156519 18.77033 0.835305 201.3333 1.687156 199.8418
## [48,] 9.274048 18.43818 0.752140 202.3333 3.230637 200.1707
## [49,] 10.207658 19.63138 0.715250 203.5556 4.476171 200.8024
## [50,] 10.902909 19.60230 0.739356 205.0000 4.121137 201.0412
## [51,] 7.761483 18.37293 0.856687 200.3333 10.745049 201.2643
## [52,] 8.006260 18.36260 0.852410 197.4444 5.309658 201.3608
## [53,] 7.533355 18.36884 0.849109 197.5000 3.681294 200.7411
## [54,] 6.599943 18.65739 0.855608 196.8889 3.572474 198.9216
## [55,] 6.165389 18.22589 0.837410 196.1667 1.894812 198.8203
## [56,] 9.801222 20.57460 0.813314 201.0000 6.860100 195.6087
## [57,] 9.883363 19.67821 0.785680 201.2500 5.779408 196.0870
## [58,] 9.356057 19.23891 0.828626 200.5000 5.703887 196.1448
## [59,] 9.417184 18.72799 0.843965 199.2500 6.287442 196.4108
## [60,] 8.755571 18.37157 0.847600 199.0000 5.979193 197.4217
## [61,] 8.698579 18.29050 0.837913 200.0000 5.017095 197.9413
## [62,] 8.703409 18.35272 0.758228 200.5000 4.258302 198.2749
## [63,] 8.273370 18.69217 0.782020 201.5000 5.531510 198.1177
## [64,] 8.349463 18.67237 0.843852 202.0000 1.791052 198.8206
## [65,] 9.406651 19.00990 0.803169 201.5000 3.412350 200.6089
## [66,] 9.437600 18.38075 0.805965 203.3333 6.380927 201.0759
## [67,] 10.106193 18.76165 0.786369 205.0000 5.288365 201.1798
## [68,] 10.622833 19.52911 0.815856 206.5000 5.275273 200.8173
## [69,] 9.710588 19.22582 0.862998 205.2500 11.876602 203.1204
## [70,] 8.792682 18.39832 0.848414 200.6667 12.718485 201.7512
## [71,] 8.157281 18.32854 0.847895 198.0000 7.269520 201.4652
## [72,] 7.586421 18.00271 0.865199 197.1667 5.617575 201.3465
## [73,] 7.571196 17.90945 0.870017 196.7500 3.788360 201.2001
## [74,] 6.827806 17.68600 0.871002 197.1667 3.364663 200.1021
## [75,] 10.413632 19.74619 0.758252 204.5000 5.642858 198.3504
## [76,] 9.166925 19.62213 0.867244 203.7778 6.482583 197.8452
## [77,] 8.504000 18.89116 0.867638 202.3333 6.083620 197.3573
## [78,] 8.788548 18.37173 0.870942 201.1111 2.459150 197.0722
## [79,] 8.662250 18.26270 0.872671 201.0000 0.455108 198.1134
## [80,] 8.719192 18.85450 0.868578 202.1111 4.101172 198.8306
## [81,] 8.341883 18.48699 0.848237 203.6667 2.456326 199.8018
## [82,] 8.293013 18.90836 0.851545 202.3333 4.217897 199.2333
## [83,] 8.894091 18.87077 0.819059 200.8333 2.518604 200.0127
## [84,] 9.640773 18.75718 0.804251 200.2222 4.984981 201.2964
## [85,] 9.492250 18.26178 0.815396 201.8333 8.670177 202.1158
## [86,] 9.782962 18.64194 0.823529 206.0000 7.582604 202.1501
## [87,] 11.163060 20.20002 0.841616 207.3333 4.667620 201.8758
## [88,] 9.308194 19.18990 0.849396 203.0000 8.109317 204.5230
## [89,] 8.156393 18.35493 0.866166 202.5556 11.049718 201.9955
## [90,] 8.287346 18.28569 0.864788 201.1667 11.253322 201.7849
## [91,] 8.951000 18.28127 0.855187 199.1111 7.486137 201.6944
## [92,] 7.039985 17.21669 0.856369 200.3333 6.899040 199.8109
## [93,] 9.423294 19.52137 0.824327 207.0000 5.684828 198.8574
## [94,] 9.017756 19.17876 0.862673 205.2500 7.447565 198.8165
## [95,] 8.648365 19.24670 0.861911 203.0000 7.774040 198.1910
## [96,] 8.578609 18.44053 0.870474 201.5000 4.397030 198.3609
## [97,] 8.499200 18.28480 0.877252 202.8333 4.143000 199.0324
## [98,] 8.404081 18.78468 0.860681 204.2500 1.997852 199.9175
## [99,] 8.742085 19.17412 0.845406 204.0000 3.836572 201.0765
## [100,] 9.369309 19.24459 0.841513 202.0000 6.512908 202.0215
## [101,] 9.560190 18.78436 0.825845 199.6667 4.350432 201.3854
## [102,] 9.754492 18.74436 0.808722 200.0000 4.851805 202.4915
## [103,] 9.550490 18.27571 0.817211 203.1667 7.158753 203.2807
## [104,] 9.488833 18.19102 0.844389 205.2500 3.089440 203.4541
## [105,] 11.076870 20.15741 0.848573 204.8333 1.423512 203.0027
## [106,] 9.998806 19.54010 0.848647 205.0000 1.982079 204.2055
## [107,] 9.759255 19.09805 0.856381 206.6667 3.747822 204.8999
## [108,] 8.134407 18.10189 0.849230 205.7500 7.037877 201.7845
## [109,] 8.283045 18.08600 0.843651 202.1667 5.566600 201.8522
## [110,] 9.061986 18.65290 0.843616 201.0000 1.501851 201.4426
## [111,] 8.171761 18.13158 0.849739 202.3333 5.030968 199.7676
## [112,] 7.553833 17.89883 0.860130 203.0000 4.671025 199.0601
## [113,] 9.105000 19.12731 0.843663 207.8333 3.271004 198.3139
## [114,] 9.540674 19.70359 0.853745 206.4444 6.858296 197.9799
## [115,] 8.603241 19.29691 0.856553 205.0000 7.369337 199.1988
## [116,] 8.789031 18.58095 0.866439 204.1111 4.006299 199.6428
## [117,] 8.815902 18.78757 0.840555 204.8333 1.462050 200.2269
## [118,] 8.671873 18.86411 0.841259 204.8889 1.218358 201.0782
## [119,] 9.639222 18.64261 0.861820 204.0000 3.836572 202.3012
## [120,] 9.724586 18.89210 0.832131 201.6667 5.265142 202.6912
## [121,] 9.861596 18.64730 0.827554 201.5000 5.385043 202.6254
## [122,] 10.127983 18.61331 0.824167 204.1111 7.128587 203.7258
## [123,] 10.388884 18.67009 0.827009 206.0000 5.358540 204.1337
## [124,] 9.952259 18.44155 0.836960 204.7778 3.626926 204.7050
## [125,] 11.144444 19.95739 0.847317 203.6667 2.962247 203.4641
## [126,] 10.916097 19.64090 0.865341 204.7778 5.460382 203.7717
## [127,] 9.710557 18.55275 0.857880 205.5000 4.828302 204.8091
## [128,] 8.085140 17.91605 0.843587 202.3333 5.443827 201.9826
## [129,] 9.437786 18.36079 0.870549 201.5556 1.737311 200.9807
## [130,] 8.461278 18.23818 0.862629 202.0000 0.397830 199.6393
## [131,] 7.954150 18.13873 0.836774 200.8889 4.574136 198.6265
## [132,] 9.158409 19.58104 0.831675 209.3333 3.588530 198.2778
## [133,] 9.320712 19.21278 0.837706 208.0000 6.125635 199.2195
## [134,] 8.914465 19.23244 0.856900 206.1667 5.162935 200.2588
## [135,] 8.762164 18.87300 0.865854 205.2500 2.218411 200.8218
## [136,] 9.031770 18.57587 0.872514 205.3333 2.080359 201.5015
## [137,] 8.958058 18.34819 0.872568 204.5000 3.006227 202.4989
## [138,] 9.390675 18.47270 0.852908 202.3333 4.674987 203.3595
## [139,] 9.799225 18.57563 0.833239 201.5000 4.727215 204.4179
## [140,] 10.491500 19.03598 0.841123 206.3333 9.757872 203.6451
## [141,] 10.666597 19.02223 0.838892 209.2500 5.480415 204.4681
## [142,] 10.220761 18.92078 0.854460 206.3333 8.254676 205.4655
## [143,] 9.576524 18.23724 0.866290 203.7500 3.371925 206.1004
## [144,] 11.325523 19.28098 0.858144 203.3333 2.225776 204.2725
## [145,] 11.492385 19.30587 0.863999 203.7500 2.808880 204.0167
## [146,] 7.968871 17.46971 0.862478 201.5000 2.990262 201.6800
## [147,] 8.121050 17.72365 0.873844 201.8333 2.530224 201.5062
## [148,] 9.461541 18.51354 0.836021 202.5000 2.276920 200.5268
## [149,] 9.119667 18.28281 0.812793 201.8333 2.716172 199.7099
## [150,] 9.490019 18.76485 0.827297 200.5000 4.612540 198.5984
## [151,] 9.033125 19.33087 0.820116 210.3333 4.002342 199.7960
## [152,] 9.038783 19.51658 0.836631 209.8889 7.841606 200.2779
## [153,] 8.930578 19.08338 0.863915 207.8333 8.257585 201.3893
## [154,] 8.875571 18.92654 0.873334 206.4444 3.857106 202.0203
## [155,] 9.428071 18.44366 0.875065 205.1667 3.487768 202.6132
## [156,] 8.788283 18.25748 0.866960 203.2222 6.914147 203.7657
## [157,] 9.177440 18.19536 0.834331 201.1667 4.310694 204.5432
## [158,] 9.794014 18.57058 0.839068 205.7778 11.296110 205.7407
## [159,] 10.494813 18.72233 0.856831 210.0000 1.747159 204.5445
## [160,] 10.637610 18.78246 0.857267 208.5556 6.130330 204.9341
## [161,] 10.651236 18.81255 0.857484 205.5000 5.711950 205.8528
## [162,] 9.873600 17.76493 0.850752 205.0000 4.719129 206.3428
## [163,] 11.176595 18.51562 0.857664 204.8333 5.374358 205.1603
## [164,] 11.420059 19.12765 0.855681 203.3333 5.159998 204.1542
## [165,] 10.373150 18.40430 0.863387 203.8333 5.796872 202.9000
## [166,] 9.611918 18.19295 0.874638 204.1111 4.943022 203.4336
## [167,] 8.906259 17.73712 0.848241 204.0000 3.505737 201.4334
## [168,] 10.253087 18.28652 0.840399 203.3333 3.730053 200.1442
## [169,] 10.481411 18.95797 0.841652 201.5000 4.479237 199.8272
## [170,] 13.058916 20.93098 0.795073 199.7778 3.182941 198.7313
## [171,] 9.350082 19.53766 0.810811 211.7500 7.183032 201.5489
## [172,] 9.242393 19.02414 0.864632 208.3333 7.453835 202.5080
## [173,] 9.099338 18.98034 0.874916 206.7500 3.146847 203.1635
## [174,] 9.063097 18.44244 0.854908 205.8333 6.620357 203.5593
## [175,] 9.204898 18.10246 0.844776 204.2500 7.818020 204.7211
## [176,] 8.911786 17.86002 0.850159 206.1667 7.750718 205.2250
## [177,] 10.290754 18.50285 0.856557 209.2500 4.140995 206.9010
## [178,] 10.683234 18.46745 0.834661 209.5000 2.622039 205.6902
## [179,] 11.102933 18.37955 0.836137 208.2500 6.048235 204.9596
## [180,] 11.555725 18.25584 0.847999 208.1667 6.774420 206.3974
## [181,] 10.262660 17.39117 0.846368 208.0000 6.397650 206.1927
## [182,] 10.833848 17.85763 0.844550 205.6667 5.088587 205.5291
## [183,] 11.726238 18.83256 0.862181 206.0000 3.834015 204.3245
## [184,] 10.057179 18.69707 0.865831 206.5000 3.339427 202.7165
## [185,] 10.225946 18.36255 0.851753 205.5000 3.257628 202.3656
## [186,] 9.190459 17.95162 0.853442 203.6667 3.698943 201.2474
## [187,] 10.466905 17.97419 0.857861 202.7500 3.159929 200.5020
## [188,] 11.088537 18.78384 0.845244 201.3333 4.151367 199.8491
## [189,] 10.537560 20.02344 0.774291 200.2500 4.271058 198.5972
## [190,] 9.588048 18.82817 0.804610 209.8889 4.661827 202.7712
## [191,] 8.890474 18.78765 0.855494 209.3333 5.267915 203.2853
## [192,] 9.178667 18.73316 0.849169 209.2222 6.872354 203.6961
## [193,] 8.939582 17.58596 0.848935 208.6667 7.365235 204.2412
## [194,] 9.121469 17.82763 0.853871 209.0000 5.953982 205.0853
## [195,] 9.161358 17.63924 0.850449 210.5000 5.253798 205.9503
## [196,] 9.624125 18.32854 0.832890 211.0000 3.526908 207.7375
## [197,] 11.124750 17.95658 0.823946 211.3333 5.185570 206.7987
## [198,] 11.890033 17.76955 0.840283 211.3333 4.988912 204.8491
## [199,] 11.216469 17.67884 0.848761 210.5000 5.430198 206.4087
## [200,] 11.074617 17.49098 0.853740 208.0000 5.881513 206.0711
## [201,] 11.575519 17.08335 0.870374 207.1667 3.109163 205.9899
## [202,] 11.625279 18.87552 0.859950 207.2222 1.517558 204.7037
## [203,] 12.533951 18.86659 0.831997 206.0000 5.347407 204.3314
## [204,] 12.664912 18.38086 0.825287 203.4444 3.258100 202.1066
## [205,] 10.729181 17.21194 0.829966 203.0000 0.281328 201.1195
## [206,] 9.710667 17.63315 0.831045 203.0000 2.432128 200.8034
## [207,] 13.227629 21.51339 0.804012 202.5000 5.575297 199.7839
## [208,] 9.126116 19.53128 0.773180 199.6667 7.781784 198.6119
## [209,] 6.894246 18.29086 0.794779 197.5000 5.738217 197.4881
## [210,] 8.503577 18.33692 0.804623 210.7500 4.400325 203.6242
## [211,] 8.451278 18.34056 0.851234 212.3333 4.360802 204.1438
## [212,] 8.930413 18.50075 0.850611 211.5000 4.597890 204.2841
## [213,] 9.979037 18.06068 0.836540 211.1667 1.883871 204.7361
## [214,] 10.039082 17.67702 0.831368 211.2500 1.786949 205.4088
## [215,] 10.834800 17.87506 0.840000 211.8333 1.462050 206.3681
## [216,] 11.127763 18.10650 0.838095 212.2500 1.786949 207.6834
## [217,] 11.791851 18.21894 0.841190 212.3333 1.680566 207.2423
## [218,] 12.863088 17.80500 0.865160 211.5000 2.549555 205.3834
## [219,] 12.366322 17.62178 0.849108 210.0000 3.990678 205.9602
## [220,] 12.096839 17.61648 0.841961 208.5000 3.257628 205.7391
## [221,] 11.738320 16.88126 0.848782 207.5000 3.292012 205.9970
## [222,] 12.740534 18.68069 0.828928 205.0000 6.269660 204.5509
## [223,] 13.601094 18.82575 0.811157 203.1667 2.430204 204.8136
## [224,] 11.457347 18.02683 0.820088 203.5000 3.299475 201.8857
## [225,] 11.166191 18.37085 0.830938 204.5000 3.254442 201.3896
## [226,] 11.297233 18.90360 0.804511 204.0000 2.554135 200.8387
## [227,] 11.039111 21.20233 0.817266 202.1667 4.492692 199.5112
## [228,] 7.963308 19.38825 0.789837 200.5000 4.355658 198.6991
## [229,] 9.048643 18.20879 0.812592 212.3333 3.567334 204.5661
## [230,] 8.881460 17.97930 0.837166 212.5000 2.958468 204.0985
## [231,] 10.835075 18.14640 0.830340 210.6667 3.911258 204.9926
## [232,] 10.506455 17.76495 0.815107 210.1667 2.740343 205.3672
## [233,] 9.840000 16.97415 0.837437 210.8889 2.434887 205.4851
## [234,] 10.916683 17.68562 0.839855 211.8333 1.462050 206.6006
## [235,] 11.010927 17.45429 0.843084 211.6667 1.574458 206.9225
## [236,] 13.424340 18.47732 0.849661 211.1667 1.191299 206.9044
## [237,] 12.675188 17.95838 0.829123 210.3333 1.963581 205.8225
## [238,] 12.447763 17.93237 0.814726 209.3333 2.510633 205.4299
## [239,] 12.444867 17.68103 0.859755 208.1111 3.357586 207.9852
## [240,] 11.632409 17.55151 0.860111 205.6667 5.573225 211.9958
## [241,] 12.971378 18.85073 0.836932 205.0000 3.883573 205.4668
## [242,] 13.262604 19.25704 0.833459 205.3333 3.425505 204.7264
## [243,] 10.691591 18.11443 0.862390 205.3333 2.397526 202.1130
## [244,] 10.110577 18.56411 0.835272 203.5000 3.529828 201.4283
## [245,] 10.214864 18.50148 0.820129 202.3333 1.757121 200.8799
## [246,] 9.330150 20.68170 0.813438 201.8333 1.321386 199.5737
## [247,] 8.808750 17.69575 0.801299 211.0000 3.843770 204.1000
## [248,] 9.284254 17.66615 0.814951 209.6667 2.339072 204.1985
## [249,] 9.965915 17.60387 0.810631 210.0000 3.372290 205.5335
## [250,] 10.322586 17.42128 0.830254 210.8333 1.331963 205.8982
## [251,] 9.753217 16.80468 0.829867 211.5000 2.331430 205.7017
## [252,] 10.107022 17.01939 0.830576 211.3333 1.753202 206.8975
## [253,] 12.064159 17.70423 0.829442 210.7500 1.982079 206.8196
## [254,] 13.318076 18.44122 0.807566 210.6667 1.994592 206.3962
## [255,] 11.840000 18.03844 0.830631 210.5000 3.652555 205.9474
## [256,] 11.691589 17.92762 0.869058 208.8333 4.000510 205.4009
## [257,] 12.471000 18.34732 0.876872 207.2500 4.344182 204.7141
## [258,] 11.860000 17.76506 0.856497 206.5000 2.025263 212.3547
## [259,] 11.974023 18.34123 0.855178 206.7500 2.143036 208.9608
## [260,] 12.494547 19.32316 0.865053 205.6667 3.054682 204.7026
## [261,] 9.845591 18.51041 0.856615 203.5000 3.507347 201.5060
## [262,] 10.792130 18.86935 0.833807 202.3333 1.699703 201.5401
## [263,] 9.899631 17.45368 0.799654 210.5000 3.195748 205.3600
## [264,] 10.453354 17.65788 0.841748 211.7778 3.074642 205.9236
## [265,] 10.972456 18.56572 0.840825 212.6667 2.340314 206.6825
## [266,] 9.714850 17.08600 0.842335 211.8889 3.682146 205.9591
## [267,] 11.064222 17.15713 0.842948 210.0000 1.380508 206.3634
## [268,] 12.026567 17.66037 0.823280 210.2222 1.494623 206.4892
## [269,] 12.136029 17.96648 0.835574 211.0000 1.180966 206.3979
## [270,] 12.298185 18.43244 0.855167 210.3333 3.630946 205.9306
## [271,] 12.122456 18.10990 0.856197 208.0000 4.508540 205.4732
## [272,] 12.715985 18.00555 0.846907 207.0000 1.229972 204.6796
## [273,] 11.433000 17.89280 0.848410 207.5000 3.308189 210.9083
## [274,] 11.097524 18.34174 0.861704 207.0000 5.720357 212.1226
## [275,] 12.078147 19.67345 0.866817 204.5000 5.589362 205.4466
## [276,] 9.787512 17.72488 0.818078 212.6667 2.291358 205.9218
## [277,] 9.977851 17.93497 0.844989 212.0000 3.971073 207.1207
## [278,] 10.401154 17.04784 0.848807 210.0000 1.192970 206.7147
## [279,] 10.185048 17.19309 0.838659 210.0000 0.281328 206.9503
## [280,] 11.695016 17.65305 0.831923 210.5000 2.276920 206.2647
## [281,] 12.247611 18.35720 0.843948 210.3333 1.731291 206.4828
## [282,] 12.025920 18.36328 0.839912 209.5000 3.270202 206.1123
## [283,] 11.256382 18.32035 0.829359 208.3333 4.489935 205.3742
## [284,] 11.515895 18.41900 0.832789 209.0000 4.915900 204.6418
## [285,] 11.611375 18.73189 0.852465 209.3333 4.350432 208.2343
## [286,] 9.577556 17.74167 0.804340 213.1667 1.191299 206.9770
## [287,] 9.894512 17.67345 0.831047 212.1111 3.048190 207.8832
## [288,] 10.346464 17.80915 0.838290 211.3333 3.132002 207.5258
## [289,] 10.386561 17.27867 0.828603 210.7778 3.312014 207.4212
## [290,] 9.972537 16.80343 0.833425 211.3333 2.262116 207.1158
## [291,] 11.363155 17.82667 0.843895 210.7778 2.962719 206.1141
## [292,] 11.511292 18.15106 0.836312 209.8333 2.286170 206.2850
## [293,] 11.321532 18.56879 0.808821 209.0000 2.715691 205.8256
## [294,] 11.403831 18.60643 0.804109 208.6667 4.780660 205.4207
## [295,] 12.237587 19.39965 0.828916 209.8889 2.595346 204.7865
## [296,] 10.013111 17.44778 0.802328 212.8333 2.800913 208.1229
## [297,] 9.645260 17.53826 0.826260 212.5000 3.006227 208.1408
## [298,] 10.961389 18.04187 0.835826 212.5000 2.802492 207.5593
## [299,] 9.826764 17.54689 0.843641 212.5000 2.385940 206.4362
## [300,] 9.692833 17.14611 0.840611 212.6667 3.459422 205.2322
## [301,] 11.477929 18.16683 0.824012 210.0000 7.497325 206.2511
## [302,] 11.563340 18.74846 0.814689 207.1667 6.410306 206.1078
## [303,] 10.787655 18.61794 0.815784 205.5000 6.839028 205.4652
## [304,] 10.040680 17.56948 0.819922 213.1111 1.389929 207.7260
## [305,] 11.507673 17.99358 0.839661 212.6667 1.531505 207.4729
## [306,] 9.891250 18.13896 0.826877 213.3333 2.869667 207.5030
## [307,] 9.972969 17.30525 0.825225 211.8333 8.230437 205.3955
## [308,] 10.590700 18.89458 0.834841 207.0000 9.589556 206.0401
## [309,] 9.565263 18.37484 0.800520 211.7500 3.309488 207.5483
## [310,] 9.002500 18.15950 0.820314 212.1667 4.362813 207.6438
## [311,] 9.762534 18.99889 0.837665 212.7500 4.403135 207.4406
## [312,] 9.225618 18.51444 0.796948 209.6667 8.798860 205.7614
## [313,] 9.394625 18.19100 0.777866 212.0000 2.791830 207.6968
############################### Variables respuesta
v_res75 <- X_x[,1]
v_res150 <- X_x[,2]
############################### Variables explicativas (independientes)
v_exp75 <- X_x[,2:6]
v_exp150 <- X_x[,c(1,3:6)]
x75 <- as.matrix(v_exp75)
x150 <- as.matrix(v_exp150)
xydat <- as.matrix(BD_MODELADO[,1:2])
MD <- as.matrix(dist(xydat, diag = T, upper = T))
MD_inv <- as.matrix(1/MD)
diag(MD_inv) <- 0
W <- as.matrix(MD_inv)
suma <- apply(W, 1, sum)
We <- W/suma # Estandarizado
apply(We, 1, sum)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 301 302 303 304 305 306 307 308 309 310 311 312 313
## 1 1 1 1 1 1 1 1 1 1 1 1 1
Moran_o <- list() # Observado
Moran_p <-list() # p.valor
for(j in 1:6){
Moran_o[j]=Moran.I(X_x[,j], We)$observed
}
for(j in 1:6){
Moran_p[j]=Moran.I(X_x[,j], We)$p.value
}
Moran_o <- as.vector(Moran_o)
list(Moran_o,Moran_p)
## [[1]]
## [[1]][[1]]
## [1] 0.2687468
##
## [[1]][[2]]
## [1] 0.160951
##
## [[1]][[3]]
## [1] 0.09750403
##
## [[1]][[4]]
## [1] 0.3096708
##
## [[1]][[5]]
## [1] 0.06993324
##
## [[1]][[6]]
## [1] 0.3505031
##
##
## [[2]]
## [[2]][[1]]
## [1] 0
##
## [[2]][[2]]
## [1] 0
##
## [[2]][[3]]
## [1] 0
##
## [[2]][[4]]
## [1] 0
##
## [[2]][[5]]
## [1] 0
##
## [[2]][[6]]
## [1] 0
data.frame(list(Moran_o,Moran_p))
## X0.268746828627044 X0.160951018381243 X0.0975040302526088 X0.309670845207254
## 1 0.2687468 0.160951 0.09750403 0.3096708
## X0.0699332392625859 X0.350503097268066 X0 X0.1 X0.2 X0.3 X0.4 X0.5
## 1 0.06993324 0.3505031 0 0 0 0 0 0
MCP <- rcorr(as.matrix(X_x[,1:6]), type = 'p')
MCS <- rcorr(as.matrix(X_x[,1:6]), type = 's')
Mcorp <- MCP$r
Mcors <- MCS$r
par(mfrow = c(1,2))
corrplot(Mcorp, order = 'hclust', tl.col = 'black', tl.srt = 45, main = 'Pearson')
corrplot(Mcors, order = 'hclust', tl.col = 'black', tl.srt = 45, main = 'Spearman')
des <- describe(X_x[,1:6])
datatable(des,class = 'cell-border stripe')
par(mfrow = c(1,2))
boxplot(X_x[,1], main = 'bx_CE_75')
hist(X_x[,1], main = 'hist_CE_75')
par(mfrow = c(1,2))
boxplot(X_x[,2], main = 'bx_CE_150')
hist(X_x[,2], main = 'hist_CE_150')
bx_75
hist_75
bx_150
hist_150
cvm_75<-cvm.test(X_x[,1]);cvm_75
##
## Cramer-von Mises normality test
##
## data: X_x[, 1]
## W = 0.13062, p-value = 0.04289
cvm_150<-cvm.test(X_x[,2]);cvm_150
##
## Cramer-von Mises normality test
##
## data: X_x[, 2]
## W = 0.19809, p-value = 0.005641
shp_75<-shapiro.test(X_x[,1]);shp_75
##
## Shapiro-Wilk normality test
##
## data: X_x[, 1]
## W = 0.99217, p-value = 0.09827
shp_150<-shapiro.test(X_x[,2]);shp_150
##
## Shapiro-Wilk normality test
##
## data: X_x[, 2]
## W = 0.97785, p-value = 9.283e-05
shapi <- c()
for(j in 1:6){
shapi[j]<- sf.test(X_x[,j])$p.value
}
shapi
## [1] 2.012501e-01 1.413917e-04 5.193185e-12 1.654850e-06 4.550567e-08
## [6] 5.770683e-04
lillie.test(X_x[,1])
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: X_x[, 1]
## D = 0.047286, p-value = 0.08837
lillie.test(X_x[,2])
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: X_x[, 2]
## D = 0.064556, p-value = 0.003126
ks.test(X_x[,1], X_x[,2])
##
## Two-sample Kolmogorov-Smirnov test
##
## data: X_x[, 1] and X_x[, 2]
## D = 1, p-value < 2.2e-16
## alternative hypothesis: two-sided
ad.test(X_x[,1])
##
## Anderson-Darling normality test
##
## data: X_x[, 1]
## A = 0.7015, p-value = 0.06643
ad.test(X_x[,2])
##
## Anderson-Darling normality test
##
## data: X_x[, 2]
## A = 1.1882, p-value = 0.004171
mod_cla75 <- lm(CE_70cm~Slope+z+CE_150cm)
mod_cla150 <- lm(CE_150cm~Slope+z+CE_70cm)
mod_cla75_log <- lm(CE_70cm~Slope+z+log(CE_150cm))
mod_cla150_log <- lm(log(CE_150cm)~Slope+z+CE_70cm)
summary(mod_cla75)
##
## Call:
## lm(formula = CE_70cm ~ Slope + z + CE_150cm)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.41298 -0.71115 -0.05541 0.64834 3.01718
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -73.98404 4.74765 -15.583 < 2e-16 ***
## Slope -0.12525 0.02799 -4.475 1.07e-05 ***
## z 0.33680 0.01834 18.369 < 2e-16 ***
## CE_150cm 0.86887 0.09270 9.373 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.05 on 309 degrees of freedom
## Multiple R-squared: 0.5315, Adjusted R-squared: 0.527
## F-statistic: 116.9 on 3 and 309 DF, p-value: < 2.2e-16
summary(mod_cla150)
##
## Call:
## lm(formula = CE_150cm ~ Slope + z + CE_70cm)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.50608 -0.39071 0.01281 0.36509 2.04703
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 47.55651 2.11792 22.454 < 2e-16 ***
## Slope 0.07595 0.01503 5.053 7.45e-07 ***
## z -0.15733 0.01123 -14.009 < 2e-16 ***
## CE_70cm 0.25480 0.02718 9.373 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5686 on 309 degrees of freedom
## Multiple R-squared: 0.4107, Adjusted R-squared: 0.405
## F-statistic: 71.78 on 3 and 309 DF, p-value: < 2.2e-16
summary(mod_cla75_log)
##
## Call:
## lm(formula = CE_70cm ~ Slope + z + log(CE_150cm))
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.42707 -0.71701 -0.05763 0.63705 3.00432
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -104.75300 7.56476 -13.847 < 2e-16 ***
## Slope -0.12589 0.02811 -4.479 1.06e-05 ***
## z 0.33663 0.01844 18.259 < 2e-16 ***
## log(CE_150cm) 16.07153 1.74114 9.230 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.054 on 309 degrees of freedom
## Multiple R-squared: 0.5284, Adjusted R-squared: 0.5238
## F-statistic: 115.4 on 3 and 309 DF, p-value: < 2.2e-16
summary(mod_cla150_log)
##
## Call:
## lm(formula = log(CE_150cm) ~ Slope + z + CE_70cm)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.084372 -0.020934 0.000798 0.020035 0.105152
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.4718190 0.1135149 39.394 < 2e-16 ***
## Slope 0.0041209 0.0008056 5.115 5.51e-07 ***
## z -0.0084111 0.0006019 -13.973 < 2e-16 ***
## CE_70cm 0.0134484 0.0014570 9.230 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.03048 on 309 degrees of freedom
## Multiple R-squared: 0.4101, Adjusted R-squared: 0.4044
## F-statistic: 71.61 on 3 and 309 DF, p-value: < 2.2e-16
res1 <- mod_cla75$residuals
shapiro.test(res1)
##
## Shapiro-Wilk normality test
##
## data: res1
## W = 0.99092, p-value = 0.05044
res1_2 <- mod_cla150$residuals
shapiro.test(res1_2)
##
## Shapiro-Wilk normality test
##
## data: res1_2
## W = 0.99144, p-value = 0.06673
hist(res1)
hist(res1_2)
res2 <- mod_cla75_log$residuals
shapiro.test(res2)
##
## Shapiro-Wilk normality test
##
## data: res2
## W = 0.99096, p-value = 0.05142
res2_2 <- mod_cla150_log$residuals
shapiro.test(res2_2)
##
## Shapiro-Wilk normality test
##
## data: res2_2
## W = 0.99467, p-value = 0.3489
hist(res2)
hist(res2_2)
Para que un modelo sea considerado adecuado, es necesario que sus residuosestén normalmente distribuidos es decir están normal e independientemente distribuidoscon media 0 y varianza mínima
skew(X_x[,1])
## [1] 0.1002837
skewness.norm.test(X_x[,1])
##
## Skewness test for normality
##
## data: X_x[, 1]
## T = 0.10077, p-value = 0.4695
skew(X_x[,2])
## [1] 0.5702493
skewness.norm.test(X_x[,2]) # No es simétrico
##
## Skewness test for normality
##
## data: X_x[, 2]
## T = 0.57299, p-value = 5e-04
skew(res1)
## [1] 0.2441868
skew(res1_2)
## [1] 0.257621
skewness.norm.test(res1)
##
## Skewness test for normality
##
## data: res1
## T = 0.24536, p-value = 0.085
skewness.norm.test(res1_2)
##
## Skewness test for normality
##
## data: res1_2
## T = 0.25886, p-value = 0.0545
skew(res2)
## [1] 0.2440019
skew(res2_2)
## [1] 0.1342606
skewness.norm.test(res2)
##
## Skewness test for normality
##
## data: res2
## T = 0.24518, p-value = 0.072
skewness.norm.test(res2_2)
##
## Skewness test for normality
##
## data: res2_2
## T = 0.13491, p-value = 0.3105
estima1 <- mod_cla75$fitted.values
estima1_2 <- mod_cla150$fitted.values
estima2 <- mod_cla75_log$fitted.values
estima2_2 <- mod_cla150_log$fitted.values
plot(CE_70cm, estima1,pch=16)
plot(CE_70cm, estima1_2,pch=16)
plot(CE_150cm, estima2,pch=16) ##Error
plot(CE_150cm, estima2_2,pch=16) ##Error
cor(CE_70cm, estima1)
## [1] 0.7290603
cor(CE_70cm, estima1_2)
## [1] 0.01700518
cor(CE_150cm, estima1)
## [1] 0.01494752
cor(CE_150cm, estima1_2)
## [1] 0.6408426
res_c1 <- mod_cla75$residuals
res_c2 <- mod_cla150$residuals
shapiro.test(res_c1)
##
## Shapiro-Wilk normality test
##
## data: res_c1
## W = 0.99092, p-value = 0.05044
shapiro.test(res_c2)
##
## Shapiro-Wilk normality test
##
## data: res_c2
## W = 0.99144, p-value = 0.06673
cvm.test(res_c1)
##
## Cramer-von Mises normality test
##
## data: res_c1
## W = 0.1071, p-value = 0.08941
cvm.test(res_c2)
##
## Cramer-von Mises normality test
##
## data: res_c2
## W = 0.035689, p-value = 0.7586
moranres1 <- Moran.I(res_c1, We); moranres1
## $observed
## [1] 0.1580117
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.004665226
##
## $p.value
## [1] 0
moranres2 <- Moran.I(res_c2, We); moranres2
## $observed
## [1] 0.08362486
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.004659635
##
## $p.value
## [1] 0
AIC(mod_cla75)
## [1] 924.809
AIC(mod_cla75_log)
## [1] 926.9123
AIC(mod_cla150)
## [1] 540.8476
AIC(mod_cla150_log)
## [1] -1290.988
Muestra dependencia espacial (\(p~value = 0\))
\[Y = \lambda W Y + u\]
contnb <- dnearneigh(coordinates(xydat),0,854, longlat = F)
contnb
## Neighbour list object:
## Number of regions: 313
## Number of nonzero links: 97656
## Percentage nonzero weights: 99.68051
## Average number of links: 312
dlist <- nbdists(contnb, xydat)
dlist <- lapply(dlist, function(x) 1/x)
Wve <- nb2listw(contnb, glist = dlist, style = 'W')
map_75 <- spautolm(CE_70cm~1, data = BD_MODELADO, listw = Wve) ### modelo
summary(map_75)
##
## Call: spautolm(formula = CE_70cm ~ 1, data = BD_MODELADO, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.258254 -0.650679 -0.071829 0.824652 3.063002
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 5.6941 5.5177 1.032 0.3021
##
## Lambda: 0.98811 LR test value: 162.5 p-value: < 2.22e-16
## Numerical Hessian standard error of lambda: 0.011866
##
## Log likelihood: -494.8231
## ML residual variance (sigma squared): 1.347, (sigma: 1.1606)
## Number of observations: 313
## Number of parameters estimated: 3
## AIC: 995.65
CE75E1 <- as.data.frame(map_75$fit['fitted.values']); CE75E1
## fitted.values
## 1 8.630840
## 2 8.677614
## 3 8.915327
## 4 8.905593
## 5 8.823590
## 6 8.855964
## 7 8.926651
## 8 9.075587
## 9 9.005442
## 10 8.976890
## 11 8.884608
## 12 8.891069
## 13 9.005997
## 14 9.118444
## 15 9.063342
## 16 9.078390
## 17 9.017083
## 18 8.963977
## 19 9.010809
## 20 9.140845
## 21 9.167758
## 22 9.153547
## 23 9.161890
## 24 9.176344
## 25 9.082528
## 26 9.056709
## 27 9.047807
## 28 9.067164
## 29 9.044682
## 30 9.188022
## 31 9.163653
## 32 9.219194
## 33 9.234668
## 34 9.277458
## 35 9.209232
## 36 9.114491
## 37 9.141687
## 38 9.057097
## 39 9.063203
## 40 9.085082
## 41 9.378154
## 42 9.408673
## 43 9.350574
## 44 9.303262
## 45 9.199406
## 46 9.206472
## 47 9.220954
## 48 9.298079
## 49 9.335869
## 50 9.343705
## 51 9.167121
## 52 9.217638
## 53 9.132135
## 54 9.139613
## 55 9.231274
## 56 9.389832
## 57 9.362198
## 58 9.363906
## 59 9.307090
## 60 9.269509
## 61 9.237040
## 62 9.217758
## 63 9.224031
## 64 9.251322
## 65 9.305770
## 66 9.390986
## 67 9.417336
## 68 9.412515
## 69 9.359436
## 70 9.265487
## 71 9.323860
## 72 9.216384
## 73 9.265595
## 74 9.377446
## 75 9.364359
## 76 9.364638
## 77 9.321254
## 78 9.261893
## 79 9.232669
## 80 9.231064
## 81 9.248915
## 82 9.286159
## 83 9.333348
## 84 9.411793
## 85 9.473314
## 86 9.507532
## 87 9.487591
## 88 9.492216
## 89 9.438128
## 90 9.360970
## 91 9.410562
## 92 9.516229
## 93 9.336716
## 94 9.326413
## 95 9.286560
## 96 9.254454
## 97 9.257587
## 98 9.284867
## 99 9.320253
## 100 9.381706
## 101 9.459042
## 102 9.511379
## 103 9.571877
## 104 9.627686
## 105 9.585429
## 106 9.614270
## 107 9.609465
## 108 9.549948
## 109 9.569025
## 110 9.544636
## 111 9.603785
## 112 9.673825
## 113 9.327980
## 114 9.318167
## 115 9.295318
## 116 9.285032
## 117 9.312384
## 118 9.365627
## 119 9.415135
## 120 9.483652
## 121 9.557407
## 122 9.622419
## 123 9.680956
## 124 9.732745
## 125 9.710612
## 126 9.783932
## 127 9.711586
## 128 9.682039
## 129 9.637150
## 130 9.715744
## 131 9.825931
## 132 9.342910
## 133 9.345081
## 134 9.326101
## 135 9.354201
## 136 9.394458
## 137 9.461977
## 138 9.513767
## 139 9.585866
## 140 9.668500
## 141 9.741886
## 142 9.813041
## 143 9.862624
## 144 9.863708
## 145 9.918466
## 146 9.819380
## 147 9.896345
## 148 9.794386
## 149 9.909616
## 150 10.018022
## 151 9.370459
## 152 9.396344
## 153 9.397768
## 154 9.440066
## 155 9.475501
## 156 9.549499
## 157 9.594048
## 158 9.698029
## 159 9.792031
## 160 9.873133
## 161 9.946706
## 162 10.008109
## 163 10.030590
## 164 10.049422
## 165 9.961859
## 166 10.018371
## 167 10.064259
## 168 10.001980
## 169 10.168103
## 170 10.080632
## 171 9.450354
## 172 9.473966
## 173 9.505532
## 174 9.554041
## 175 9.617729
## 176 9.704815
## 177 9.823379
## 178 9.924799
## 179 10.022862
## 180 10.091492
## 181 10.156716
## 182 10.205185
## 183 10.190925
## 184 10.121674
## 185 10.218721
## 186 10.237673
## 187 10.242297
## 188 10.244078
## 189 10.229002
## 190 9.499370
## 191 9.534347
## 192 9.562697
## 193 9.653501
## 194 9.741415
## 195 9.860718
## 196 10.003750
## 197 10.091862
## 198 10.189355
## 199 10.258322
## 200 10.327001
## 201 10.389451
## 202 10.366534
## 203 10.445209
## 204 10.351633
## 205 10.353167
## 206 10.409873
## 207 10.181927
## 208 10.190122
## 209 10.152500
## 210 9.569718
## 211 9.614854
## 212 9.684341
## 213 9.780383
## 214 9.894219
## 215 10.004780
## 216 10.165121
## 217 10.250997
## 218 10.333902
## 219 10.422199
## 220 10.494593
## 221 10.515605
## 222 10.530251
## 223 10.565920
## 224 10.448753
## 225 10.397189
## 226 10.337385
## 227 10.094549
## 228 10.103404
## 229 9.645302
## 230 9.725853
## 231 9.801962
## 232 9.922671
## 233 10.038751
## 234 10.155774
## 235 10.301679
## 236 10.361338
## 237 10.481864
## 238 10.547544
## 239 10.571096
## 240 10.625096
## 241 10.613946
## 242 10.564767
## 243 10.448957
## 244 10.379680
## 245 10.269619
## 246 10.065831
## 247 9.796441
## 248 9.855822
## 249 9.955503
## 250 10.039782
## 251 10.160609
## 252 10.322054
## 253 10.371750
## 254 10.463036
## 255 10.571733
## 256 10.613959
## 257 10.616121
## 258 10.642185
## 259 10.612025
## 260 10.491943
## 261 10.379680
## 262 10.295154
## 263 9.971460
## 264 10.043301
## 265 10.106938
## 266 10.256499
## 267 10.371095
## 268 10.411438
## 269 10.525438
## 270 10.589570
## 271 10.618749
## 272 10.594193
## 273 10.601849
## 274 10.557440
## 275 10.402316
## 276 10.074898
## 277 10.191610
## 278 10.286434
## 279 10.385871
## 280 10.436874
## 281 10.548901
## 282 10.565375
## 283 10.576566
## 284 10.560897
## 285 10.515728
## 286 10.127149
## 287 10.134714
## 288 10.229896
## 289 10.307888
## 290 10.358705
## 291 10.444804
## 292 10.503041
## 293 10.496880
## 294 10.503109
## 295 10.449893
## 296 10.162679
## 297 10.199231
## 298 10.235332
## 299 10.304722
## 300 10.343512
## 301 10.412607
## 302 10.396544
## 303 10.426268
## 304 10.217876
## 305 10.179873
## 306 10.228171
## 307 10.295167
## 308 10.311777
## 309 10.190402
## 310 10.166322
## 311 10.179021
## 312 10.266246
## 313 10.132241
CE75E <- map_75$fit$fitted.values ## Estimados
CE75E
## 1 2 3 4 5 6 7 8
## 8.630840 8.677614 8.915327 8.905593 8.823590 8.855964 8.926651 9.075587
## 9 10 11 12 13 14 15 16
## 9.005442 8.976890 8.884608 8.891069 9.005997 9.118444 9.063342 9.078390
## 17 18 19 20 21 22 23 24
## 9.017083 8.963977 9.010809 9.140845 9.167758 9.153547 9.161890 9.176344
## 25 26 27 28 29 30 31 32
## 9.082528 9.056709 9.047807 9.067164 9.044682 9.188022 9.163653 9.219194
## 33 34 35 36 37 38 39 40
## 9.234668 9.277458 9.209232 9.114491 9.141687 9.057097 9.063203 9.085082
## 41 42 43 44 45 46 47 48
## 9.378154 9.408673 9.350574 9.303262 9.199406 9.206472 9.220954 9.298079
## 49 50 51 52 53 54 55 56
## 9.335869 9.343705 9.167121 9.217638 9.132135 9.139613 9.231274 9.389832
## 57 58 59 60 61 62 63 64
## 9.362198 9.363906 9.307090 9.269509 9.237040 9.217758 9.224031 9.251322
## 65 66 67 68 69 70 71 72
## 9.305770 9.390986 9.417336 9.412515 9.359436 9.265487 9.323860 9.216384
## 73 74 75 76 77 78 79 80
## 9.265595 9.377446 9.364359 9.364638 9.321254 9.261893 9.232669 9.231064
## 81 82 83 84 85 86 87 88
## 9.248915 9.286159 9.333348 9.411793 9.473314 9.507532 9.487591 9.492216
## 89 90 91 92 93 94 95 96
## 9.438128 9.360970 9.410562 9.516229 9.336716 9.326413 9.286560 9.254454
## 97 98 99 100 101 102 103 104
## 9.257587 9.284867 9.320253 9.381706 9.459042 9.511379 9.571877 9.627686
## 105 106 107 108 109 110 111 112
## 9.585429 9.614270 9.609465 9.549948 9.569025 9.544636 9.603785 9.673825
## 113 114 115 116 117 118 119 120
## 9.327980 9.318167 9.295318 9.285032 9.312384 9.365627 9.415135 9.483652
## 121 122 123 124 125 126 127 128
## 9.557407 9.622419 9.680956 9.732745 9.710612 9.783932 9.711586 9.682039
## 129 130 131 132 133 134 135 136
## 9.637150 9.715744 9.825931 9.342910 9.345081 9.326101 9.354201 9.394458
## 137 138 139 140 141 142 143 144
## 9.461977 9.513767 9.585866 9.668500 9.741886 9.813041 9.862624 9.863708
## 145 146 147 148 149 150 151 152
## 9.918466 9.819380 9.896345 9.794386 9.909616 10.018022 9.370459 9.396344
## 153 154 155 156 157 158 159 160
## 9.397768 9.440066 9.475501 9.549499 9.594048 9.698029 9.792031 9.873133
## 161 162 163 164 165 166 167 168
## 9.946706 10.008109 10.030590 10.049422 9.961859 10.018371 10.064259 10.001980
## 169 170 171 172 173 174 175 176
## 10.168103 10.080632 9.450354 9.473966 9.505532 9.554041 9.617729 9.704815
## 177 178 179 180 181 182 183 184
## 9.823379 9.924799 10.022862 10.091492 10.156716 10.205185 10.190925 10.121674
## 185 186 187 188 189 190 191 192
## 10.218721 10.237673 10.242297 10.244078 10.229002 9.499370 9.534347 9.562697
## 193 194 195 196 197 198 199 200
## 9.653501 9.741415 9.860718 10.003750 10.091862 10.189355 10.258322 10.327001
## 201 202 203 204 205 206 207 208
## 10.389451 10.366534 10.445209 10.351633 10.353167 10.409873 10.181927 10.190122
## 209 210 211 212 213 214 215 216
## 10.152500 9.569718 9.614854 9.684341 9.780383 9.894219 10.004780 10.165121
## 217 218 219 220 221 222 223 224
## 10.250997 10.333902 10.422199 10.494593 10.515605 10.530251 10.565920 10.448753
## 225 226 227 228 229 230 231 232
## 10.397189 10.337385 10.094549 10.103404 9.645302 9.725853 9.801962 9.922671
## 233 234 235 236 237 238 239 240
## 10.038751 10.155774 10.301679 10.361338 10.481864 10.547544 10.571096 10.625096
## 241 242 243 244 245 246 247 248
## 10.613946 10.564767 10.448957 10.379680 10.269619 10.065831 9.796441 9.855822
## 249 250 251 252 253 254 255 256
## 9.955503 10.039782 10.160609 10.322054 10.371750 10.463036 10.571733 10.613959
## 257 258 259 260 261 262 263 264
## 10.616121 10.642185 10.612025 10.491943 10.379680 10.295154 9.971460 10.043301
## 265 266 267 268 269 270 271 272
## 10.106938 10.256499 10.371095 10.411438 10.525438 10.589570 10.618749 10.594193
## 273 274 275 276 277 278 279 280
## 10.601849 10.557440 10.402316 10.074898 10.191610 10.286434 10.385871 10.436874
## 281 282 283 284 285 286 287 288
## 10.548901 10.565375 10.576566 10.560897 10.515728 10.127149 10.134714 10.229896
## 289 290 291 292 293 294 295 296
## 10.307888 10.358705 10.444804 10.503041 10.496880 10.503109 10.449893 10.162679
## 297 298 299 300 301 302 303 304
## 10.199231 10.235332 10.304722 10.343512 10.412607 10.396544 10.426268 10.217876
## 305 306 307 308 309 310 311 312
## 10.179873 10.228171 10.295167 10.311777 10.190402 10.166322 10.179021 10.266246
## 313
## 10.132241
df75 <- data.frame(v_res75, CE75E)
colnames(df75) <- c('CE_obs','CE_est')
plot(df75$CE_obs, df75$CE_est, cex=0.5, pch =19)
resmap1 <- map_75$fit$residuals
cor(df75$CE_obs, df75$CE_est)
## [1] 0.7977199
plot(x = x, y = y, col = floor(abs(resmap1))+1, pch =19)
plot(x = x, y = y, cex =abs(resmap1), pch =19)
plot(x = x, y = y, cex =0.1*df75$CE_obs, pch =19)
data2 <- data.frame(x = x, y = y, df75$CE_obs, df75$CE_est)
colnames(data2) <- c('x', 'y', 'CE_obs', 'CE_est')
p<-ggplot(data = data2, aes(x = x, y = y)) +
geom_point(cex = data2$CE_obs*0.2) +
geom_point(color = data2$CE_est)
p
im_res_map_75 <- moran.mc(resmap1,Wve,nsim = 2000);im_res_map_75
##
## Monte-Carlo simulation of Moran I
##
## data: resmap1
## weights: Wve
## number of simulations + 1: 2001
##
## statistic = 0.16722, observed rank = 2001, p-value = 0.0004998
## alternative hypothesis: greater
map_150 <- spautolm(CE_150cm~1, data = BD_MODELADO, listw = Wve) ### modelo
summary(map_150)
##
## Call: spautolm(formula = CE_150cm ~ 1, data = BD_MODELADO, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.453255 -0.397645 -0.042934 0.322283 2.953512
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 19.3151 1.5515 12.45 < 2.2e-16
##
## Lambda: 0.97691 LR test value: 86.774 p-value: < 2.22e-16
## Numerical Hessian standard error of lambda: 0.023
##
## Log likelihood: -304.7918
## ML residual variance (sigma squared): 0.40168, (sigma: 0.63378)
## Number of observations: 313
## Number of parameters estimated: 3
## AIC: 615.58
CE150E <- as.data.frame(map_150$fit['fitted.values']); CE150E
## fitted.values
## 1 18.52785
## 2 18.52287
## 3 18.57280
## 4 18.59249
## 5 18.58692
## 6 18.58429
## 7 18.60574
## 8 18.66210
## 9 18.64986
## 10 18.64010
## 11 18.61259
## 12 18.61047
## 13 18.62080
## 14 18.69187
## 15 18.68127
## 16 18.69404
## 17 18.66172
## 18 18.64290
## 19 18.64980
## 20 18.71187
## 21 18.72735
## 22 18.70175
## 23 18.72079
## 24 18.72000
## 25 18.69194
## 26 18.66644
## 27 18.63619
## 28 18.59541
## 29 18.58372
## 30 18.73226
## 31 18.71948
## 32 18.72688
## 33 18.73208
## 34 18.72514
## 35 18.71235
## 36 18.65792
## 37 18.65039
## 38 18.59664
## 39 18.57891
## 40 18.53760
## 41 18.92832
## 42 18.94783
## 43 18.80529
## 44 18.76137
## 45 18.70434
## 46 18.71537
## 47 18.70933
## 48 18.73404
## 49 18.72312
## 50 18.69247
## 51 18.62588
## 52 18.60656
## 53 18.57019
## 54 18.53476
## 55 18.51103
## 56 18.86025
## 57 18.90811
## 58 18.84594
## 59 18.78666
## 60 18.72694
## 61 18.70458
## 62 18.70530
## 63 18.69862
## 64 18.69999
## 65 18.68783
## 66 18.70933
## 67 18.68440
## 68 18.64493
## 69 18.61894
## 70 18.59883
## 71 18.57876
## 72 18.53169
## 73 18.49566
## 74 18.47832
## 75 18.84340
## 76 18.81974
## 77 18.78467
## 78 18.73816
## 79 18.70454
## 80 18.68101
## 81 18.69332
## 82 18.68705
## 83 18.68221
## 84 18.66097
## 85 18.66383
## 86 18.64597
## 87 18.60733
## 88 18.58534
## 89 18.54641
## 90 18.47800
## 91 18.45103
## 92 18.46877
## 93 18.79521
## 94 18.78479
## 95 18.73737
## 96 18.72034
## 97 18.70519
## 98 18.68284
## 99 18.67235
## 100 18.65334
## 101 18.63925
## 102 18.62109
## 103 18.61992
## 104 18.62131
## 105 18.58920
## 106 18.59467
## 107 18.54976
## 108 18.49953
## 109 18.45963
## 110 18.42102
## 111 18.43043
## 112 18.43541
## 113 18.77734
## 114 18.75159
## 115 18.71822
## 116 18.71014
## 117 18.68773
## 118 18.66184
## 119 18.65135
## 120 18.60598
## 121 18.59823
## 122 18.58822
## 123 18.57921
## 124 18.58561
## 125 18.56355
## 126 18.53889
## 127 18.49161
## 128 18.45301
## 129 18.41059
## 130 18.42328
## 131 18.44824
## 132 18.74644
## 133 18.73701
## 134 18.69780
## 135 18.68108
## 136 18.65032
## 137 18.61554
## 138 18.58124
## 139 18.55751
## 140 18.55188
## 141 18.54427
## 142 18.52679
## 143 18.53819
## 144 18.50473
## 145 18.45438
## 146 18.42358
## 147 18.40740
## 148 18.41788
## 149 18.45055
## 150 18.48798
## 151 18.71723
## 152 18.68337
## 153 18.66375
## 154 18.62995
## 155 18.58777
## 156 18.54992
## 157 18.50956
## 158 18.50618
## 159 18.50366
## 160 18.48426
## 161 18.45201
## 162 18.46790
## 163 18.42114
## 164 18.38231
## 165 18.38883
## 166 18.39723
## 167 18.42274
## 168 18.46956
## 169 18.51260
## 170 18.49427
## 171 18.62696
## 172 18.60701
## 173 18.56403
## 174 18.51665
## 175 18.47276
## 176 18.43859
## 177 18.44271
## 178 18.42848
## 179 18.40327
## 180 18.37624
## 181 18.38781
## 182 18.35437
## 183 18.35135
## 184 18.38275
## 185 18.40136
## 186 18.43420
## 187 18.48893
## 188 18.55498
## 189 18.59323
## 190 18.57702
## 191 18.52726
## 192 18.48172
## 193 18.44259
## 194 18.39346
## 195 18.37570
## 196 18.37148
## 197 18.34830
## 198 18.32997
## 199 18.32070
## 200 18.31307
## 201 18.32443
## 202 18.34594
## 203 18.37164
## 204 18.41160
## 205 18.46911
## 206 18.49505
## 207 18.55987
## 208 18.66724
## 209 18.69753
## 210 18.49892
## 211 18.44692
## 212 18.39300
## 213 18.35304
## 214 18.32411
## 215 18.30470
## 216 18.29889
## 217 18.26726
## 218 18.28266
## 219 18.27956
## 220 18.27793
## 221 18.33452
## 222 18.37798
## 223 18.39186
## 224 18.44633
## 225 18.49241
## 226 18.54651
## 227 18.59851
## 228 18.69801
## 229 18.40964
## 230 18.36630
## 231 18.31547
## 232 18.27738
## 233 18.26539
## 234 18.25035
## 235 18.24609
## 236 18.22820
## 237 18.26367
## 238 18.27156
## 239 18.30553
## 240 18.36092
## 241 18.40662
## 242 18.41801
## 243 18.51526
## 244 18.54508
## 245 18.59558
## 246 18.60206
## 247 18.33551
## 248 18.30573
## 249 18.25535
## 250 18.22561
## 251 18.23082
## 252 18.22310
## 253 18.20605
## 254 18.23014
## 255 18.26981
## 256 18.30021
## 257 18.32392
## 258 18.39786
## 259 18.43537
## 260 18.45998
## 261 18.55240
## 262 18.54707
## 263 18.26652
## 264 18.22921
## 265 18.18818
## 266 18.20361
## 267 18.19729
## 268 18.20094
## 269 18.25477
## 270 18.28379
## 271 18.32873
## 272 18.37231
## 273 18.43194
## 274 18.46629
## 275 18.48105
## 276 18.24201
## 277 18.18148
## 278 18.18920
## 279 18.19415
## 280 18.22709
## 281 18.27929
## 282 18.31578
## 283 18.36803
## 284 18.41803
## 285 18.46093
## 286 18.21498
## 287 18.20373
## 288 18.17309
## 289 18.18639
## 290 18.22081
## 291 18.26392
## 292 18.31994
## 293 18.35996
## 294 18.42162
## 295 18.43125
## 296 18.20443
## 297 18.20964
## 298 18.18366
## 299 18.21554
## 300 18.27537
## 301 18.32275
## 302 18.36084
## 303 18.40570
## 304 18.24725
## 305 18.24610
## 306 18.27406
## 307 18.34829
## 308 18.36061
## 309 18.27555
## 310 18.31639
## 311 18.32402
## 312 18.37356
## 313 18.33938
CE150E <- map_150$fit$fitted.values ## Estimados
CE150E
## 1 2 3 4 5 6 7 8
## 18.52785 18.52287 18.57280 18.59249 18.58692 18.58429 18.60574 18.66210
## 9 10 11 12 13 14 15 16
## 18.64986 18.64010 18.61259 18.61047 18.62080 18.69187 18.68127 18.69404
## 17 18 19 20 21 22 23 24
## 18.66172 18.64290 18.64980 18.71187 18.72735 18.70175 18.72079 18.72000
## 25 26 27 28 29 30 31 32
## 18.69194 18.66644 18.63619 18.59541 18.58372 18.73226 18.71948 18.72688
## 33 34 35 36 37 38 39 40
## 18.73208 18.72514 18.71235 18.65792 18.65039 18.59664 18.57891 18.53760
## 41 42 43 44 45 46 47 48
## 18.92832 18.94783 18.80529 18.76137 18.70434 18.71537 18.70933 18.73404
## 49 50 51 52 53 54 55 56
## 18.72312 18.69247 18.62588 18.60656 18.57019 18.53476 18.51103 18.86025
## 57 58 59 60 61 62 63 64
## 18.90811 18.84594 18.78666 18.72694 18.70458 18.70530 18.69862 18.69999
## 65 66 67 68 69 70 71 72
## 18.68783 18.70933 18.68440 18.64493 18.61894 18.59883 18.57876 18.53169
## 73 74 75 76 77 78 79 80
## 18.49566 18.47832 18.84340 18.81974 18.78467 18.73816 18.70454 18.68101
## 81 82 83 84 85 86 87 88
## 18.69332 18.68705 18.68221 18.66097 18.66383 18.64597 18.60733 18.58534
## 89 90 91 92 93 94 95 96
## 18.54641 18.47800 18.45103 18.46877 18.79521 18.78479 18.73737 18.72034
## 97 98 99 100 101 102 103 104
## 18.70519 18.68284 18.67235 18.65334 18.63925 18.62109 18.61992 18.62131
## 105 106 107 108 109 110 111 112
## 18.58920 18.59467 18.54976 18.49953 18.45963 18.42102 18.43043 18.43541
## 113 114 115 116 117 118 119 120
## 18.77734 18.75159 18.71822 18.71014 18.68773 18.66184 18.65135 18.60598
## 121 122 123 124 125 126 127 128
## 18.59823 18.58822 18.57921 18.58561 18.56355 18.53889 18.49161 18.45301
## 129 130 131 132 133 134 135 136
## 18.41059 18.42328 18.44824 18.74644 18.73701 18.69780 18.68108 18.65032
## 137 138 139 140 141 142 143 144
## 18.61554 18.58124 18.55751 18.55188 18.54427 18.52679 18.53819 18.50473
## 145 146 147 148 149 150 151 152
## 18.45438 18.42358 18.40740 18.41788 18.45055 18.48798 18.71723 18.68337
## 153 154 155 156 157 158 159 160
## 18.66375 18.62995 18.58777 18.54992 18.50956 18.50618 18.50366 18.48426
## 161 162 163 164 165 166 167 168
## 18.45201 18.46790 18.42114 18.38231 18.38883 18.39723 18.42274 18.46956
## 169 170 171 172 173 174 175 176
## 18.51260 18.49427 18.62696 18.60701 18.56403 18.51665 18.47276 18.43859
## 177 178 179 180 181 182 183 184
## 18.44271 18.42848 18.40327 18.37624 18.38781 18.35437 18.35135 18.38275
## 185 186 187 188 189 190 191 192
## 18.40136 18.43420 18.48893 18.55498 18.59323 18.57702 18.52726 18.48172
## 193 194 195 196 197 198 199 200
## 18.44259 18.39346 18.37570 18.37148 18.34830 18.32997 18.32070 18.31307
## 201 202 203 204 205 206 207 208
## 18.32443 18.34594 18.37164 18.41160 18.46911 18.49505 18.55987 18.66724
## 209 210 211 212 213 214 215 216
## 18.69753 18.49892 18.44692 18.39300 18.35304 18.32411 18.30470 18.29889
## 217 218 219 220 221 222 223 224
## 18.26726 18.28266 18.27956 18.27793 18.33452 18.37798 18.39186 18.44633
## 225 226 227 228 229 230 231 232
## 18.49241 18.54651 18.59851 18.69801 18.40964 18.36630 18.31547 18.27738
## 233 234 235 236 237 238 239 240
## 18.26539 18.25035 18.24609 18.22820 18.26367 18.27156 18.30553 18.36092
## 241 242 243 244 245 246 247 248
## 18.40662 18.41801 18.51526 18.54508 18.59558 18.60206 18.33551 18.30573
## 249 250 251 252 253 254 255 256
## 18.25535 18.22561 18.23082 18.22310 18.20605 18.23014 18.26981 18.30021
## 257 258 259 260 261 262 263 264
## 18.32392 18.39786 18.43537 18.45998 18.55240 18.54707 18.26652 18.22921
## 265 266 267 268 269 270 271 272
## 18.18818 18.20361 18.19729 18.20094 18.25477 18.28379 18.32873 18.37231
## 273 274 275 276 277 278 279 280
## 18.43194 18.46629 18.48105 18.24201 18.18148 18.18920 18.19415 18.22709
## 281 282 283 284 285 286 287 288
## 18.27929 18.31578 18.36803 18.41803 18.46093 18.21498 18.20373 18.17309
## 289 290 291 292 293 294 295 296
## 18.18639 18.22081 18.26392 18.31994 18.35996 18.42162 18.43125 18.20443
## 297 298 299 300 301 302 303 304
## 18.20964 18.18366 18.21554 18.27537 18.32275 18.36084 18.40570 18.24725
## 305 306 307 308 309 310 311 312
## 18.24610 18.27406 18.34829 18.36061 18.27555 18.31639 18.32402 18.37356
## 313
## 18.33938
df150 <- data.frame(v_res150, CE150E)
colnames(df150) <- c('CE_obs','CE_est')
plot(df150$CE_obs, df150$CE_est, cex=0.5, pch =19)
resmap2 <- map_150$fit$residuals
cor(df150$CE_obs, df150$CE_est)
## [1] 0.6642671
plot(x = x, y = y, col = floor(abs(resmap2))+1, pch =19)
plot(x = x, y = y, cex =abs(resmap2), pch =19)
plot(x = x, y = y, cex =0.1*df150$CE_obs, pch =19)
data2_1 <- data.frame(x = x, y = y, df75$CE_obs, df150$CE_est)
colnames(data2_1) <- c('x', 'y', 'CE_obs', 'CE_est')
p<-ggplot(data = data2_1, aes(x = x, y = y)) +
geom_point(cex = data2_1$CE_obs*0.2) +
geom_point(color = data2_1$CE_est)
p
im_res_map_150 <- moran.mc(resmap2,Wve,nsim = 2000);im_res_map_150
##
## Monte-Carlo simulation of Moran I
##
## data: resmap2
## weights: Wve
## number of simulations + 1: 2001
##
## statistic = 0.094365, observed rank = 2001, p-value = 0.0004998
## alternative hypothesis: greater
\[Y=\lambda W Y+ \alpha 1_n+ X\beta + \epsilon\]
mod_es_er_1 <- errorsarlm(CE_70cm~NDVI+Slope+z+CE_150cm+DEM,listw=Wve)
summary(mod_es_er_1) # NDVI despreciable
##
## Call:errorsarlm(formula = CE_70cm ~ NDVI + Slope + z + CE_150cm +
## DEM, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.019160 -0.540466 -0.045367 0.513314 2.592838
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -64.737579 5.752902 -11.2530 < 2.2e-16
## NDVI -2.395368 1.907913 -1.2555 0.209301
## Slope -0.073067 0.024760 -2.9510 0.003168
## z 0.257034 0.028465 9.0299 < 2.2e-16
## CE_150cm 0.859898 0.083054 10.3535 < 2.2e-16
## DEM 0.036792 0.020974 1.7542 0.079402
##
## Lambda: 0.9825, LR test value: 99.359, p-value: < 2.22e-16
## Asymptotic standard error: 0.012342
## z-value: 79.604, p-value: < 2.22e-16
## Wald statistic: 6336.8, p-value: < 2.22e-16
##
## Log likelihood: -406.1005 for error model
## ML residual variance (sigma squared): 0.76603, (sigma: 0.87523)
## Number of observations: 313
## Number of parameters estimated: 8
## AIC: 828.2, (AIC for lm: 925.56)
mod_es_er_2 <- errorsarlm(CE_70cm~Slope+z+CE_150cm+DEM,listw=Wve)
summary(mod_es_er_2) # Mejor
##
## Call:errorsarlm(formula = CE_70cm ~ Slope + z + CE_150cm + DEM, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.068942 -0.573110 -0.041672 0.535538 2.620533
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -66.334322 5.621356 -11.8004 < 2.2e-16
## Slope -0.074849 0.024782 -3.0203 0.002525
## z 0.251732 0.028220 8.9203 < 2.2e-16
## CE_150cm 0.871288 0.082765 10.5273 < 2.2e-16
## DEM 0.039380 0.020925 1.8819 0.059845
##
## Lambda: 0.98246, LR test value: 98.998, p-value: < 2.22e-16
## Asymptotic standard error: 0.012369
## z-value: 79.427, p-value: < 2.22e-16
## Wald statistic: 6308.6, p-value: < 2.22e-16
##
## Log likelihood: -406.8867 for error model
## ML residual variance (sigma squared): 0.76989, (sigma: 0.87744)
## Number of observations: 313
## Number of parameters estimated: 7
## AIC: 827.77, (AIC for lm: 924.77)
mod_es_er_3 <- errorsarlm(CE_70cm~Slope+z+CE_150cm,listw=Wve)
summary(mod_es_er_3)
##
## Call:errorsarlm(formula = CE_70cm ~ Slope + z + CE_150cm, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.150527 -0.558459 -0.045187 0.540349 2.578564
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -65.325177 5.620712 -11.622 < 2.2e-16
## Slope -0.079881 0.024777 -3.224 0.001264
## z 0.286926 0.021256 13.498 < 2.2e-16
## CE_150cm 0.874324 0.083217 10.507 < 2.2e-16
##
## Lambda: 0.98237, LR test value: 97.514, p-value: < 2.22e-16
## Asymptotic standard error: 0.012433
## z-value: 79.011, p-value: < 2.22e-16
## Wald statistic: 6242.7, p-value: < 2.22e-16
##
## Log likelihood: -408.6476 for error model
## ML residual variance (sigma squared): 0.77863, (sigma: 0.8824)
## Number of observations: 313
## Number of parameters estimated: 6
## AIC: 829.3, (AIC for lm: 924.81)
res_mod_es_er <- mod_es_er_2$residuals
shapiro.test(res_mod_es_er)
##
## Shapiro-Wilk normality test
##
## data: res_mod_es_er
## W = 0.99235, p-value = 0.1078
cvm.test(res_mod_es_er)
##
## Cramer-von Mises normality test
##
## data: res_mod_es_er
## W = 0.084219, p-value = 0.182
Los residuales son normales
plot(df75$CE_obs, mod_es_er_2$fitted.values, cex=0.5, pch =19)
cor(df75$CE_obs, mod_es_er_2$fitted.values)
## [1] 0.8246131
moran_error_75 <- moran.mc(res_mod_es_er,Wve,nsim=2000)
moran_error_75
##
## Monte-Carlo simulation of Moran I
##
## data: res_mod_es_er
## weights: Wve
## number of simulations + 1: 2001
##
## statistic = 0.12895, observed rank = 2001, p-value = 0.0004998
## alternative hypothesis: greater
mod_es_er_4 <- errorsarlm(CE_150cm~NDVI+Slope+z+CE_70cm+DEM,listw=Wve)
summary(mod_es_er_4) # NDVI despreciable
##
## Call:errorsarlm(formula = CE_150cm ~ NDVI + Slope + z + CE_70cm +
## DEM, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.46790 -0.32241 -0.02153 0.36060 1.99578
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 45.5088606 2.7607169 16.4844 < 2.2e-16
## NDVI -1.1627276 1.1220178 -1.0363 0.3000703
## Slope 0.0518339 0.0144655 3.5833 0.0003393
## z -0.1327355 0.0171932 -7.7202 1.155e-14
## CE_70cm 0.2959247 0.0286368 10.3337 < 2.2e-16
## DEM -0.0093728 0.0123588 -0.7584 0.4482181
##
## Lambda: 0.96877, LR test value: 49.814, p-value: 1.69e-12
## Asymptotic standard error: 0.022011
## z-value: 44.014, p-value: < 2.22e-16
## Wald statistic: 1937.2, p-value: < 2.22e-16
##
## Log likelihood: -239.4171 for error model
## ML residual variance (sigma squared): 0.26504, (sigma: 0.51482)
## Number of observations: 313
## Number of parameters estimated: 8
## AIC: 494.83, (AIC for lm: 542.65)
mod_es_er_5 <- errorsarlm(CE_150cm~Slope+z+CE_70cm+DEM,listw=Wve)
summary(mod_es_er_5)
##
## Call:errorsarlm(formula = CE_150cm ~ Slope + z + CE_70cm + DEM, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.477728 -0.316994 -0.014091 0.367283 2.009858
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 45.035550 2.729375 16.5003 < 2.2e-16
## Slope 0.051310 0.014481 3.5432 0.0003953
## z -0.136386 0.016857 -8.0910 6.661e-16
## CE_70cm 0.299387 0.028492 10.5079 < 2.2e-16
## DEM -0.008240 0.012332 -0.6682 0.5040078
##
## Lambda: 0.96901, LR test value: 50.337, p-value: 1.2949e-12
## Asymptotic standard error: 0.021843
## z-value: 44.363, p-value: < 2.22e-16
## Wald statistic: 1968.1, p-value: < 2.22e-16
##
## Log likelihood: -239.9531 for error model
## ML residual variance (sigma squared): 0.26594, (sigma: 0.51569)
## Number of observations: 313
## Number of parameters estimated: 7
## AIC: 493.91, (AIC for lm: 542.24)
mod_es_er_6 <- errorsarlm(CE_150cm~Slope+z+CE_70cm,listw=Wve)
summary(mod_es_er_6)
##
## Call:errorsarlm(formula = CE_150cm ~ Slope + z + CE_70cm, listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.470171 -0.318709 -0.014481 0.355224 2.014963
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 44.749718 2.699784 16.5753 < 2.2e-16
## Slope 0.052248 0.014422 3.6227 0.0002915
## z -0.143289 0.013322 -10.7558 < 2.2e-16
## CE_70cm 0.297488 0.028368 10.4868 < 2.2e-16
##
## Lambda: 0.96928, LR test value: 50.495, p-value: 1.1945e-12
## Asymptotic standard error: 0.021655
## z-value: 44.761, p-value: < 2.22e-16
## Wald statistic: 2003.5, p-value: < 2.22e-16
##
## Log likelihood: -240.1762 for error model
## ML residual variance (sigma squared): 0.2663, (sigma: 0.51604)
## Number of observations: 313
## Number of parameters estimated: 6
## AIC: 492.35, (AIC for lm: 540.85)
res_mod_es_er_2 <- mod_es_er_6$residuals
shapiro.test(res_mod_es_er_2)
##
## Shapiro-Wilk normality test
##
## data: res_mod_es_er_2
## W = 0.98814, p-value = 0.01166
cvm.test(res_mod_es_er_2)
##
## Cramer-von Mises normality test
##
## data: res_mod_es_er_2
## W = 0.065621, p-value = 0.3182
plot(df150$CE_obs, mod_es_er_6$fitted.values, cex=0.5, pch =19)
cor(df150$CE_obs, mod_es_er_6$fitted.values)
## [1] 0.718156
moran_error_150 <- moran.mc(res_mod_es_er_2,Wve,nsim=2000)
moran_error_150
##
## Monte-Carlo simulation of Moran I
##
## data: res_mod_es_er_2
## weights: Wve
## number of simulations + 1: 2001
##
## statistic = 0.076281, observed rank = 2001, p-value = 0.0004998
## alternative hypothesis: greater
\[Y=\lambda W Y+ \alpha 1_n+ X\beta + u \\ u=\rho W u + \epsilon\]
mlrho <- sacsarlm(CE_70cm~Slope+z+CE_150cm+DEM,X_x,listw=Wve)
summary(mlrho)
##
## Call:sacsarlm(formula = CE_70cm ~ Slope + z + CE_150cm + DEM, data = X_x,
## listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.090770 -0.476848 -0.031738 0.518306 2.235748
##
## Type: sac
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -60.138673 15.556907 -3.8657 0.0001108
## Slope -0.062334 0.021580 -2.8885 0.0038705
## z 0.187865 0.031034 6.0535 1.417e-09
## CE_150cm 0.854968 0.072736 11.7543 < 2.2e-16
## DEM 0.028548 0.018830 1.5160 0.1295090
##
## Rho: 0.97458
## Asymptotic standard error: 0.38031
## z-value: 2.5626, p-value: 0.01039
## Lambda: 0.9722
## Asymptotic standard error: 0.41632
## z-value: 2.3352, p-value: 0.019532
##
## LR test value: 179.63, p-value: < 2.22e-16
##
## Log likelihood: -366.569 for sac model
## ML residual variance (sigma squared): 0.58432, (sigma: 0.76441)
## Number of observations: 313
## Number of parameters estimated: 8
## AIC: 749.14, (AIC for lm: 924.77)
res_mlrho <- mlrho$residuals
summary(res_mlrho)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -2.09077 -0.47685 -0.03174 0.00000 0.51831 2.23575
shapiro.test(res_mlrho)
##
## Shapiro-Wilk normality test
##
## data: res_mlrho
## W = 0.99543, p-value = 0.4903
cvm.test(res_mlrho)
##
## Cramer-von Mises normality test
##
## data: res_mlrho
## W = 0.050896, p-value = 0.4974
plot(df75$CE_obs, mlrho$fitted.values, cex=0.5, pch =19)
cor(df75$CE_obs, mlrho$fitted.values)
## [1] 0.8703349
moran_mlrho <- moran.mc(res_mlrho,Wve,nsim=2000)
moran_mlrho
##
## Monte-Carlo simulation of Moran I
##
## data: res_mlrho
## weights: Wve
## number of simulations + 1: 2001
##
## statistic = 0.09234, observed rank = 2001, p-value = 0.0004998
## alternative hypothesis: greater
El modelo \(\lambda\) y \(\rho\) para este modelo se ajusta bien, ya que \(\rho\) es significativo (\(p~value=0.01039\))
mlrho_150 <- sacsarlm(CE_150cm~Slope+z+CE_70cm,X_x,listw=Wve)
summary(mlrho_150)
##
## Call:sacsarlm(formula = CE_150cm ~ Slope + z + CE_70cm, data = X_x,
## listw = Wve)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.443696 -0.278907 -0.020386 0.310970 1.959313
##
## Type: sac
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 21.463941 15.438935 1.3902 0.164454
## Slope 0.041795 0.013504 3.0949 0.001969
## z -0.114901 0.017473 -6.5759 4.835e-11
## CE_70cm 0.290649 0.032187 9.0301 < 2.2e-16
##
## Rho: 0.94903
## Asymptotic standard error: 0.54667
## z-value: 1.736, p-value: 0.082562
## Lambda: 0.95738
## Asymptotic standard error: 0.45839
## z-value: 2.0886, p-value: 0.036747
##
## LR test value: 87.934, p-value: < 2.22e-16
##
## Log likelihood: -221.4568 for sac model
## ML residual variance (sigma squared): 0.23287, (sigma: 0.48257)
## Number of observations: 313
## Number of parameters estimated: 7
## AIC: 456.91, (AIC for lm: 540.85)
Este modelo no sirve para CEa 150cm ya que el \(p~value=0.082\)
rmse(CE_70cm, estima1) # CEa 75cm
## [1] 1.04333
rmse(CE_150cm, estima1) # Cea 150cm
## [1] 8.834514
rmse(df75$CE_obs, df75$CE_est) # CEa 75cm
## [1] 1.16061
rmse(df150$CE_obs, df150$CE_est) # Cea 150cm
## [1] 0.6337842
rmse(df75$CE_obs, mod_es_er_2$fitted.values) # CEa 75cm
## [1] 0.8774362
rmse(df150$CE_obs, mod_es_er_6$fitted.values) # Cea 150cm
## [1] 0.5160437
rmse(df75$CE_obs, mlrho$fitted.values) # CEa 75cm
## [1] 0.7644114
fig_Slope <- plot_ly(x = x, y = y, z = Slope, size = I(90))%>%
layout(
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "Slope")
)
)%>%
add_markers(color = BD_MODELADO$Avg_CEa_07)
fig_Slope
fig_150 <- plot_ly(x = x, y = y, z = CE_150cm, size = I(90))%>%
layout(
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "CEa_150")
)
)%>%
add_markers(color = BD_MODELADO$Avg_CEa_07)
fig_150
fig_Z_1 <- plot_ly(x = x, y = y, z = z, size = I(90))%>%
layout(
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "Altitud")
)
)%>%
add_markers(color = BD_MODELADO$Avg_CEa_07)
fig_Z_1
fig_DEM_1 <- plot_ly(x = x, y = y, z = DEM, size = I(90))%>%
layout(
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "DEM")
)
)%>%
add_markers(color = BD_MODELADO$Avg_CEa_07)
fig_DEM_1
plot(x=x,y=y,pch=16,col="blue")
points(x=843600,y=956040,col="red",pch=16)
BD_MODELADO <- as.data.frame(BD_MODELADO)
new_p <- data.frame(843600,956040,0,0,0,0,0,0)
names(new_p) <- c("Avg_X_MCB","Avg_Y_MCE","Avg_CEa_07","Avg_CEa_15","NDVI","DEM","SLOPE","Avg_z")
new_W <- rbind(BD_MODELADO,new_p)
new_XYdat_W <- as.matrix(new_W[,1:2])
new_count <- dnearneigh(coordinates(new_XYdat_W),0,854,longlat = F)
new_dlist <- nbdists(new_count,new_XYdat_W)
new_dlist <- lapply(new_dlist,function(x)1/x)
new_Wve <- nb2listw(new_count,glist = new_dlist,style = 'W')
matrix_id <- diag(314)
Por fin