## [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 (2016)
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.2600000 98.2000000 3.8700000 5.640370 0.8850791 1.203450 2.924390 1.256037 0.0818452 0.0000000 6.698175 5.269530 23.767015 14.1289129 0.0000000
Q1 67.3800000 125.3800000 5.3700000 10.980940 9.4110000 4.175940 17.217109 6.937585 1.2542336 0.2640000 12.806593 26.513523 42.126448 61.6581787 0.2634787
Med 80.7000000 134.0800000 5.6400000 12.864200 12.5864200 5.861650 21.211485 8.849670 2.0473583 0.4400000 14.911237 32.539437 48.260220 68.4931971 1.2034469
Média 82.8544152 133.2789225 5.6322684 13.245157 15.6960641 6.945619 21.947658 9.139075 2.4257255 0.7088048 15.709103 33.510965 49.218307 67.0083418 2.4824255
Q3 100.2325000 142.3700000 5.9200000 15.000000 18.4697500 8.302680 25.537540 11.058157 3.0856830 0.7680000 17.726578 39.169895 54.679593 73.8494267 2.7150839
Max 148.2733333 163.9500000 6.9200000 41.570400 178.6540400 115.583760 222.901024 43.399123 16.1711794 28.0991300 57.394880 239.138509 250.125865 95.6072694 68.1282220
DP 21.6648083 11.0181877 0.4312539 3.213383 11.7458092 4.688293 8.245786 3.228851 1.6422119 1.1129639 4.162032 11.204547 10.933854 9.8480210 4.8277303
CV 26.1480432 8.2670144 7.6568424 24.260816 74.8328317 67.500006 37.570231 35.330171 67.6998227 157.0198106 26.494393 33.435465 22.215013 14.6967090 194.4763406
Skn 0.1389253 -0.3273455 -0.2799568 1.146322 4.8479280 6.651223 5.923979 1.045592 1.6595194 7.9888967 1.609074 3.169909 3.168654 -0.9762067 5.9547436
Krt -0.5549391 -0.5471759 0.6023940 4.346268 44.3593044 111.231886 112.166201 5.725034 4.3361894 125.3526633 5.997423 40.817014 40.096410 1.8770659 49.9723231
## [1] "5. Transformações"
Estatística descritiva após transformações (2016)
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.2600000 98.2000000 3.8700000 5.640370 0.6339698 0.1851924 1.0730860 1.256037 0.0818452 0.0000000 6.698175 1.6619412 3.1682987 14.1289129 0.0000000
Q1 67.3800000 125.3800000 5.3700000 10.980940 2.3428629 1.4293395 2.8459036 6.937585 1.2542336 0.2640000 12.806593 3.2776549 3.7406758 61.6581787 0.2338688
Med 80.7000000 134.0800000 5.6400000 12.864200 2.6090708 1.7684311 3.0545428 8.849670 2.0473583 0.4400000 14.911237 3.4824528 3.8766076 68.4931971 0.7900229
Média 82.8544152 133.2789225 5.6322684 13.245157 2.6678794 1.7992253 3.0333194 9.139075 2.4257255 0.7088048 15.709103 3.4619190 3.8750668 67.0083418 0.8789997
Q3 100.2325000 142.3700000 5.9200000 15.000000 2.9688620 2.1165784 3.2401495 11.058157 3.0856830 0.7680000 17.726578 3.6679085 4.0014906 73.8494267 1.3124013
Max 148.2733333 163.9500000 6.9200000 41.570400 5.1910330 4.7499955 5.4067278 43.399123 16.1711794 28.0991300 57.394880 5.4770429 5.5219642 95.6072694 4.2359631
DP 21.6648083 11.0181877 0.4312539 3.213383 0.5114056 0.5028749 0.3330605 3.228851 1.6422119 1.1129639 4.162032 0.3198412 0.2024683 9.8480210 0.7534231
CV 26.1480432 8.2670144 7.6568424 24.260816 19.1689932 27.9495228 10.9800672 35.330171 67.6998227 157.0198106 26.494393 9.2388412 5.2248985 14.6967090 85.7136922
Skn 0.1389253 -0.3273455 -0.2799568 1.146322 0.5613552 0.4610621 -0.2831555 1.045592 1.6595194 7.9888967 1.609074 -0.4055664 0.3573076 -0.9762067 0.9660524
Krt -0.5549391 -0.5471759 0.6023940 4.346268 1.2338472 0.7120912 2.8079779 5.725034 4.3361894 125.3526633 5.997423 2.2820944 2.3775535 1.8770659 1.1918748
## [1] "6. Seleção de ano/variável"
## Rows: 3,703
## Columns: 3
## $ x <dbl> -49.29976, -49.29920, -49.29879, -49.29791, -49.29754, -49.29691, -4…
## $ y <dbl> -20.93966, -20.93773, -20.93591, -20.93728, -20.94069, -20.93094, -2…
## $ z <dbl> 78.34737, 78.34737, 78.44737, 78.44737, 78.34737, 99.51500, 102.6750…
## [1] "7. Boxplot / histograma / normalidade"
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   30.26   67.38   80.70   82.85  100.23  148.27

