## [1] "1. Leitura dos dados"

## [1] "2. Exploração inicial"

## Rows: 15,395
## Columns: 34
## $ ano        <chr> "2016", "2016", "2016", "2016", "2016", "2016", "2016", "20…
## $ ponto      <chr> "CF1658277", "CF1658272", "CF1658273", "CF1658274", "CF1658…
## $ x          <dbl> -49.18157, -49.18953, -49.18786, -49.18619, -49.18453, -49.…
## $ y          <dbl> -21.27265, -21.27243, -21.27241, -21.27239, -21.27237, -21.…
## $ variedade  <chr> "CV6654", "CV6654", "CV6654", "CV6654", "CV6654", "CV6654",…
## $ solos      <chr> "LVal md", "LVPd md/arg", "LVPd md/arg", "LVPd md/arg", "LV…
## $ tch_real   <dbl> 63.54, 63.54, 63.54, 63.54, 63.54, 63.54, 63.54, 63.54, 63.…
## $ atr        <dbl> 148.07, 148.07, 148.07, 148.07, 148.07, 148.07, 148.07, 148…
## $ ph_cacl2_1 <dbl> 5.19, 5.18, 4.88, 4.96, 5.05, 5.15, 6.24, 4.50, 5.38, 5.50,…
## $ mo_1       <dbl> 16.2022, 17.0236, 15.6546, 13.7380, 15.6546, 14.0118, 11.82…
## $ p_resina_1 <dbl> 11.538500, 12.526100, 10.880100, 10.715500, 11.044700, 11.2…
## $ s_1        <dbl> 8.84769, 9.92472, 12.07878, 8.96736, 9.56571, 8.01000, 9.80…
## $ ca_1       <dbl> 21.601449, 19.862319, 14.789855, 16.601449, 18.195652, 19.4…
## $ mg_1       <dbl> 11.045207, 15.713952, 5.495713, 9.696804, 10.047545, 10.359…
## $ k_1        <dbl> 1.2805516, 0.9239182, 1.4992867, 1.5563481, 1.6229196, 0.84…
## $ al_1       <dbl> 1.19600, 0.92000, 1.38000, 0.55200, 0.82800, 1.19600, 0.644…
## $ h_al_1     <dbl> 22.96210, 22.01502, 30.19345, 22.72158, 22.01502, 19.40179,…
## $ sb_1       <dbl> 33.92721, 36.50019, 21.78485, 27.85460, 29.86612, 30.63469,…
## $ ctc_1      <dbl> 56.88931, 58.51521, 51.97831, 50.57618, 51.88114, 50.03647,…
## $ v_1        <dbl> 59.63723, 62.37726, 41.91144, 55.07455, 57.56642, 61.22471,…
## $ m_1        <dbl> 3.4051560, 2.4585659, 5.9573004, 1.9432103, 2.6975854, 3.75…
## $ ph_cacl2_2 <dbl> 4.90, 5.38, 5.29, 5.30, 5.16, 5.06, 5.50, 4.50, 4.79, 4.46,…
## $ mo_2       <dbl> 13.7380, 13.4642, 12.3690, 11.5476, 13.7380, 11.5476, 11.82…
## $ p_resina_2 <dbl> 12.032300, 11.703100, 11.703100, 13.513700, 11.867700, 11.8…
## $ s_2        <dbl> 12.43779, 16.86558, 11.00175, 8.12967, 12.19845, 13.27548, …
## $ ca_2       <dbl> 14.210145, 16.021739, 15.514493, 14.427536, 15.224638, 14.5…
## $ mg_2       <dbl> 7.085737, 9.735776, 6.563523, 8.262666, 7.327358, 7.475448,…
## $ k_2        <dbl> 0.8050404, 0.7194484, 0.9429387, 0.5863053, 0.7669995, 0.67…
## $ al_2       <dbl> 3.956000, 1.012000, 1.104000, 0.736000, 2.024000, 2.852000,…
## $ h_al_2     <dbl> 43.19156, 26.60941, 24.98024, 21.33044, 24.71858, 26.33069,…
## $ sb_2       <dbl> 22.100922, 26.476963, 23.020954, 23.276507, 23.318995, 22.7…
## $ ctc_2      <dbl> 65.29248, 53.08638, 48.00119, 44.60695, 48.03757, 49.05050,…
## $ v_2        <dbl> 33.84911, 49.87525, 47.95913, 52.18135, 48.54324, 46.31922,…
## $ m_2        <dbl> 15.182146, 3.681478, 4.576174, 3.065069, 7.986428, 11.15290…
## [1] "3. Testes de normalidade"
## [1] "4. Estatística descritiva"
Estatística descritiva das variáveis (2017)
estat_names tch_real atr ph_cacl2_1 mo_1 p_resina_1 s_1 ca_1 mg_1 k_1 al_1 h_al_1 sb_1 ctc_1 v_1 m_1
Min 30.5000000 100.1500000 4.0000000 6.107800 1.299790 0.731830 3.000000 0.5573721 0.111964 0.000000 5.541665 5.451818 21.073509 17.9940737 0.0000000
Q1 64.6900000 125.1800000 5.2000000 11.369000 8.232220 4.108258 16.115385 6.3247223 1.274955 0.096000 12.207434 25.072611 40.871632 61.2126936 0.2125567
Med 86.5900000 137.7600000 5.5500000 13.133200 12.376580 5.508900 21.589431 8.6648261 1.993912 0.288000 14.599468 32.974015 48.463118 69.5394902 0.7752133
Média 88.9092373 134.8789476 5.5307910 13.662985 16.412581 6.809475 23.360209 9.3435488 2.517844 0.734965 15.345073 35.221899 50.567020 67.6943058 2.7774096
Q3 111.6600000 144.6800000 5.8900000 15.271200 19.777200 7.537870 28.395770 11.3470149 3.169131 0.768000 17.462664 42.549554 57.509415 76.2866930 2.2151230
Max 196.8200000 158.1700000 7.0400000 45.853800 159.833880 150.317300 271.857651 39.0179140 18.858311 35.616000 80.392034 309.694684 323.401252 95.7617457 69.5969568
DP 31.6780545 11.9622681 0.5316525 3.508783 13.960101 6.358454 11.525629 4.2260972 1.884264 1.489042 4.784460 15.263088 14.611838 11.9740800 5.9731258
CV 35.6296550 8.8688919 9.6125942 25.680942 85.057316 93.376559 49.338723 45.2301076 74.836408 202.600363 31.179128 43.334086 28.895983 17.6884597 215.0610345
Skn 0.3742606 -0.4124312 -0.1709083 1.639553 3.331065 9.672653 4.822507 1.3798801 2.398875 7.783490 2.177287 3.056045 3.344003 -0.7177730 4.2884892
Krt -0.5364926 -0.9600112 -0.1148486 7.360341 18.288983 164.150897 75.288765 3.5871949 9.156951 122.720914 14.023944 35.566484 41.356665 0.3121032 23.2511512
## [1] "5. Transformações"
Estatística descritiva após transformações (2017)
estat_names tch_real atr ph_cacl2_1 mo_1 p_resina_1 s_1 ca_1 mg_1 k_1 al_1 h_al_1 sb_1 ctc_1 v_1 m_1
Min 30.5000000 100.1500000 4.0000000 6.107800 0.8328178 -0.3122070 1.0986123 0.5573721 0.111964 0.000000 5.541665 1.6959492 3.0480167 17.9940737 0.0000000
Q1 64.6900000 125.1800000 5.2000000 11.369000 2.2226995 1.4129991 2.7797744 6.3247223 1.274955 0.096000 12.207434 3.2217760 3.7104362 61.2126936 0.1927311
Med 86.5900000 137.7600000 5.5500000 13.133200 2.5935054 1.7063650 3.0722039 8.6648261 1.993912 0.288000 14.599468 3.4957198 3.8808031 69.5394902 0.5739206
Média 88.9092373 134.8789476 5.5307910 13.662985 2.6443932 1.7416995 3.0550922 9.3435488 2.517844 0.734965 15.345073 3.4805820 3.8889056 67.6943058 0.8180992
Q3 111.6600000 144.6800000 5.8900000 15.271200 3.0338562 2.0199396 3.3462402 11.3470149 3.169131 0.768000 17.462664 3.7506694 4.0519487 76.2866930 1.1678656
Max 196.8200000 158.1700000 7.0400000 45.853800 5.0803720 5.0127484 5.6052786 39.0179140 18.858311 35.616000 80.392034 5.7355869 5.7788938 95.7617457 4.2569870
DP 31.6780545 11.9622681 0.5316525 3.508783 0.6252337 0.5423803 0.4379050 4.2260972 1.884264 1.489042 4.784460 0.4038201 0.2561310 11.9740800 0.8518108
CV 35.6296550 8.8688919 9.6125942 25.680942 23.6437484 31.1408672 14.3336112 45.2301076 74.836408 202.600363 31.179128 11.6020852 6.5861968 17.6884597 104.1207197
Skn 0.3742606 -0.4124312 -0.1709083 1.639553 0.3860856 0.6699677 -0.1051319 1.3798801 2.398875 7.783490 2.177287 -0.1071827 0.4566969 -0.7177730 1.3477142
Krt -0.5364926 -0.9600112 -0.1148486 7.360341 0.3224830 2.3977005 0.7312156 3.5871949 9.156951 122.720914 14.023944 0.4865845 1.3136648 0.3121032 1.3620381
## [1] "6. Seleção de ano/variável"
## Rows: 4,197
## Columns: 3
## $ x <dbl> -49.30086, -49.29970, -49.29900, -49.29814, -49.29813, -49.29792, -4…
## $ y <dbl> -20.87622, -20.87756, -20.87855, -20.88096, -20.87652, -20.87957, -2…
## $ z <dbl> 67.87, 67.87, 67.87, 102.85, 68.39, 67.87, 68.39, 102.85, 68.39, 102…
## [1] "7. Boxplot / histograma / normalidade"
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   30.50   64.69   86.59   88.91  111.66  196.82

