library(readxl)
BD_MODELADO <- read_excel("BD_MODELADO.xlsx")
data = data.frame(BD_MODELADO)
data
plot(data$Avg_X_MCB,data$Avg_Y_MCE,col="blue",pch=15,main="MUESTREO ESPACIAL")
Datos <- as.matrix(BD_MODELADO[,c(3:8)])
Datos
## 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
v_res75 <- Datos[,1]
v_res150 <- Datos[,2]
Variable Explicativas
v_exp75 <- Datos[,2:6]
v_exp150 <- Datos[,c(1,3:6)]
x75 <- as.matrix(v_exp75)
x150 <- as.matrix(v_exp150)
Coordenadas
xydat <- as.matrix(BD_MODELADO[,1:2])
Matriz
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
Indice de Moran
library(ape)
MI_CE75 <-Moran.I(v_res75, We);MI_CE75
## $observed
## [1] 0.2687468
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.004665906
##
## $p.value
## [1] 0
MI_CE150 <- Moran.I(v_res150, We);MI_CE150
## $observed
## [1] 0.160951
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.00465455
##
## $p.value
## [1] 0
MI_NDVI <- Moran.I(Datos[,3], We);MI_NDVI
## $observed
## [1] 0.09750403
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.004644979
##
## $p.value
## [1] 0
MI_DEM <- Moran.I(Datos[,4], We);MI_DEM
## $observed
## [1] 0.3096708
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.004672384
##
## $p.value
## [1] 0
MI_SLOPE <- Moran.I(Datos[,5], We);MI_SLOPE
## $observed
## [1] 0.06993324
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.004654307
##
## $p.value
## [1] 0
MI_z <- Moran.I(Datos[,6], We);MI_z
## $observed
## [1] 0.3505031
##
## $expected
## [1] -0.003205128
##
## $sd
## [1] 0.004667935
##
## $p.value
## [1] 0
Por lo tanto se concluye que las varaibles tienen dependencia espacial
Moran_o <- list() # Observado
Moran_p <-list() # p.valor
for(j in 1:6){
Moran_o[j]=Moran.I(Datos[,j], We)$observed
}
for(j in 1:6){
Moran_p[j]=Moran.I(Datos[,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))
Matrices de correlation
library("psych")
library("ggplot2")
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
library("car")
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:psych':
##
## logit
library("Hmisc")
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
##
## describe
## The following object is masked from 'package:ape':
##
## zoom
## The following objects are masked from 'package:base':
##
## format.pval, units
library("corrplot")
## corrplot 0.84 loaded
mcp = rcorr(as.matrix(data[,3:8]),type="pearson")
mcs = rcorr(as.matrix(data[,3:8]),type="spearman")
mcorp = mcp$r
mcorp
## Avg_CEa_07 Avg_CEa_15 NDVI DEM SLOPE
## Avg_CEa_07 1.00000000 0.01089764 0.03552583 0.5322948 -0.13642334
## Avg_CEa_15 0.01089764 1.00000000 -0.17636216 -0.3841976 0.18719946
## NDVI 0.03552583 -0.17636216 1.00000000 0.1015882 0.09610537
## DEM 0.53229480 -0.38419758 0.10158817 1.0000000 -0.11958979
## SLOPE -0.13642334 0.18719946 0.09610537 -0.1195898 1.00000000
## Avg_z 0.62185866 -0.46431546 0.21352028 0.7901060 -0.04623111
## Avg_z
## Avg_CEa_07 0.62185866
## Avg_CEa_15 -0.46431546
## NDVI 0.21352028
## DEM 0.79010605
## SLOPE -0.04623111
## Avg_z 1.00000000
mcors = mcs$r
mcors
## Avg_CEa_07 Avg_CEa_15 NDVI DEM SLOPE
## Avg_CEa_07 1.00000000 -0.07010792 -0.087758460 0.554650652 -0.1373202
## Avg_CEa_15 -0.07010792 1.00000000 -0.090734198 -0.390986746 0.2188554
## NDVI -0.08775846 -0.09073420 1.000000000 -0.001001312 0.1079099
## DEM 0.55465065 -0.39098675 -0.001001312 1.000000000 -0.1353297
## SLOPE -0.13732021 0.21885538 0.107909879 -0.135329719 1.0000000
## Avg_z 0.64975197 -0.50662301 0.087797985 0.816109089 -0.1057241
## Avg_z
## Avg_CEa_07 0.64975197
## Avg_CEa_15 -0.50662301
## NDVI 0.08779798
## DEM 0.81610909
## SLOPE -0.10572405
## Avg_z 1.00000000
Grafico de metodo pearson y metodo spearman
par(mfrow=c(1,2))
corrplot(mcorp,order="hclust", tl.col = 'darkgreen', tl.cex = 0.7, number.cex = 0.3,tl.srt=45, main="PEARSON")
corrplot(mcors,order="hclust",tl.col="darkgreen", tl.cex = 0.7, number.cex = 0.3, tl.srt=45, main="SPEARMAN")
Se pueden observar relaciones etre las variables Avg_z y DEM ,tambien existe una relacion entre Avg_z y CEa_07; Avg_z se relaciona con CEa_15.
describe(data[,3:8])
## data[, 3:8]
##
## 6 Variables 313 Observations
## --------------------------------------------------------------------------------
## Avg_CEa_07
## n missing distinct Info Mean Gmd .05 .10
## 313 0 313 1 9.769 1.728 7.193 7.950
## .25 .50 .75 .90 .95
## 8.808 9.645 10.835 11.830 12.446
##
## lowest : 6.165389 6.180742 6.283077 6.358915 6.561038
## highest: 13.227629 13.262604 13.318076 13.424340 13.601094
## --------------------------------------------------------------------------------
## Avg_CEa_15
## n missing distinct Info Mean Gmd .05 .10
## 313 0 313 1 18.5 0.8114 17.41 17.64
## .25 .50 .75 .90 .95
## 18.03 18.44 18.88 19.45 19.68
##
## lowest : 16.80343 16.80468 16.88126 16.97415 17.01939
## highest: 20.57460 20.68170 20.93098 21.20233 21.51339
## --------------------------------------------------------------------------------
## NDVI
## n missing distinct Info Mean Gmd .05 .10
## 313 0 313 1 0.8346 0.03075 0.7753 0.7987
## .25 .50 .75 .90 .95
## 0.8233 0.8404 0.8552 0.8652 0.8702
##
## lowest : 0.704767 0.715250 0.737705 0.739356 0.750449
## highest: 0.874883 0.874916 0.875065 0.876872 0.877252
## --------------------------------------------------------------------------------
## DEM
## n missing distinct Info Mean Gmd .05 .10
## 313 0 143 1 205.1 5.245 197.7 199.1
## .25 .50 .75 .90 .95
## 201.5 204.8 209.3 211.5 212.3
##
## lowest : 196.1667 196.7500 196.8333 196.8889 197.0000
## highest: 212.7500 212.8333 213.1111 213.1667 213.3333
## --------------------------------------------------------------------------------
## SLOPE
## n missing distinct Info Mean Gmd .05 .10
## 313 0 299 1 4.128 2.374 1.361 1.667
## .25 .50 .75 .90 .95
## 2.519 3.781 5.385 6.911 7.796
##
## lowest : 0.210996 0.281328 0.397830 0.455108 0.577682
## highest: 11.049718 11.253322 11.296110 11.876602 12.718485
## --------------------------------------------------------------------------------
## Avg_z
## n missing distinct Info Mean Gmd .05 .10
## 313 0 313 1 202.5 4.174 196.5 197.8
## .25 .50 .75 .90 .95
## 199.8 202.5 205.5 206.8 207.6
##
## lowest : 193.0512 193.2986 193.5659 193.9931 194.4116
## highest: 208.9608 210.9083 211.9958 212.1226 212.3547
## --------------------------------------------------------------------------------
par(mfrow = c(1,2))
boxplot(data[,3], main ="Conductividad Electrica 75 cm", ylab='CE75', col = 'orange' )
hist(data[,3],main = "Conductividad Electrica 75 cm", col = 'darkgreen', xlab="CE 75cm ")
par(mfrow = c(1,2))
boxplot(data[,4], main ="Conductividad Electrica 150 cm", ylab='CE150', col = 'orange' )
hist(data[,4],main = "Conductividad Electrica 150 cm", col = 'darkgreen', xlab="CE 150cm ")
library(nortest)
cv75 = cvm.test(data[,3])
cv75
##
## Cramer-von Mises normality test
##
## data: data[, 3]
## W = 0.13062, p-value = 0.04289
cv150 = cvm.test(data[,4])
cv150
##
## Cramer-von Mises normality test
##
## data: data[, 4]
## W = 0.19809, p-value = 0.005641
tets shapiro
shpt75<-shapiro.test(data[,3])
shpt75
##
## Shapiro-Wilk normality test
##
## data: data[, 3]
## W = 0.99217, p-value = 0.09827
shpt150<-shapiro.test(data[,4])
shpt150
##
## Shapiro-Wilk normality test
##
## data: data[, 4]
## W = 0.97785, p-value = 9.283e-05
ks.test(data[,3], data[,4])
##
## Two-sample Kolmogorov-Smirnov test
##
## data: data[, 3] and data[, 4]
## D = 1, p-value < 2.2e-16
## alternative hypothesis: two-sided
ks.test(data[,3], data[,4])
##
## Two-sample Kolmogorov-Smirnov test
##
## data: data[, 3] and data[, 4]
## D = 1, p-value < 2.2e-16
## alternative hypothesis: two-sided
modcv75 = lm(Avg_CEa_07~SLOPE+Avg_z+Avg_CEa_15,data= data)
summary(modcv75)
##
## Call:
## lm(formula = Avg_CEa_07 ~ SLOPE + Avg_z + Avg_CEa_15, data = data)
##
## 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 ***
## Avg_z 0.33680 0.01834 18.369 < 2e-16 ***
## Avg_CEa_15 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
modcv150 = lm(Avg_CEa_15~SLOPE+Avg_z+Avg_CEa_07,data= data)
summary(modcv150)
##
## Call:
## lm(formula = Avg_CEa_15 ~ SLOPE + Avg_z + Avg_CEa_07, data = data)
##
## 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 ***
## Avg_z -0.15733 0.01123 -14.009 < 2e-16 ***
## Avg_CEa_07 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
mod2cv75 = lm(Avg_CEa_07~SLOPE+Avg_z+log(Avg_CEa_15),data= data)
summary(mod2cv75)
##
## Call:
## lm(formula = Avg_CEa_07 ~ SLOPE + Avg_z + log(Avg_CEa_15), data = data)
##
## 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 ***
## Avg_z 0.33663 0.01844 18.259 < 2e-16 ***
## log(Avg_CEa_15) 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
mod2cv150 = lm(log(Avg_CEa_15)~SLOPE+Avg_z+log(Avg_CEa_07),data= data)
summary(mod2cv150)
##
## Call:
## lm(formula = log(Avg_CEa_15) ~ SLOPE + Avg_z + log(Avg_CEa_07),
## data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.083486 -0.020916 -0.000046 0.019431 0.102855
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.3365073 0.1049644 41.314 < 2e-16 ***
## SLOPE 0.0039929 0.0007972 5.009 9.24e-07 ***
## Avg_z -0.0085806 0.0006020 -14.254 < 2e-16 ***
## log(Avg_CEa_07) 0.1330214 0.0139088 9.564 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.03024 on 309 degrees of freedom
## Multiple R-squared: 0.4194, Adjusted R-squared: 0.4137
## F-statistic: 74.39 on 3 and 309 DF, p-value: < 2.2e-16
residuos1 = modcv75$residuals
shapiro.test(residuos1)
##
## Shapiro-Wilk normality test
##
## data: residuos1
## W = 0.99092, p-value = 0.05044
residuos2 = modcv150$residuals
shapiro.test(residuos2)
##
## Shapiro-Wilk normality test
##
## data: residuos2
## W = 0.99144, p-value = 0.06673
par(mfrow = c(1,2))
hist(residuos1, col = "darkgreen")
hist(residuos2, col = "darkgreen")
residuos3 = mod2cv75$residuals
shapiro.test(residuos3)
##
## Shapiro-Wilk normality test
##
## data: residuos3
## W = 0.99096, p-value = 0.05142
residuos4 = mod2cv150$residuals
shapiro.test(residuos4)
##
## Shapiro-Wilk normality test
##
## data: residuos4
## W = 0.99471, p-value = 0.3564
par(mfrow = c(1,2))
hist(residuos3, col = "darkgreen")
hist(residuos4, col = "darkgreen")
library (normtest)
skew(data[,3])
## [1] 0.1002837
skewness.norm.test(data[,3])
##
## Skewness test for normality
##
## data: data[, 3]
## T = 0.10077, p-value = 0.4775
skew(data[,4])
## [1] 0.5702493
skewness.norm.test(data[,4])
##
## Skewness test for normality
##
## data: data[, 4]
## T = 0.57299, p-value < 2.2e-16
skew(residuos1)
## [1] 0.2441868
skewness.norm.test(residuos1)
##
## Skewness test for normality
##
## data: residuos1
## T = 0.24536, p-value = 0.0665
skew(residuos2)
## [1] 0.257621
skewness.norm.test(residuos2)
##
## Skewness test for normality
##
## data: residuos2
## T = 0.25886, p-value = 0.061
skew(residuos3)
## [1] 0.2440019
skewness.norm.test(residuos3)
##
## Skewness test for normality
##
## data: residuos3
## T = 0.24518, p-value = 0.074
skew(residuos4)
## [1] 0.1429125
skewness.norm.test(residuos4)
##
## Skewness test for normality
##
## data: residuos4
## T = 0.1436, p-value = 0.29
vmodcv75 = modcv75$fitted.values
vmodcv150 = modcv150$fitted.values
vmod2cv75 = mod2cv75$fitted.values
vmod2cv150 = mod2cv150$fitted.values
plot(data$Avg_CEa_07,vmodcv75,pch=18, col = 'blue', xlab = "CE 75cm observada", ylab="CE 75cm estimada", main = "Valores observados Vs Valores estimados CE75cm")
plot(data$Avg_CEa_07,vmodcv150,pch=16, col = 'blue', xlab = "CE 150 cm observada", ylab="CE 150cm estimada",main = "Valores observados Vs Valores estimados CE150")
cor(data$Avg_CEa_07,vmodcv75)
## [1] 0.7290603
cor(data$Avg_CEa_07,vmodcv150)
## [1] 0.01700518
cor(data$Avg_CEa_07,vmod2cv75)
## [1] 0.7268909
cor(data$Avg_CEa_07,vmod2cv150)
## [1] 0.01463969
residuosm1 = modcv75$residuals
shapiro.test(residuosm1)
##
## Shapiro-Wilk normality test
##
## data: residuosm1
## W = 0.99092, p-value = 0.05044
residuosm2 = modcv150$residuals
shapiro.test(residuosm2)
##
## Shapiro-Wilk normality test
##
## data: residuosm2
## W = 0.99144, p-value = 0.06673
residuosm3 = mod2cv75$residuals
shapiro.test(residuosm3)
##
## Shapiro-Wilk normality test
##
## data: residuosm3
## W = 0.99096, p-value = 0.05142
residuosm4 = mod2cv150$residuals
shapiro.test(residuosm4)
##
## Shapiro-Wilk normality test
##
## data: residuosm4
## W = 0.99471, p-value = 0.3564
Modelo autoregresivo puro
library(spdep)
## Loading required package: sp
## Loading required package: spData
## To access larger datasets in this package, install the spDataLarge
## package with: `install.packages('spDataLarge',
## repos='https://nowosad.github.io/drat/', type='source')`
## Loading required package: sf
## Linking to GEOS 3.5.1, GDAL 2.2.2, PROJ 4.9.2
## Registered S3 method overwritten by 'spdep':
## method from
## plot.mst ape
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')
Modelo CE 75CM
map_75 <- spautolm(Avg_CEa_07~1, data = data, listw = Wve)
## Warning: Function spautolm moved to the spatialreg package
## Registered S3 methods overwritten by 'spatialreg':
## method from
## residuals.stsls spdep
## deviance.stsls spdep
## coef.stsls spdep
## print.stsls spdep
## summary.stsls spdep
## print.summary.stsls spdep
## residuals.gmsar spdep
## deviance.gmsar spdep
## coef.gmsar spdep
## fitted.gmsar spdep
## print.gmsar spdep
## summary.gmsar spdep
## print.summary.gmsar spdep
## print.lagmess spdep
## summary.lagmess spdep
## print.summary.lagmess spdep
## residuals.lagmess spdep
## deviance.lagmess spdep
## coef.lagmess spdep
## fitted.lagmess spdep
## logLik.lagmess spdep
## fitted.SFResult spdep
## print.SFResult spdep
## fitted.ME_res spdep
## print.ME_res spdep
## print.lagImpact spdep
## plot.lagImpact spdep
## summary.lagImpact spdep
## HPDinterval.lagImpact spdep
## print.summary.lagImpact spdep
## print.sarlm spdep
## summary.sarlm spdep
## residuals.sarlm spdep
## deviance.sarlm spdep
## coef.sarlm spdep
## vcov.sarlm spdep
## fitted.sarlm spdep
## logLik.sarlm spdep
## anova.sarlm spdep
## predict.sarlm spdep
## print.summary.sarlm spdep
## print.sarlm.pred spdep
## as.data.frame.sarlm.pred spdep
## residuals.spautolm spdep
## deviance.spautolm spdep
## coef.spautolm spdep
## fitted.spautolm spdep
## print.spautolm spdep
## summary.spautolm spdep
## logLik.spautolm spdep
## print.summary.spautolm spdep
## print.WXImpact spdep
## summary.WXImpact spdep
## print.summary.WXImpact spdep
## predict.SLX spdep
summary(map_75)
##
## Call: spatialreg::spautolm(formula = formula, data = data, listw = listw,
## na.action = na.action, family = family, method = method,
## verbose = verbose, trs = trs, interval = interval, zero.policy = zero.policy,
## tol.solve = tol.solve, llprof = llprof, control = control)
##
## 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.011876
##
## 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'])
head(CE75E1,10)
CE75E <- map_75$fit$fitted.values ## Estimados
head(CE75E,10)
## 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
## 9.005442 8.976890
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, col = "green", ylab= "coordenadas latitud", xlab = "coordenadas longitud", main = "Comparacion de CE75cm de valores observados vs estimados")
resmap1 <- map_75$fit$residuals
cor(df75$CE_obs, df75$CE_est)
## [1] 0.7977199
plot(xydat[,1] ,xydat[,2], col = floor(abs(resmap1))+3, pch =18, ylab= "coordenadas latitud", xlab = "coordenadas longitud", main = "Comparacion de CE75cm de valores observados vs estimados")
plot(xydat[,1] ,xydat[,2], cex =abs(resmap1), pch =20, col = "darkred", ylab= "coordenadas latitud", xlab = "coordenadas longitud", main = "Comparacion de CE75cm de valores observados vs estimados")
plot(xydat[,1] ,xydat[,2], cex =0.1*df75$CE_obs, pch =20, ylab= "coordenadas latitud", xlab = "coordenadas longitud", main = "Comparacion de CE75cm de valores observados vs estimados")
data2 <- data.frame(xydat[,1] ,xydat[,2], df75$CE_obs, df75$CE_est)
colnames(data2) <- c('x', 'y', 'CE_observado', 'CE_estimado')
plot1<-ggplot(data = data2, aes(xydat[,1] ,xydat[,2])) +
geom_point(cex = data2$CE_obs*0.2) +
geom_point(color = data2$CE_est)
plot1
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
MODELO LAMBDA Y RHO CE A 75 cm
modelol <- sacsarlm(Avg_CEa_07~SLOPE+Avg_z+Avg_CEa_15+DEM,data=data,listw=Wve)
## Warning: Function sacsarlm moved to the spatialreg package
summary(modelol)
##
## Call:spatialreg::sacsarlm(formula = formula, data = data, listw = listw,
## listw2 = listw2, na.action = na.action, Durbin = Durbin,
## type = type, method = method, quiet = quiet, zero.policy = zero.policy,
## tol.solve = tol.solve, llprof = llprof, interval1 = interval1,
## interval2 = interval2, trs1 = trs1, trs2 = trs2, control = control)
##
## 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.556909 -3.8657 0.0001108
## SLOPE -0.062334 0.021580 -2.8885 0.0038705
## Avg_z 0.187865 0.031034 6.0535 1.417e-09
## Avg_CEa_15 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_modelol <- modelol$residuals
summary(res_modelol)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -2.09077 -0.47685 -0.03174 0.00000 0.51831 2.23575
shapiro.test(res_modelol)
##
## Shapiro-Wilk normality test
##
## data: res_modelol
## W = 0.99543, p-value = 0.4903
cvm.test(res_modelol)
##
## Cramer-von Mises normality test
##
## data: res_modelol
## W = 0.050896, p-value = 0.4974
plot(df75$CE_obs, modelol$fitted.values, cex=0.8, pch =20, col = 'purple', xlab = "CE 75 cm observada", ylab="CE 75 cm estimada",main = "Valores observados Vs Valores estimados CE75" )
cor(df75$CE_obs, modelol$fitted.values)
## [1] 0.8703349
moran_modelol <- moran.mc(res_modelol,Wve,nsim=2000)
moran_modelol
##
## Monte-Carlo simulation of Moran I
##
## data: res_modelol
## weights: Wve
## number of simulations + 1: 2001
##
## statistic = 0.09234, observed rank = 2001, p-value = 0.0004998
## alternative hypothesis: greater
MODELO ESPACIAL ERROR CE A 75 CM
modee1<- errorsarlm(Avg_CEa_07~NDVI+SLOPE+Avg_z+Avg_CEa_15+DEM,data=data,listw=Wve)
## Warning: Function errorsarlm moved to the spatialreg package
summary(modee1)
##
## Call:spatialreg::errorsarlm(formula = formula, data = data, listw = listw,
## na.action = na.action, Durbin = Durbin, etype = etype, method = method,
## quiet = quiet, zero.policy = zero.policy, interval = interval,
## tol.solve = tol.solve, trs = trs, control = control)
##
## 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
## Avg_z 0.257034 0.028465 9.0299 < 2.2e-16
## Avg_CEa_15 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)
modee2 <- errorsarlm(Avg_CEa_07~SLOPE+Avg_z+Avg_CEa_15+DEM,data=data,listw=Wve)
## Warning: Function errorsarlm moved to the spatialreg package
summary(modee2)
##
## Call:spatialreg::errorsarlm(formula = formula, data = data, listw = listw,
## na.action = na.action, Durbin = Durbin, etype = etype, method = method,
## quiet = quiet, zero.policy = zero.policy, interval = interval,
## tol.solve = tol.solve, trs = trs, control = control)
##
## 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
## Avg_z 0.251732 0.028220 8.9203 < 2.2e-16
## Avg_CEa_15 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)
modee3 <- errorsarlm(Avg_CEa_07~SLOPE+Avg_z+Avg_CEa_15,data=data,listw=Wve)
## Warning: Function errorsarlm moved to the spatialreg package
summary(modee3)
##
## Call:spatialreg::errorsarlm(formula = formula, data = data, listw = listw,
## na.action = na.action, Durbin = Durbin, etype = etype, method = method,
## quiet = quiet, zero.policy = zero.policy, interval = interval,
## tol.solve = tol.solve, trs = trs, control = control)
##
## 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
## Avg_z 0.286926 0.021256 13.498 < 2.2e-16
## Avg_CEa_15 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)
Se concluye que el mejor modelo es el dos
resmodee2<- modee2$residuals
shapiro.test(resmodee2)
##
## Shapiro-Wilk normality test
##
## data: resmodee2
## W = 0.99235, p-value = 0.1078
cvm.test(resmodee2)
##
## Cramer-von Mises normality test
##
## data: resmodee2
## W = 0.084219, p-value = 0.182
plot(df75$CE_obs, modee2$fitted.values, cex=0.8, pch =20, col = "blue", xlab = "CE 150 cm observada", ylab="CE 150cm estimada",main = "Valores observados Vs Valores estimados CE150")
cor(df75$CE_obs, modee2$fitted.values)
## [1] 0.8246131
moran_error_75 <- moran.mc(resmodee2,Wve,nsim=2000)
moran_error_75
##
## Monte-Carlo simulation of Moran I
##
## data: resmodee2
## weights: Wve
## number of simulations + 1: 2001
##
## statistic = 0.12895, observed rank = 2001, p-value = 0.0004998
## alternative hypothesis: greater
GRAFICAS
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:Hmisc':
##
## subplot
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
GRAF = plot_ly(x=data$Avg_X_MCB ,y=data$Avg_Y_MCE,z= data$Avg_z,data=data, size = I(90),
marker = list(color=rgb(0.1,0.3,0.6),
line = list(color = rgb(0.1,0.3,0.6))))%>%
layout(title = "Z vs XY",
scene = list(xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "Elevation (M.A.S.L.)")
)
)%>%
add_markers(color = "cyan")
GRAF
## 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
GRAFDEM <- plot_ly(x=data$Avg_X_MCB ,y=data$Avg_Y_MCE,z= data$DEM,data=data, size = I(90),
marker = list(color=rgb(0.1,0.3,0.6),
line = list(color = rgb(0.1,0.3,0.6))))%>%
layout(title = "DEM vs XY",
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "DEM")
)
)%>%
add_markers(color = "cyan")
GRAFDEM
## 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
GRAFslope <- plot_ly(x=data$Avg_X_MCB ,y=data$Avg_Y_MCE,z= data$SLOPE ,data=data, size = I(90))%>%
layout(title = 'CE_75 vs Slope',
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "Slope")
)
)%>%
add_markers(color = data$Avg_CEa_07)
GRAFslope
GRAF1 <- plot_ly(x=data$Avg_X_MCB ,y=data$Avg_Y_MCE,z= data$Avg_z,data=data, size = I(90))%>%
layout(title = 'CEa_75 vs Altitud (z)',
scene = list(
xaxis = list(title = "Longitud"),
yaxis = list(title = "Latitud"),
zaxis = list(title = "Altitud")
)
)%>%
add_markers(color = data$Avg_CEa_07)
GRAF1