## 
##  Shapiro-Wilk normality test
## 
## data:  y_vals
## W = 0.99016, p-value = 2.374e-15
## 
##  Cramer-von Mises normality test
## 
## data:  y_vals
## W = 2.0064, p-value = 7.37e-10
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  y_vals
## D = 0.051527, p-value < 2.2e-16
## 
##  Anderson-Darling normality test
## 
## data:  y_vals
## A = 11.356, 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.08       0.00 -0.05       0.01 -0.09 -0.01  0.00 -0.09
## atr           -0.08  1.00      -0.05  0.01       0.05  0.08 -0.03  0.00  0.04
## ph_cacl2_1     0.00 -0.05       1.00  0.07       0.28 -0.04  0.55  0.49  0.27
## mo_1          -0.05  0.01       0.07  1.00       0.11  0.13  0.31  0.30  0.19
## p_resina_1     0.01  0.05       0.28  0.11       1.00 -0.07  0.28  0.16  0.17
## s_1           -0.09  0.08      -0.04  0.13      -0.07  1.00  0.01  0.03  0.24
## ca_1          -0.01 -0.03       0.55  0.31       0.28  0.01  1.00  0.69  0.29
## mg_1           0.00  0.00       0.49  0.30       0.16  0.03  0.69  1.00  0.38
## k_1           -0.09  0.04       0.27  0.19       0.17  0.24  0.29  0.38  1.00
## al_1          -0.07  0.04      -0.41 -0.03      -0.18  0.16 -0.37 -0.23 -0.10
## h_al_1        -0.03  0.06      -0.58  0.11      -0.15  0.10 -0.30 -0.24 -0.12
## sb_1          -0.02 -0.01       0.59  0.33       0.27  0.06  0.96  0.83  0.46
## ctc_1         -0.04  0.01       0.33  0.41       0.21  0.11  0.85  0.77  0.44
## v_1            0.00 -0.04       0.73  0.16       0.27 -0.02  0.82  0.69  0.38
## m_1           -0.06  0.16      -0.55 -0.06      -0.24  0.16 -0.52 -0.38 -0.21
##             al_1 h_al_1  sb_1 ctc_1   v_1   m_1
## tch_real   -0.07  -0.03 -0.02 -0.04  0.00 -0.06
## atr         0.04   0.06 -0.01  0.01 -0.04  0.16
## ph_cacl2_1 -0.41  -0.58  0.59  0.33  0.73 -0.55
## mo_1       -0.03   0.11  0.33  0.41  0.16 -0.06
## p_resina_1 -0.18  -0.15  0.27  0.21  0.27 -0.24
## s_1         0.16   0.10  0.06  0.11 -0.02  0.16
## ca_1       -0.37  -0.30  0.96  0.85  0.82 -0.52
## mg_1       -0.23  -0.24  0.83  0.77  0.69 -0.38
## k_1        -0.10  -0.12  0.46  0.44  0.38 -0.21
## al_1        1.00   0.33 -0.36 -0.16 -0.44  0.75
## h_al_1      0.33   1.00 -0.30  0.14 -0.74  0.36
## sb_1       -0.36  -0.30  1.00  0.89  0.85 -0.53
## ctc_1      -0.16   0.14  0.89  1.00  0.53 -0.35
## v_1        -0.44  -0.74  0.85  0.53  1.00 -0.57
## m_1         0.75   0.36 -0.53 -0.35 -0.57  1.00