## 
##  Shapiro-Wilk normality test
## 
## data:  y_vals
## W = 0.97738, p-value < 2.2e-16
## 
##  Cramer-von Mises normality test
## 
## data:  y_vals
## W = 4.0125, p-value = 7.37e-10
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  y_vals
## D = 0.065602, p-value < 2.2e-16
## 
##  Anderson-Darling normality test
## 
## data:  y_vals
## A = 24.862, p-value < 2.2e-16
## [1] "8. Colinearidade"
##            tch_real   atr ph_cacl2_1  mo_1 p_resina_1   s_1  ca_1  mg_1   k_1
## tch_real       1.00  0.01       0.01  0.02       0.17 -0.02  0.16  0.20  0.09
## atr            0.01  1.00      -0.20 -0.01      -0.05 -0.02 -0.25 -0.19 -0.07
## ph_cacl2_1     0.01 -0.20       1.00  0.15       0.33  0.08  0.56  0.46  0.29
## mo_1           0.02 -0.01       0.15  1.00       0.24  0.01  0.26  0.23  0.17
## p_resina_1     0.17 -0.05       0.33  0.24       1.00  0.05  0.34  0.22  0.26
## s_1           -0.02 -0.02       0.08  0.01       0.05  1.00  0.04  0.06  0.23
## ca_1           0.16 -0.25       0.56  0.26       0.34  0.04  1.00  0.69  0.27
## mg_1           0.20 -0.19       0.46  0.23       0.22  0.06  0.69  1.00  0.28
## k_1            0.09 -0.07       0.29  0.17       0.26  0.23  0.27  0.28  1.00
## al_1          -0.03 -0.02      -0.48 -0.07      -0.16  0.05 -0.36 -0.22 -0.10
## h_al_1        -0.09  0.04      -0.59  0.05      -0.17  0.02 -0.33 -0.27 -0.14
## sb_1           0.18 -0.25       0.59  0.28       0.34  0.08  0.97  0.81  0.41
## ctc_1          0.17 -0.24       0.36  0.32       0.30  0.10  0.88  0.77  0.38
## v_1            0.17 -0.19       0.74  0.16       0.33  0.05  0.85  0.69  0.36
## m_1           -0.04  0.00      -0.64 -0.14      -0.25  0.03 -0.54 -0.36 -0.24
##             al_1 h_al_1  sb_1 ctc_1   v_1   m_1
## tch_real   -0.03  -0.09  0.18  0.17  0.17 -0.04
## atr        -0.02   0.04 -0.25 -0.24 -0.19  0.00
## ph_cacl2_1 -0.48  -0.59  0.59  0.36  0.74 -0.64
## mo_1       -0.07   0.05  0.28  0.32  0.16 -0.14
## p_resina_1 -0.16  -0.17  0.34  0.30  0.33 -0.25
## s_1         0.05   0.02  0.08  0.10  0.05  0.03
## ca_1       -0.36  -0.33  0.97  0.88  0.85 -0.54
## mg_1       -0.22  -0.27  0.81  0.77  0.69 -0.36
## k_1        -0.10  -0.14  0.41  0.38  0.36 -0.24
## al_1        1.00   0.50 -0.36 -0.13 -0.50  0.79
## h_al_1      0.50   1.00 -0.34  0.04 -0.73  0.49
## sb_1       -0.36  -0.34  1.00  0.91  0.88 -0.55
## ctc_1      -0.13   0.04  0.91  1.00  0.61 -0.32
## v_1        -0.50  -0.73  0.88  0.61  1.00 -0.67
## m_1         0.79   0.49 -0.55 -0.32 -0.67  1.00