##      ca_1      mg_1    h_al_1      sb_1     ctc_1       v_1 
##  64.89353  12.33205  25.53703 225.53331  70.44043 112.30707
## [1] "9. Regressão múltipla e Stepwise"
## 
## Call:
## lm(formula = form_reg, data = df_aux)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -65.387 -20.944  -4.705  20.946 120.330 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 168.85616   12.31080  13.716  < 2e-16 ***
## atr          -0.19359    0.03289  -5.886 4.11e-09 ***
## ph_cacl2_1   -3.46843    1.01665  -3.412 0.000649 ***
## mo_1         -0.25834    0.11202  -2.306 0.021131 *  
## p_resina_1    1.45841    0.69956   2.085 0.037125 *  
## s_1          -2.87654    0.70160  -4.100 4.17e-05 ***
## mg_1          0.78110    0.17500   4.463 8.18e-06 ***
## k_1          -1.44046    0.23506  -6.128 9.32e-10 ***
## al_1         -1.61502    0.49033  -3.294 0.000993 ***
## ctc_1        -8.87523    2.85928  -3.104 0.001916 ** 
## m_1          -1.18414    0.79451  -1.490 0.136160    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 29.39 on 7950 degrees of freedom
## Multiple R-squared:  0.02705,    Adjusted R-squared:  0.02582 
## F-statistic:  22.1 on 10 and 7950 DF,  p-value: < 2.2e-16

## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_final
## BP = 117.94, df = 10, p-value < 2.2e-16
## 
##  Durbin-Watson test
## 
## data:  modelo_final
## DW = 1.3203, p-value < 2.2e-16
## alternative hypothesis: true autocorrelation is greater than 0
## Start:  AIC=54034.62
## tch_real ~ 1
## 
##              Df Sum of Sq     RSS   AIC
## + s_1         1     62103 6994503 53966
## + k_1         1     56291 7000315 53973
## + atr         1     43536 7013071 53987
## + al_1        1     38820 7017787 53993
## + m_1         1     27826 7028780 54005
## + mo_1        1     15442 7041164 54019
## + ctc_1       1     10310 7046296 54025
## <none>                    7056607 54035
## + p_resina_1  1      1018 7055589 54035
## + mg_1        1        59 7056547 54037
## + ph_cacl2_1  1         3 7056603 54037
## 
## Step:  AIC=53966.25
## tch_real ~ s_1
## 
##              Df Sum of Sq     RSS   AIC
## + atr         1     36172 6958331 53927
## + k_1         1     33501 6961002 53930
## + al_1        1     25354 6969149 53939
## + m_1         1     16742 6977761 53949
## + mo_1        1      8698 6985805 53958
## + ctc_1       1      5526 6988977 53962
## <none>                    6994503 53966
## + p_resina_1  1       235 6994268 53968
## + mg_1        1       202 6994301 53968
## + ph_cacl2_1  1        67 6994436 53968
## 
## Step:  AIC=53926.97
## tch_real ~ s_1 + atr
## 
##              Df Sum of Sq     RSS   AIC
## + k_1         1     32053 6926279 53892
## + al_1        1     23409 6934922 53902
## + m_1         1     10296 6948036 53917
## + mo_1        1      8570 6949762 53919
## + ctc_1       1      5395 6952936 53923
## <none>                    6958331 53927
## + p_resina_1  1       674 6957658 53928
## + ph_cacl2_1  1       278 6958054 53929
## + mg_1        1       209 6958122 53929
## 
## Step:  AIC=53892.21
## tch_real ~ s_1 + atr + k_1
## 
##              Df Sum of Sq     RSS   AIC
## + al_1        1     33007 6893272 53856
## + m_1         1     24046 6902233 53867
## + mg_1        1      8080 6918199 53885
## + mo_1        1      4056 6922223 53890
## + p_resina_1  1      3756 6922523 53890
## <none>                    6926279 53892
## + ph_cacl2_1  1      1285 6924994 53893
## + ctc_1       1        10 6926268 53894
## 
## Step:  AIC=53856.19
## tch_real ~ s_1 + atr + k_1 + al_1
## 
##              Df Sum of Sq     RSS   AIC
## + mo_1        1    4642.1 6888630 53853
## + mg_1        1    3107.8 6890164 53855
## <none>                    6893272 53856
## + ph_cacl2_1  1    1442.3 6891830 53857
## + p_resina_1  1    1166.9 6892105 53857
## + m_1         1     833.3 6892439 53857
## + ctc_1       1     471.3 6892801 53858
## 
## Step:  AIC=53852.82
## tch_real ~ s_1 + atr + k_1 + al_1 + mo_1
## 
##              Df Sum of Sq     RSS   AIC
## + mg_1        1    5708.0 6882922 53848
## <none>                    6888630 53853
## + p_resina_1  1    1655.2 6886975 53853
## + ph_cacl2_1  1    1329.0 6887301 53853
## + m_1         1    1002.3 6887628 53854
## + ctc_1       1      13.1 6888617 53855
## 
## Step:  AIC=53848.22
## tch_real ~ s_1 + atr + k_1 + al_1 + mo_1 + mg_1
## 
##              Df Sum of Sq     RSS   AIC
## + ph_cacl2_1  1    5338.3 6877584 53844
## + ctc_1       1    4762.9 6878159 53845
## <none>                    6882922 53848
## + p_resina_1  1    1391.2 6881531 53849
## + m_1         1     106.4 6882816 53850
## 
## Step:  AIC=53844.05
## tch_real ~ s_1 + atr + k_1 + al_1 + mo_1 + mg_1 + ph_cacl2_1
## 
##              Df Sum of Sq     RSS   AIC
## + ctc_1       1    5824.2 6871760 53839
## + p_resina_1  1    2766.5 6874817 53843
## <none>                    6877584 53844
## + m_1         1    1018.8 6876565 53845
## 
## Step:  AIC=53839.3
## tch_real ~ s_1 + atr + k_1 + al_1 + mo_1 + mg_1 + ph_cacl2_1 + 
##     ctc_1
## 
##              Df Sum of Sq     RSS   AIC
## + p_resina_1  1    4100.4 6867659 53837
## + m_1         1    2265.4 6869494 53839
## <none>                    6871760 53839
## 
## Step:  AIC=53836.55
## tch_real ~ s_1 + atr + k_1 + al_1 + mo_1 + mg_1 + ph_cacl2_1 + 
##     ctc_1 + p_resina_1
## 
##        Df Sum of Sq     RSS   AIC
## + m_1   1    1918.3 6865741 53836
## <none>              6867659 53837
## 
## Step:  AIC=53836.33
## tch_real ~ s_1 + atr + k_1 + al_1 + mo_1 + mg_1 + ph_cacl2_1 + 
##     ctc_1 + p_resina_1 + m_1
## 
## Call:
## lm(formula = tch_real ~ s_1 + atr + k_1 + al_1 + mo_1 + mg_1 + 
##     ph_cacl2_1 + ctc_1 + p_resina_1 + m_1, data = variaveis_validas)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -65.387 -20.944  -4.705  20.946 120.330 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 168.85616   12.31080  13.716  < 2e-16 ***
## s_1          -2.87654    0.70160  -4.100 4.17e-05 ***
## atr          -0.19359    0.03289  -5.886 4.11e-09 ***
## k_1          -1.44046    0.23506  -6.128 9.32e-10 ***
## al_1         -1.61502    0.49033  -3.294 0.000993 ***
## mo_1         -0.25834    0.11202  -2.306 0.021131 *  
## mg_1          0.78110    0.17500   4.463 8.18e-06 ***
## ph_cacl2_1   -3.46843    1.01665  -3.412 0.000649 ***
## ctc_1        -8.87523    2.85928  -3.104 0.001916 ** 
## p_resina_1    1.45841    0.69956   2.085 0.037125 *  
## m_1          -1.18414    0.79451  -1.490 0.136160    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 29.39 on 7950 degrees of freedom
## Multiple R-squared:  0.02705,    Adjusted R-squared:  0.02582 
## F-statistic:  22.1 on 10 and 7950 DF,  p-value: < 2.2e-16
## [1] "10. PCA e biplot"

##  [1] 5.757158138 2.041460729 1.206098965 1.019566277 0.937435399 0.912317882
##  [7] 0.852424064 0.737417569 0.637598621 0.372596423 0.292616262 0.202191377
## [13] 0.019741922 0.008438288 0.002938084
##  [1] 0.3838105425 0.1360973819 0.0804065976 0.0679710852 0.0624956933
##  [6] 0.0608211921 0.0568282709 0.0491611713 0.0425065747 0.0248397615
## [11] 0.0195077508 0.0134794251 0.0013161282 0.0005625525 0.0001958722
##  [1]  38.38105  51.99079  60.03145  66.82856  73.07813  79.16025  84.84308
##  [8]  89.75919  94.00985  96.49383  98.44460  99.79254  99.92416  99.98041
## [15] 100.00000

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

##   model     psill      range
## 1   Nug 107.34426  0.0000000
## 2   Gau  66.61976 -0.6210678
## [using ordinary kriging]
##   0% done  5% done  9% done 13% done 17% done 21% done 24% done 28% done 31% done 35% done 38% done 42% done 45% done 49% done 52% done 55% done 59% done 63% done 66% done 70% done 74% done 79% done 83% done 88% done 92% done 97% done100% done