##      ca_1      mg_1    h_al_1      sb_1     ctc_1       v_1 
##  84.29664  12.12042  17.02421 410.57600 120.32423 148.96923
## [1] "9. Regressão múltipla e Stepwise"
## 
## Call:
## lm(formula = form_reg, data = df_aux)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -78.910 -23.011  -3.245  21.196 130.169 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 91.21440   16.16013   5.644 1.77e-08 ***
## atr          0.09931    0.04187   2.372  0.01775 *  
## ph_cacl2_1  -9.09302    1.28885  -7.055 2.01e-12 ***
## mo_1        -0.60032    0.14334  -4.188 2.87e-05 ***
## p_resina_1   8.83592    0.82787  10.673  < 2e-16 ***
## s_1         -2.68713    0.89555  -3.001  0.00271 ** 
## mg_1         1.75772    0.18399   9.553  < 2e-16 ***
## k_1          0.78239    0.28255   2.769  0.00565 ** 
## al_1        -1.01424    0.52722  -1.924  0.05445 .  
## ctc_1        1.39301    3.20283   0.435  0.66364    
## m_1          1.37525    1.07965   1.274  0.20281    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 30.41 on 4211 degrees of freedom
## Multiple R-squared:  0.0812, Adjusted R-squared:  0.07902 
## F-statistic: 37.22 on 10 and 4211 DF,  p-value: < 2.2e-16

## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_final
## BP = 110.02, df = 10, p-value < 2.2e-16
## 
##  Durbin-Watson test
## 
## data:  modelo_final
## DW = 1.504, p-value < 2.2e-16
## alternative hypothesis: true autocorrelation is greater than 0
## Start:  AIC=29183.76
## tch_real ~ 1
## 
##              Df Sum of Sq     RSS   AIC
## + mg_1        1    163667 4075587 29020
## + p_resina_1  1    124301 4114953 29060
## + ctc_1       1    115784 4123471 29069
## + k_1         1     32900 4206355 29153
## + m_1         1      6602 4232652 29179
## + al_1        1      3636 4235619 29182
## + s_1         1      2575 4236680 29183
## <none>                    4239254 29184
## + mo_1        1      1013 4238241 29185
## + atr         1       627 4238628 29185
## + ph_cacl2_1  1       266 4238988 29186
## 
## Step:  AIC=29019.53
## tch_real ~ mg_1
## 
##              Df Sum of Sq     RSS   AIC
## + p_resina_1  1     72144 4003443 28946
## + ph_cacl2_1  1     36673 4038914 28983
## + atr         1     10712 4064875 29010
## + s_1         1      5937 4069650 29015
## + k_1         1      5230 4070357 29016
## + m_1         1      5043 4070544 29016
## + mo_1        1      4091 4071496 29017
## + ctc_1       1      2024 4073563 29019
## <none>                    4075587 29020
## + al_1        1       759 4074828 29021
## 
## Step:  AIC=28946.13
## tch_real ~ mg_1 + p_resina_1
## 
##              Df Sum of Sq     RSS   AIC
## + ph_cacl2_1  1     72545 3930898 28871
## + m_1         1     15375 3988067 28932
## + mo_1        1     13971 3989472 28933
## + atr         1     11000 3992443 28937
## + s_1         1      7785 3995658 28940
## + al_1        1      3701 3999741 28944
## <none>                    4003443 28946
## + k_1         1       293 4003150 28948
## + ctc_1       1        98 4003344 28948
## 
## Step:  AIC=28870.92
## tch_real ~ mg_1 + p_resina_1 + ph_cacl2_1
## 
##         Df Sum of Sq     RSS   AIC
## + mo_1   1   14156.6 3916741 28858
## + s_1    1    5613.0 3925285 28867
## + atr    1    4699.6 3926198 28868
## + al_1   1    3460.1 3927438 28869
## + k_1    1    3300.6 3927597 28869
## <none>               3930898 28871
## + m_1    1     911.2 3929987 28872
## + ctc_1  1     388.2 3930510 28873
## 
## Step:  AIC=28857.69
## tch_real ~ mg_1 + p_resina_1 + ph_cacl2_1 + mo_1
## 
##         Df Sum of Sq     RSS   AIC
## + s_1    1    5801.7 3910940 28853
## + atr    1    5326.1 3911415 28854
## + k_1    1    4447.7 3912294 28855
## + al_1   1    3408.4 3913333 28856
## <none>               3916741 28858
## + m_1    1    1123.1 3915618 28859
## + ctc_1  1      20.1 3916721 28860
## 
## Step:  AIC=28853.43
## tch_real ~ mg_1 + p_resina_1 + ph_cacl2_1 + mo_1 + s_1
## 
##         Df Sum of Sq     RSS   AIC
## + k_1    1    7153.2 3903786 28848
## + atr    1    5360.5 3905579 28850
## + al_1   1    2616.2 3908323 28853
## <none>               3910940 28853
## + m_1    1     638.4 3910301 28855
## + ctc_1  1     111.3 3910828 28855
## 
## Step:  AIC=28847.7
## tch_real ~ mg_1 + p_resina_1 + ph_cacl2_1 + mo_1 + s_1 + k_1
## 
##         Df Sum of Sq     RSS   AIC
## + atr    1    5309.6 3898477 28844
## + al_1   1    2831.6 3900955 28847
## <none>               3903786 28848
## + m_1    1     377.4 3903409 28849
## + ctc_1  1      92.6 3903694 28850
## 
## Step:  AIC=28843.95
## tch_real ~ mg_1 + p_resina_1 + ph_cacl2_1 + mo_1 + s_1 + k_1 + 
##     atr
## 
##         Df Sum of Sq     RSS   AIC
## + al_1   1   1926.93 3896550 28844
## <none>               3898477 28844
## + m_1    1     29.72 3898447 28846
## + ctc_1  1     14.23 3898463 28846
## 
## Step:  AIC=28843.86
## tch_real ~ mg_1 + p_resina_1 + ph_cacl2_1 + mo_1 + s_1 + k_1 + 
##     atr + al_1
## 
##         Df Sum of Sq     RSS   AIC
## <none>               3896550 28844
## + m_1    1   1361.54 3895188 28844
## + ctc_1  1     35.73 3896514 28846
## 
## Call:
## lm(formula = tch_real ~ mg_1 + p_resina_1 + ph_cacl2_1 + mo_1 + 
##     s_1 + k_1 + atr + al_1, data = variaveis_validas)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -79.253 -22.991  -3.063  21.138 129.649 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 102.09497    9.11699  11.198  < 2e-16 ***
## mg_1          1.79254    0.12922  13.872  < 2e-16 ***
## p_resina_1    8.85091    0.81922  10.804  < 2e-16 ***
## ph_cacl2_1   -9.79276    1.16887  -8.378  < 2e-16 ***
## mo_1         -0.59283    0.14044  -4.221 2.48e-05 ***
## s_1          -2.57818    0.89147  -2.892  0.00385 ** 
## k_1           0.76759    0.27352   2.806  0.00503 ** 
## atr           0.08859    0.04059   2.182  0.02914 *  
## al_1         -0.52544    0.36403  -1.443  0.14898    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 30.41 on 4213 degrees of freedom
## Multiple R-squared:  0.08084,    Adjusted R-squared:  0.0791 
## F-statistic: 46.32 on 8 and 4213 DF,  p-value: < 2.2e-16
## [1] "10. PCA e biplot"

##  [1] 6.029222247 1.932043179 1.160895993 1.107306680 1.031001656 0.882891625
##  [7] 0.692941754 0.664321056 0.650014256 0.337896731 0.319804673 0.160221886
## [13] 0.022864303 0.006919797 0.001654164
##  [1] 0.4019481498 0.1288028786 0.0773930662 0.0738204453 0.0687334437
##  [6] 0.0588594417 0.0461961169 0.0442880704 0.0433342838 0.0225264487
## [11] 0.0213203115 0.0106814591 0.0015242869 0.0004613198 0.0001102776
##  [1]  40.19481  53.07510  60.81441  68.19645  75.06980  80.95574  85.57535
##  [8]  90.00416  94.33759  96.59023  98.72227  99.79041  99.94284  99.98897
## [15] 100.00000

## [1] "11. Semivariograma e krigagem"

## [using ordinary kriging]
##   0% done  1% done  4% done  7% done 11% done 14% done 17% done 20% done 23% done 27% done 30% done 33% done 36% done 40% done 43% done 46% done 49% done 53% done 56% done 58% done 62% done 65% done 68% done 71% done 75% done 78% done 81% done 84% done 87% done 90% done 93% done 97% done100% done