ANOVA com teste de Skott-Knott para cada variável
##----------------------------------------------------------------------
## Função que obtém as médias ajustadas, o intervalo de confiança para a
## média e aplica o teste de SkottKnott a partir de um modelo de classe
## 'lm'.
meansci <- function(m0){
## Médias ajustadas e matriz para obter IC para a média.
lsm <- LSmeans(m0, effect="acesso")
L <- lsm$K
ic <- confint(glht(m0, linfct=L), calpha=univariate_calpha())
## Composição de tabela com IC e ordenação.
pred <- lsm$grid
pred <- cbind(pred, ic$confint)
pred$acesso <- factor(pred$acesso)
pred$acesso <- with(pred, reorder(acesso, Estimate))
pred <- arrange(pred, acesso)
## Aplicação do teste de SK.
skd <- m0$model; names(skd) <- c("y","acesso")
sk <- with(skd, SK(x=acesso, y=y, model=y~x, which="x"))
## Organização dos dados.
skt <- with(sk,
data.frame(acesso=rownames(m.inf),
cld=groups,
m=m.inf[,"mean"]))
## Junção da classificação com o IC.
pred <- merge(pred, skt)
pred <- arrange(pred, acesso)
return(pred)
}
sst: sólidos solúveis totais
## Anova preliminar.
m0 <- lm(sst~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

## Quadro de anova.
anova(m0)
## Analysis of Variance Table
##
## Response: log(sst)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 14.0219 0.18210 49.761 < 2.2e-16 ***
## Residuals 156 0.5709 0.00366
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
pred
## acesso Estimate lwr upr cld m
## 1 59 1.829883 1.760893 1.898873 10 1.829883
## 2 64 1.838125 1.769135 1.907115 10 1.838125
## 3 65 1.918268 1.849278 1.987258 9 1.918268
## 4 35 1.920935 1.851945 1.989925 9 1.920935
## 5 50 1.930219 1.861229 1.999209 9 1.930219
## 6 60 1.945842 1.876852 2.014832 9 1.945842
## 7 6 1.987812 1.918822 2.056802 8 1.987812
## 8 48 2.004979 1.935989 2.073969 8 2.004979
## 9 63 2.010309 1.941319 2.079299 8 2.010309
## 10 51 2.062616 1.993626 2.131606 8 2.062616
## 11 10 2.066485 1.997495 2.135475 8 2.066485
## 12 54 2.074983 2.005993 2.143973 8 2.074983
## 13 24 2.111968 2.042978 2.180958 8 2.111968
## 14 62 2.143226 2.074236 2.212216 7 2.143226
## 15 14 2.181553 2.112563 2.250543 7 2.181553
## 16 52 2.196695 2.127705 2.265685 7 2.196695
## 17 68 2.200537 2.131547 2.269527 7 2.200537
## 18 19 2.205291 2.136301 2.274281 7 2.205291
## 19 9 2.210465 2.141475 2.279455 7 2.210465
## 20 47 2.211720 2.142730 2.280710 7 2.211720
## 21 41 2.225386 2.156396 2.294376 7 2.225386
## 22 31 2.229359 2.160369 2.298349 7 2.229359
## 23 32 2.243633 2.174643 2.312623 7 2.243633
## 24 55 2.271115 2.202125 2.340105 7 2.271115
## 25 1 2.271463 2.202473 2.340453 7 2.271463
## 26 44 2.271559 2.202569 2.340549 7 2.271559
## 27 8 2.274990 2.206000 2.343980 7 2.274990
## 28 21 2.295885 2.226895 2.364875 6 2.295885
## 29 17 2.305869 2.236879 2.374859 6 2.305869
## 30 20 2.307046 2.238056 2.376036 6 2.307046
## 31 66 2.309021 2.240031 2.378011 6 2.309021
## 32 56 2.318815 2.249825 2.387805 6 2.318815
## 33 57 2.325576 2.256586 2.394566 6 2.325576
## 34 22 2.341528 2.272538 2.410518 6 2.341528
## 35 18 2.341825 2.272835 2.410815 6 2.341825
## 36 7 2.344965 2.275975 2.413955 6 2.344965
## 37 28 2.345928 2.276938 2.414918 6 2.345928
## 38 38 2.348124 2.279134 2.417114 6 2.348124
## 39 33 2.352862 2.283872 2.421852 6 2.352862
## 40 49 2.354263 2.285273 2.423253 6 2.354263
## 41 26 2.360298 2.291308 2.429288 6 2.360298
## 42 75 2.367745 2.298755 2.436735 6 2.367745
## 43 69 2.384365 2.315375 2.453355 6 2.384365
## 44 34 2.396802 2.327812 2.465792 5 2.396802
## 45 71 2.426897 2.357907 2.495887 5 2.426897
## 46 36 2.430574 2.361584 2.499564 5 2.430574
## 47 29 2.433536 2.364546 2.502526 5 2.433536
## 48 23 2.467322 2.398332 2.536312 5 2.467322
## 49 2 2.467464 2.398474 2.536453 5 2.467464
## 50 76 2.479116 2.410126 2.548106 5 2.479116
## 51 5 2.484632 2.415642 2.553622 5 2.484632
## 52 78 2.495678 2.426688 2.564668 5 2.495678
## 53 25 2.498306 2.429316 2.567296 5 2.498306
## 54 15 2.511629 2.442639 2.580619 4 2.511629
## 55 37 2.528174 2.459184 2.597164 4 2.528174
## 56 42 2.529016 2.460026 2.598006 4 2.529016
## 57 61 2.530699 2.461709 2.599689 4 2.530699
## 58 4 2.533613 2.464623 2.602603 4 2.533613
## 59 30 2.534768 2.465778 2.603758 4 2.534768
## 60 72 2.538341 2.469351 2.607331 4 2.538341
## 61 27 2.539548 2.470558 2.608538 4 2.539548
## 62 58 2.577263 2.508273 2.646253 4 2.577263
## 63 74 2.601362 2.532372 2.670352 4 2.601362
## 64 73 2.605758 2.536768 2.674748 4 2.605758
## 65 45 2.606438 2.537448 2.675428 4 2.606438
## 66 77 2.607538 2.538548 2.676528 4 2.607538
## 67 43 2.629345 2.560355 2.698335 3 2.629345
## 68 70 2.633279 2.564289 2.702269 3 2.633279
## 69 39 2.647809 2.578819 2.716799 3 2.647809
## 70 3 2.652362 2.583372 2.721352 3 2.652362
## 71 46 2.671810 2.602820 2.740800 3 2.671810
## 72 12 2.712014 2.643025 2.781004 3 2.712014
## 73 11 2.713057 2.644067 2.782047 3 2.713057
## 74 16 2.736469 2.667479 2.805459 3 2.736469
## 75 67 2.778781 2.709791 2.847770 2 2.778781
## 76 13 2.805286 2.736296 2.874276 2 2.805286
## 77 53 2.886246 2.817256 2.955236 1 2.886246
## 78 40 2.909508 2.840518 2.978498 1 2.909508
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log SST",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

at: acidez titulável
## Anova preliminar.
m0 <- lm(at~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

anova(m0)
## Analysis of Variance Table
##
## Response: log(at)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 23.245 0.301883 32.911 < 2.2e-16 ***
## Residuals 156 1.431 0.009173
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
pred
## acesso Estimate lwr upr cld m
## 1 15 -2.1492673 -2.2584919 -2.0400428 9 -2.1492673
## 2 63 -1.9397311 -2.0489556 -1.8305066 8 -1.9397311
## 3 37 -1.8986048 -2.0078293 -1.7893802 8 -1.8986048
## 4 60 -1.8971200 -2.0063445 -1.7878955 8 -1.8971200
## 5 14 -1.8568837 -1.9661083 -1.7476592 8 -1.8568837
## 6 59 -1.8540943 -1.9633188 -1.7448698 8 -1.8540943
## 7 35 -1.8338861 -1.9431106 -1.7246616 8 -1.8338861
## 8 10 -1.8274134 -1.9366379 -1.7181889 8 -1.8274134
## 9 41 -1.7731122 -1.8823368 -1.6638877 7 -1.7731122
## 10 24 -1.7383599 -1.8475845 -1.6291354 7 -1.7383599
## 11 29 -1.7147984 -1.8240230 -1.6055739 7 -1.7147984
## 12 6 -1.6978064 -1.8070310 -1.5885819 7 -1.6978064
## 13 23 -1.6127880 -1.7220126 -1.5035635 6 -1.6127880
## 14 36 -1.6102723 -1.7194968 -1.5010478 6 -1.6102723
## 15 28 -1.5451411 -1.6543656 -1.4359165 6 -1.5451411
## 16 50 -1.5333610 -1.6425856 -1.4241365 6 -1.5333610
## 17 54 -1.4993105 -1.6085350 -1.3900859 6 -1.4993105
## 18 49 -1.4993105 -1.6085350 -1.3900859 6 -1.4993105
## 19 64 -1.4858134 -1.5950379 -1.3765888 6 -1.4858134
## 20 17 -1.4716268 -1.5808514 -1.3624023 6 -1.4716268
## 21 65 -1.4425128 -1.5517374 -1.3332883 5 -1.4425128
## 22 66 -1.4294392 -1.5386638 -1.3202147 5 -1.4294392
## 23 42 -1.4294392 -1.5386638 -1.3202147 5 -1.4294392
## 24 1 -1.4276956 -1.5369201 -1.3184710 5 -1.4276956
## 25 25 -1.4146220 -1.5238465 -1.3053975 5 -1.4146220
## 26 55 -1.4135090 -1.5227336 -1.3042845 5 -1.4135090
## 27 2 -1.4020419 -1.5112664 -1.2928173 5 -1.4020419
## 28 19 -1.3999017 -1.5091262 -1.2906772 5 -1.3999017
## 29 4 -1.3999017 -1.5091262 -1.2906772 5 -1.3999017
## 30 26 -1.3959255 -1.5051500 -1.2867010 5 -1.3959255
## 31 9 -1.3911293 -1.5003538 -1.2819047 5 -1.3911293
## 32 43 -1.3868281 -1.4960527 -1.2776036 5 -1.3868281
## 33 39 -1.3763120 -1.4855365 -1.2670875 5 -1.3763120
## 34 21 -1.3742480 -1.4834725 -1.2650235 5 -1.3742480
## 35 67 -1.3606407 -1.4698652 -1.2514161 5 -1.3606407
## 36 32 -1.3485943 -1.4578189 -1.2393698 5 -1.3485943
## 37 34 -1.3475671 -1.4567916 -1.2383426 5 -1.3475671
## 38 58 -1.3391278 -1.4483524 -1.2299033 5 -1.3391278
## 39 27 -1.3223710 -1.4315955 -1.2131465 5 -1.3223710
## 40 16 -1.3186583 -1.4278828 -1.2094338 5 -1.3186583
## 41 56 -1.2990448 -1.4082693 -1.1898203 4 -1.2990448
## 42 48 -1.2733911 -1.3826157 -1.1641666 4 -1.2733911
## 43 75 -1.2629736 -1.3721981 -1.1537491 4 -1.2629736
## 44 18 -1.2620906 -1.3713151 -1.1528661 4 -1.2620906
## 45 33 -1.2499681 -1.3591926 -1.1407435 4 -1.2499681
## 46 51 -1.2167581 -1.3259826 -1.1075336 4 -1.2167581
## 47 7 -1.2066502 -1.3158747 -1.0974257 4 -1.2066502
## 48 76 -1.2043434 -1.3135679 -1.0951188 4 -1.2043434
## 49 61 -1.1842704 -1.2934950 -1.0750459 4 -1.1842704
## 50 78 -1.1725733 -1.2817979 -1.0633488 4 -1.1725733
## 51 77 -1.1626223 -1.2718469 -1.0533978 3 -1.1626223
## 52 44 -1.1609471 -1.2701717 -1.0517226 3 -1.1609471
## 53 47 -1.1506899 -1.2599144 -1.0414654 3 -1.1506899
## 54 62 -1.1397600 -1.2489845 -1.0305354 3 -1.1397600
## 55 38 -1.1397600 -1.2489845 -1.0305354 3 -1.1397600
## 56 8 -1.1298090 -1.2390335 -1.0205844 3 -1.1298090
## 57 20 -1.1295027 -1.2387273 -1.0202782 3 -1.1295027
## 58 31 -1.1153425 -1.2245671 -1.0061180 3 -1.1153425
## 59 52 -1.1096008 -1.2188253 -1.0003762 3 -1.1096008
## 60 45 -1.1089689 -1.2181934 -0.9997443 3 -1.1089689
## 61 3 -1.1022959 -1.2115204 -0.9930714 3 -1.1022959
## 62 72 -1.1001733 -1.2093978 -0.9909487 3 -1.1001733
## 63 70 -1.0415220 -1.1507466 -0.9322975 3 -1.0415220
## 64 69 -1.0407041 -1.1499286 -0.9314795 3 -1.0407041
## 65 74 -1.0403638 -1.1495883 -0.9311393 3 -1.0403638
## 66 22 -1.0310415 -1.1402661 -0.9218170 3 -1.0310415
## 67 57 -0.9944958 -1.1037204 -0.8852713 2 -0.9944958
## 68 11 -0.9589255 -1.0681501 -0.8497010 2 -0.9589255
## 69 73 -0.9418278 -1.0510523 -0.8326032 2 -0.9418278
## 70 71 -0.9331693 -1.0423938 -0.8239447 2 -0.9331693
## 71 46 -0.9110406 -1.0202652 -0.8018161 2 -0.9110406
## 72 5 -0.9013992 -1.0106237 -0.7921747 2 -0.9013992
## 73 30 -0.8787378 -0.9879623 -0.7695133 2 -0.8787378
## 74 68 -0.8754363 -0.9846608 -0.7662118 2 -0.8754363
## 75 40 -0.8080250 -0.9172495 -0.6988005 2 -0.8080250
## 76 53 -0.7256113 -0.8348358 -0.6163868 1 -0.7256113
## 77 12 -0.6111773 -0.7204018 -0.5019528 1 -0.6111773
## 78 13 -0.6035251 -0.7127497 -0.4943006 1 -0.6035251
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log AT",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

aa: ácido ascórbico
## Anova preliminar.
m0 <- lm(aa~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

anova(m0)
## Analysis of Variance Table
##
## Response: log(aa)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 37.325 0.48473 15.789 < 2.2e-16 ***
## Residuals 156 4.789 0.03070
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
pred
## acesso Estimate lwr upr cld m
## 1 21 3.480507 3.280684 3.680329 6 3.480507
## 2 23 3.560942 3.361120 3.760764 6 3.560942
## 3 20 3.604179 3.404357 3.804001 6 3.604179
## 4 29 3.740418 3.540596 3.940240 5 3.740418
## 5 25 3.766856 3.567034 3.966678 5 3.766856
## 6 22 3.818587 3.618764 4.018409 5 3.818587
## 7 24 3.823929 3.624107 4.023751 5 3.823929
## 8 12 3.833390 3.633567 4.033212 5 3.833390
## 9 32 3.861186 3.661364 4.061009 5 3.861186
## 10 59 3.867636 3.667814 4.067458 5 3.867636
## 11 17 3.873671 3.673849 4.073494 5 3.873671
## 12 27 3.900948 3.701126 4.100771 5 3.900948
## 13 55 3.929539 3.729717 4.129361 5 3.929539
## 14 28 3.944721 3.744899 4.144543 5 3.944721
## 15 7 3.969763 3.769941 4.169585 5 3.969763
## 16 71 4.011699 3.811877 4.211522 4 4.011699
## 17 8 4.020812 3.820989 4.220634 4 4.020812
## 18 1 4.038546 3.838724 4.238369 4 4.038546
## 19 11 4.045246 3.845424 4.245069 4 4.045246
## 20 35 4.051151 3.851329 4.250974 4 4.051151
## 21 19 4.080362 3.880540 4.280184 4 4.080362
## 22 51 4.083906 3.884084 4.283728 4 4.083906
## 23 57 4.088587 3.888765 4.288410 4 4.088587
## 24 77 4.090698 3.890876 4.290520 4 4.090698
## 25 38 4.131204 3.931382 4.331026 4 4.131204
## 26 70 4.162343 3.962521 4.362165 4 4.162343
## 27 64 4.177921 3.978098 4.377743 4 4.177921
## 28 76 4.182770 3.982948 4.382592 4 4.182770
## 29 36 4.192851 3.993029 4.392673 4 4.192851
## 30 74 4.193094 3.993271 4.392916 4 4.193094
## 31 9 4.207762 4.007940 4.407584 4 4.207762
## 32 4 4.216905 4.017083 4.416727 4 4.216905
## 33 44 4.233499 4.033677 4.433322 4 4.233499
## 34 69 4.249072 4.049249 4.448894 4 4.249072
## 35 37 4.249517 4.049695 4.449340 4 4.249517
## 36 33 4.258103 4.058281 4.457925 4 4.258103
## 37 67 4.260249 4.060427 4.460071 4 4.260249
## 38 61 4.273181 4.073358 4.473003 4 4.273181
## 39 31 4.317498 4.117676 4.517321 4 4.317498
## 40 39 4.323657 4.123835 4.523480 4 4.323657
## 41 16 4.335749 4.135927 4.535571 4 4.335749
## 42 68 4.348283 4.148461 4.548106 4 4.348283
## 43 52 4.353875 4.154053 4.553697 4 4.353875
## 44 46 4.373357 4.173535 4.573179 4 4.373357
## 45 34 4.378036 4.178214 4.577858 4 4.378036
## 46 2 4.415190 4.215368 4.615013 3 4.415190
## 47 10 4.429222 4.229400 4.629044 3 4.429222
## 48 78 4.486176 4.286354 4.685998 3 4.486176
## 49 65 4.486703 4.286881 4.686526 3 4.486703
## 50 72 4.489825 4.290003 4.689648 3 4.489825
## 51 73 4.510056 4.310234 4.709878 3 4.510056
## 52 48 4.600037 4.400215 4.799859 3 4.600037
## 53 58 4.620129 4.420307 4.819952 3 4.620129
## 54 3 4.622956 4.423134 4.822778 3 4.622956
## 55 56 4.628028 4.428205 4.827850 3 4.628028
## 56 26 4.654588 4.454766 4.854410 3 4.654588
## 57 13 4.660079 4.460257 4.859901 3 4.660079
## 58 18 4.661947 4.462124 4.861769 3 4.661947
## 59 14 4.666054 4.466232 4.865876 3 4.666054
## 60 15 4.681002 4.481180 4.880824 3 4.681002
## 61 41 4.688347 4.488525 4.888169 3 4.688347
## 62 66 4.690528 4.490706 4.890350 3 4.690528
## 63 30 4.695446 4.495624 4.895269 3 4.695446
## 64 45 4.730930 4.531108 4.930752 3 4.730930
## 65 54 4.763409 4.563587 4.963232 3 4.763409
## 66 40 4.787787 4.587965 4.987609 3 4.787787
## 67 47 4.792245 4.592422 4.992067 3 4.792245
## 68 60 4.821260 4.621438 5.021082 2 4.821260
## 69 42 4.826634 4.626812 5.026456 2 4.826634
## 70 50 4.830135 4.630313 5.029958 2 4.830135
## 71 62 4.855038 4.655216 5.054860 2 4.855038
## 72 6 4.922797 4.722975 5.122620 2 4.922797
## 73 53 4.942108 4.742285 5.141930 2 4.942108
## 74 63 4.974341 4.774518 5.174163 2 4.974341
## 75 75 5.012826 4.813004 5.212648 2 5.012826
## 76 43 5.125099 4.925277 5.324921 1 5.125099
## 77 49 5.149684 4.949862 5.349506 1 5.149684
## 78 5 5.300224 5.100402 5.500046 1 5.300224
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log AA",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

ft: fenóis totais
## Anova preliminar.
m0 <- lm(ft~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=1, col=2)

layout(1)
## Anova com a variável transformada.
## m0 <- update(m0, log(.)~.)
## m0 <- update(m0, sqrt(.)~.)
## par(mfrow=c(2,2)); plot(m0); layout(1)
anova(m0)
## Analysis of Variance Table
##
## Response: ft
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 76 363497 4782.9 202.2 < 2.2e-16 ***
## Residuals 154 3643 23.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
pred
## acesso Estimate lwr upr cld m
## 1 78 29.28094 23.73376 34.82812 16 29.28094
## 2 34 35.93718 30.39000 41.48436 16 35.93718
## 3 24 50.57627 45.02909 56.12345 15 50.57627
## 4 32 57.38492 51.83774 62.93210 14 57.38492
## 5 29 58.93575 53.38857 64.48293 14 58.93575
## 6 35 59.57551 54.02833 65.12269 14 59.57551
## 7 26 60.44533 54.89815 65.99251 14 60.44533
## 8 23 62.17605 56.62887 67.72323 14 62.17605
## 9 17 63.32274 57.77556 68.86992 14 63.32274
## 10 55 64.99554 59.44836 70.54272 13 64.99554
## 11 22 67.96908 62.42190 73.51625 13 67.96908
## 12 27 74.94933 69.40215 80.49651 12 74.94933
## 13 28 79.35381 73.80664 84.90099 11 79.35381
## 14 60 80.85435 75.30717 86.40153 11 80.85435
## 15 36 82.19711 76.64993 87.74429 11 82.19711
## 16 54 82.23546 76.68828 87.78263 11 82.23546
## 17 21 83.59185 78.04467 89.13903 11 83.59185
## 18 59 83.66320 78.11603 89.21038 11 83.66320
## 19 51 84.24918 78.70200 89.79636 11 84.24918
## 20 61 85.33128 79.78410 90.87846 11 85.33128
## 21 38 85.97158 80.42440 91.51876 11 85.97158
## 22 1 86.09416 80.54698 91.64134 11 86.09416
## 23 50 87.85482 82.30764 93.40200 11 87.85482
## 24 8 89.30491 83.75774 94.85209 10 89.30491
## 25 48 89.84048 84.29330 95.38766 10 89.84048
## 26 14 91.62429 86.07712 97.17147 10 91.62429
## 27 15 92.16515 86.61797 97.71232 10 92.16515
## 28 66 94.27000 88.72282 99.81718 10 94.27000
## 29 19 94.73635 89.18917 100.28352 10 94.73635
## 30 10 95.61441 90.06723 101.16158 10 95.61441
## 31 37 97.43436 91.88719 102.98154 9 97.43436
## 32 57 98.25833 92.71115 103.80551 9 98.25833
## 33 18 98.36696 92.81978 103.91414 9 98.36696
## 34 4 99.49000 93.94282 105.03718 9 99.49000
## 35 6 99.51378 93.96660 105.06096 9 99.51378
## 36 44 99.96847 94.42129 105.51564 9 99.96847
## 37 25 101.67463 96.12746 107.22181 9 101.67463
## 38 47 102.76483 97.21765 108.31201 9 102.76483
## 39 52 105.49798 99.95080 111.04516 8 105.49798
## 40 9 105.76624 100.21906 111.31342 8 105.76624
## 41 63 106.03506 100.48788 111.58224 8 106.03506
## 42 71 106.15095 100.60377 111.69813 8 106.15095
## 43 58 106.65140 101.10422 112.19858 8 106.65140
## 44 33 107.83858 102.29140 113.38576 8 107.83858
## 45 42 110.03332 104.48614 115.58050 8 110.03332
## 46 73 110.68771 105.14053 116.23488 8 110.68771
## 47 39 116.56215 111.01497 122.10932 7 116.56215
## 48 11 117.46221 111.91503 123.00939 7 117.46221
## 49 64 123.33495 117.78777 128.88213 6 123.33495
## 50 65 124.25270 118.70552 129.79987 6 124.25270
## 51 12 124.56874 119.02156 130.11592 6 124.56874
## 52 46 124.97175 119.42457 130.51893 6 124.97175
## 53 62 127.19508 121.64790 132.74226 6 127.19508
## 54 2 128.56121 123.01403 134.10838 6 128.56121
## 55 20 129.50022 123.95304 135.04740 6 129.50022
## 56 68 133.94282 128.39564 139.49000 5 133.94282
## 57 56 135.19460 129.64742 140.74178 5 135.19460
## 58 7 135.22143 129.67425 140.76861 5 135.22143
## 59 49 135.48023 129.93305 141.02740 5 135.48023
## 60 45 138.39336 132.84618 143.94054 5 138.39336
## 61 70 144.29025 138.74308 149.83743 4 144.29025
## 62 72 149.95480 144.40762 155.50198 4 149.95480
## 63 76 150.23194 144.68476 155.77911 4 150.23194
## 64 31 152.07022 146.52304 157.61740 4 152.07022
## 65 13 163.62419 158.07701 169.17137 3 163.62419
## 66 67 163.80516 158.25798 169.35234 3 163.80516
## 67 5 165.23783 159.69066 170.78501 3 165.23783
## 68 16 165.34087 159.79369 170.88804 3 165.34087
## 69 75 167.31039 161.76321 172.85757 3 167.31039
## 70 3 167.36582 161.81864 172.91300 3 167.36582
## 71 43 182.45860 176.91142 188.00578 2 182.45860
## 72 77 185.82728 180.28010 191.37446 2 185.82728
## 73 30 186.14689 180.59971 191.69407 2 186.14689
## 74 40 188.00476 182.45758 193.55194 2 188.00476
## 75 74 193.63222 188.08504 199.17940 1 193.63222
## 76 69 197.90207 192.35489 203.44925 1 197.90207
## 77 53 198.66667 193.11949 204.21384 1 198.66667
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="FT",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

flav: flavonóides
## Anova preliminar.
m0 <- lm(flav~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=1, col=2)

layout(1)
## Anova com a variável transformada.
## m0 <- update(m0, log(.)~.)
## par(mfrow=c(2,2)); plot(m0); layout(1)
anova(m0)
## Analysis of Variance Table
##
## Response: flav
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 356034 4623.8 253.04 < 2.2e-16 ***
## Residuals 156 2851 18.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
pred
## acesso Estimate lwr upr cld m
## 1 48 15.68000 10.80496 20.55504 16 15.68000
## 2 10 16.06333 11.18829 20.93837 16 16.06333
## 3 47 17.12667 12.25163 22.00171 16 17.12667
## 4 9 19.53333 14.65829 24.40837 16 19.53333
## 5 8 20.29667 15.42163 25.17171 16 20.29667
## 6 35 20.41000 15.53496 25.28504 16 20.41000
## 7 49 21.43333 16.55829 26.30837 16 21.43333
## 8 51 21.46000 16.58496 26.33504 16 21.46000
## 9 64 25.58000 20.70496 30.45504 15 25.58000
## 10 25 25.64000 20.76496 30.51504 15 25.64000
## 11 54 26.54667 21.67163 31.42171 15 26.54667
## 12 66 26.80333 21.92829 31.67837 15 26.80333
## 13 59 27.47667 22.60163 32.35171 15 27.47667
## 14 22 28.40000 23.52496 33.27504 15 28.40000
## 15 63 30.02000 25.14496 34.89504 15 30.02000
## 16 32 30.37667 25.50163 35.25171 15 30.37667
## 17 60 30.46333 25.58829 35.33837 15 30.46333
## 18 34 30.71667 25.84163 35.59171 15 30.71667
## 19 23 34.99667 30.12163 39.87171 14 34.99667
## 20 20 35.32333 30.44829 40.19837 14 35.32333
## 21 14 35.75667 30.88163 40.63171 14 35.75667
## 22 7 35.85333 30.97829 40.72837 14 35.85333
## 23 57 36.73667 31.86163 41.61171 14 36.73667
## 24 38 38.55333 33.67829 43.42837 14 38.55333
## 25 1 39.07667 34.20163 43.95171 14 39.07667
## 26 26 40.25000 35.37496 45.12504 13 40.25000
## 27 50 41.96000 37.08496 46.83504 13 41.96000
## 28 55 42.12000 37.24496 46.99504 13 42.12000
## 29 6 42.76667 37.89163 47.64171 13 42.76667
## 30 33 43.44333 38.56829 48.31837 13 43.44333
## 31 65 46.13000 41.25496 51.00504 12 46.13000
## 32 24 48.13333 43.25829 53.00837 12 48.13333
## 33 56 48.65667 43.78163 53.53171 12 48.65667
## 34 29 51.18333 46.30829 56.05837 12 51.18333
## 35 61 52.66667 47.79163 57.54171 11 52.66667
## 36 4 52.93667 48.06163 57.81171 11 52.93667
## 37 12 54.24667 49.37163 59.12171 11 54.24667
## 38 11 55.23333 50.35829 60.10837 11 55.23333
## 39 41 57.47667 52.60163 62.35171 11 57.47667
## 40 44 57.86667 52.99163 62.74171 11 57.86667
## 41 58 63.69000 58.81496 68.56504 10 63.69000
## 42 17 64.11333 59.23829 68.98837 10 64.11333
## 43 19 65.58333 60.70829 70.45837 10 65.58333
## 44 52 65.95333 61.07829 70.82837 10 65.95333
## 45 70 68.27333 63.39829 73.14837 10 68.27333
## 46 2 69.00667 64.13163 73.88171 10 69.00667
## 47 28 69.22667 64.35163 74.10171 10 69.22667
## 48 67 69.46667 64.59163 74.34171 10 69.46667
## 49 37 74.23000 69.35496 79.10504 9 74.23000
## 50 46 75.30333 70.42829 80.17837 9 75.30333
## 51 36 77.66000 72.78496 82.53504 9 77.66000
## 52 71 78.37000 73.49496 83.24504 9 78.37000
## 53 78 80.09667 75.22163 84.97171 9 80.09667
## 54 45 80.16667 75.29163 85.04171 9 80.16667
## 55 62 81.48000 76.60496 86.35504 9 81.48000
## 56 21 82.38333 77.50829 87.25837 9 82.38333
## 57 16 83.96667 79.09163 88.84171 8 83.96667
## 58 43 86.44667 81.57163 91.32171 8 86.44667
## 59 68 87.71333 82.83829 92.58837 8 87.71333
## 60 18 87.99000 83.11496 92.86504 8 87.99000
## 61 76 88.19333 83.31829 93.06837 8 88.19333
## 62 42 89.18667 84.31163 94.06171 8 89.18667
## 63 30 90.34667 85.47163 95.22171 8 90.34667
## 64 15 96.00667 91.13163 100.88171 7 96.00667
## 65 13 96.21667 91.34163 101.09171 7 96.21667
## 66 69 97.67667 92.80163 102.55171 7 97.67667
## 67 73 98.55667 93.68163 103.43171 7 98.55667
## 68 31 113.15000 108.27496 118.02504 6 113.15000
## 69 75 117.39333 112.51829 122.26837 5 117.39333
## 70 27 125.46667 120.59163 130.34171 4 125.46667
## 71 77 127.91333 123.03829 132.78837 4 127.91333
## 72 40 133.92000 129.04496 138.79504 3 133.92000
## 73 5 133.92667 129.05163 138.80171 3 133.92667
## 74 53 135.18333 130.30829 140.05837 3 135.18333
## 75 39 135.41667 130.54163 140.29171 3 135.41667
## 76 74 164.63333 159.75829 169.50837 2 164.63333
## 77 72 168.03000 163.15496 172.90504 2 168.03000
## 78 3 192.29667 187.42163 197.17171 1 192.29667
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="FLAV",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

anto: antocianinas
## Anova preliminar.
m0 <- lm(anto~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

anova(m0)
## Analysis of Variance Table
##
## Response: log(anto)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 116.466 1.51254 116.6 < 2.2e-16 ***
## Residuals 156 2.024 0.01297
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
pred
## acesso Estimate lwr upr cld m
## 1 47 0.5802652 0.4503753 0.7101551 12 0.5802652
## 2 48 0.7997668 0.6698769 0.9296566 11 0.7997668
## 3 50 0.8153648 0.6854749 0.9452547 11 0.8153648
## 4 57 0.8987596 0.7688697 1.0286495 11 0.8987596
## 5 64 1.0236264 0.8937365 1.1535162 10 1.0236264
## 6 51 1.0508216 0.9209318 1.1807115 10 1.0508216
## 7 65 1.0907840 0.9608941 1.2206738 10 1.0907840
## 8 69 1.1277117 0.9978219 1.2576016 10 1.1277117
## 9 8 1.1441687 1.0142788 1.2740586 10 1.1441687
## 10 9 1.1567390 1.0268491 1.2866289 10 1.1567390
## 11 10 1.2873732 1.1574833 1.4172631 9 1.2873732
## 12 22 1.3556713 1.2257814 1.4855611 9 1.3556713
## 13 25 1.4523336 1.3224438 1.5822235 8 1.4523336
## 14 32 1.5216738 1.3917839 1.6515636 8 1.5216738
## 15 35 1.5639126 1.4340227 1.6938024 8 1.5639126
## 16 34 1.5774770 1.4475871 1.7073669 8 1.5774770
## 17 66 1.5799912 1.4501013 1.7098811 8 1.5799912
## 18 54 1.6052095 1.4753196 1.7350994 8 1.6052095
## 19 70 1.6422211 1.5123312 1.7721109 8 1.6422211
## 20 29 1.7076982 1.5778083 1.8375881 8 1.7076982
## 21 49 1.7842262 1.6543363 1.9141160 7 1.7842262
## 22 24 1.7861470 1.6562572 1.9160369 7 1.7861470
## 23 59 1.7927826 1.6628927 1.9226725 7 1.7927826
## 24 33 1.8542785 1.7243886 1.9841684 7 1.8542785
## 25 55 1.8572982 1.7274083 1.9871880 7 1.8572982
## 26 60 1.8639461 1.7340563 1.9938360 7 1.8639461
## 27 7 1.9501051 1.8202152 2.0799950 6 1.9501051
## 28 26 1.9537937 1.8239038 2.0836835 6 1.9537937
## 29 41 1.9626687 1.8327788 2.0925586 6 1.9626687
## 30 18 1.9632303 1.8333404 2.0931202 6 1.9632303
## 31 1 1.9764297 1.8465399 2.1063196 6 1.9764297
## 32 20 1.9845321 1.8546423 2.1144220 6 1.9845321
## 33 4 1.9865410 1.8566511 2.1164308 6 1.9865410
## 34 14 1.9976721 1.8677823 2.1275620 6 1.9976721
## 35 63 2.0136838 1.8837939 2.1435736 6 2.0136838
## 36 23 2.0240972 1.8942074 2.1539871 6 2.0240972
## 37 5 2.0467113 1.9168215 2.1766012 6 2.0467113
## 38 68 2.2155578 2.0856679 2.3454476 5 2.2155578
## 39 72 2.2195259 2.0896360 2.3494158 5 2.2195259
## 40 52 2.2412672 2.1113774 2.3711571 5 2.2412672
## 41 28 2.2428291 2.1129392 2.3727189 5 2.2428291
## 42 38 2.2480035 2.1181136 2.3778934 5 2.2480035
## 43 37 2.2502286 2.1203388 2.3801185 5 2.2502286
## 44 45 2.3243428 2.1944529 2.4542326 5 2.3243428
## 45 13 2.3319916 2.2021017 2.4618815 5 2.3319916
## 46 46 2.3369815 2.2070917 2.4668714 5 2.3369815
## 47 6 2.3728057 2.2429158 2.5026956 5 2.3728057
## 48 17 2.3871602 2.2572704 2.5170501 5 2.3871602
## 49 56 2.3884264 2.2585366 2.5183163 5 2.3884264
## 50 2 2.4498529 2.3199631 2.5797428 4 2.4498529
## 51 16 2.4540757 2.3241858 2.5839655 4 2.4540757
## 52 75 2.4601418 2.3302519 2.5900316 4 2.4601418
## 53 27 2.4723215 2.3424316 2.6022113 4 2.4723215
## 54 11 2.4864749 2.3565850 2.6163647 4 2.4864749
## 55 12 2.5063635 2.3764736 2.6362533 4 2.5063635
## 56 19 2.5122454 2.3823556 2.6421353 4 2.5122454
## 57 78 2.5347057 2.4048158 2.6645956 4 2.5347057
## 58 77 2.5959046 2.4660148 2.7257945 4 2.5959046
## 59 61 2.6240977 2.4942078 2.7539875 4 2.6240977
## 60 71 2.6327323 2.5028425 2.7626222 4 2.6327323
## 61 30 2.7748348 2.6449449 2.9047246 3 2.7748348
## 62 67 2.8488402 2.7189503 2.9787301 3 2.8488402
## 63 15 2.8791565 2.7492666 3.0090463 3 2.8791565
## 64 3 2.8840957 2.7542059 3.0139856 3 2.8840957
## 65 31 2.9137965 2.7839066 3.0436863 3 2.9137965
## 66 58 2.9922040 2.8623141 3.1220939 3 2.9922040
## 67 76 3.0186920 2.8888021 3.1485819 3 3.0186920
## 68 44 3.0290761 2.8991863 3.1589660 3 3.0290761
## 69 36 3.1529042 3.0230143 3.2827941 2 3.1529042
## 70 40 3.1702729 3.0403830 3.3001628 2 3.1702729
## 71 42 3.1809311 3.0510412 3.3108210 2 3.1809311
## 72 62 3.1993481 3.0694583 3.3292380 2 3.1993481
## 73 73 3.2775358 3.1476459 3.4074256 1 3.2775358
## 74 74 3.3386198 3.2087300 3.4685097 1 3.3386198
## 75 43 3.3430953 3.2132054 3.4729851 1 3.3430953
## 76 21 3.3617964 3.2319065 3.4916862 1 3.3617964
## 77 39 3.3663958 3.2365059 3.4962857 1 3.3663958
## 78 53 3.4625669 3.3326770 3.5924567 1 3.4625669
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log ANTO",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

cloroA: clorofila A
## Anova preliminar.
m0 <- lm(cloroA~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

anova(m0)
## Analysis of Variance Table
##
## Response: log(cloroA)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 89.217 1.15866 8.3294 < 2.2e-16 ***
## Residuals 154 21.422 0.13911
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
pred
## acesso Estimate lwr upr cld m
## 1 10 -3.7768680 -4.202256 -3.3514800 4 -3.7768680
## 2 33 -3.6417129 -4.067101 -3.2163250 4 -3.6417129
## 3 21 -3.5065579 -3.931946 -3.0811699 4 -3.5065579
## 4 29 -3.4106639 -3.836052 -2.9852759 4 -3.4106639
## 5 23 -3.2403887 -3.665777 -2.8150007 4 -3.2403887
## 6 6 -3.1796148 -3.605003 -2.7542269 4 -3.1796148
## 7 34 -3.1796148 -3.605003 -2.7542269 4 -3.1796148
## 8 14 -3.0837208 -3.509109 -2.6583328 3 -3.0837208
## 9 17 -3.0538501 -3.479238 -2.6284621 3 -3.0538501
## 10 75 -3.0444598 -3.469848 -2.6190718 3 -3.0444598
## 11 22 -3.0323372 -3.457725 -2.6069493 3 -3.0323372
## 12 9 -2.9957323 -3.421120 -2.5703443 3 -2.9957323
## 13 41 -2.9485658 -3.373954 -2.5231778 3 -2.9485658
## 14 15 -2.9218849 -3.347273 -2.4964969 3 -2.9218849
## 15 60 -2.8971822 -3.322570 -2.4717942 3 -2.8971822
## 16 8 -2.8228010 -3.248189 -2.3974131 3 -2.8228010
## 17 35 -2.7782905 -3.203678 -2.3529026 3 -2.7782905
## 18 4 -2.7646832 -3.190071 -2.3392953 3 -2.7646832
## 19 26 -2.7620272 -3.187415 -2.3366392 3 -2.7620272
## 20 69 -2.7269070 -3.152295 -2.3015190 3 -2.7269070
## 21 12 -2.6216227 -3.047011 -2.1962347 3 -2.6216227
## 22 19 -2.6147496 -3.040138 -2.1893616 3 -2.6147496
## 23 28 -2.5042972 -2.929685 -2.0789092 3 -2.5042972
## 24 61 -2.4795945 -2.904982 -2.0542066 3 -2.4795945
## 25 2 -2.4640879 -2.889476 -2.0386999 3 -2.4640879
## 26 48 -2.4214767 -2.846865 -1.9960888 2 -2.4214767
## 27 37 -2.4120864 -2.837474 -1.9866985 2 -2.4120864
## 28 59 -2.3958231 -2.821211 -1.9704351 2 -2.3958231
## 29 65 -2.3691422 -2.794530 -1.9437542 2 -2.3691422
## 30 25 -2.3410554 -2.766443 -1.9156674 2 -2.3410554
## 31 78 -2.3410554 -2.766443 -1.9156674 2 -2.3410554
## 32 54 -2.3377053 -2.763093 -1.9123173 2 -2.3377053
## 33 47 -2.3377053 -2.763093 -1.9123173 2 -2.3377053
## 34 5 -2.3093193 -2.734707 -1.8839314 2 -2.3093193
## 35 45 -2.3025851 -2.727973 -1.8771971 2 -2.3025851
## 36 70 -2.2554186 -2.680807 -1.8300306 2 -2.2554186
## 37 7 -2.2545516 -2.679940 -1.8291637 2 -2.2545516
## 38 50 -2.2330388 -2.658427 -1.8076509 2 -2.2330388
## 39 43 -2.2184805 -2.643868 -1.7930925 2 -2.2184805
## 40 32 -2.2072749 -2.632663 -1.7818870 2 -2.2072749
## 41 38 -2.2025502 -2.627938 -1.7771623 2 -2.2025502
## 42 77 -2.1894767 -2.614865 -1.7640887 2 -2.1894767
## 43 49 -2.1782711 -2.603659 -1.7528832 2 -2.1782711
## 44 71 -2.1741643 -2.599552 -1.7487763 2 -2.1741643
## 45 63 -2.1000553 -2.525443 -1.6746674 2 -2.1000553
## 46 18 -2.0823771 -2.507765 -1.6569891 2 -2.0823771
## 47 55 -2.0748861 -2.500274 -1.6494982 2 -2.0748861
## 48 42 -2.0669017 -2.492290 -1.6415138 2 -2.0669017
## 49 24 -2.0629801 -2.488368 -1.6375922 2 -2.0629801
## 50 20 -2.0458824 -2.471270 -1.6204944 2 -2.0458824
## 51 72 -2.0434223 -2.468810 -1.6180344 2 -2.0434223
## 52 58 -2.0031668 -2.524159 -1.4821751 2 -2.0031668
## 53 64 -2.0019897 -2.427378 -1.5766018 2 -2.0019897
## 54 16 -1.9944988 -2.419887 -1.5691108 2 -1.9944988
## 55 11 -1.9649003 -2.390288 -1.5395123 2 -1.9649003
## 56 73 -1.9499883 -2.375376 -1.5246004 2 -1.9499883
## 57 27 -1.8986048 -2.323993 -1.4732168 2 -1.8986048
## 58 3 -1.8892145 -2.314602 -1.4638265 2 -1.8892145
## 59 67 -1.8815864 -2.306974 -1.4561984 2 -1.8815864
## 60 30 -1.8690063 -2.294394 -1.4436183 2 -1.8690063
## 61 53 -1.8575847 -2.282973 -1.4321968 2 -1.8575847
## 62 40 -1.8438371 -2.269225 -1.4184491 2 -1.8438371
## 63 62 -1.8176227 -2.243011 -1.3922348 2 -1.8176227
## 64 57 -1.7771743 -2.298166 -1.2561826 2 -1.7771743
## 65 56 -1.7754351 -2.200823 -1.3500472 2 -1.7754351
## 66 1 -1.7464313 -2.171819 -1.3210434 2 -1.7464313
## 67 51 -1.6802961 -2.105684 -1.2549082 1 -1.6802961
## 68 36 -1.6091047 -2.034493 -1.1837168 1 -1.6091047
## 69 76 -1.6028370 -2.028225 -1.1774491 1 -1.6028370
## 70 74 -1.5161373 -1.941525 -1.0907493 1 -1.5161373
## 71 13 -1.4633529 -1.888741 -1.0379650 1 -1.4633529
## 72 66 -1.3688597 -1.794248 -0.9434717 1 -1.3688597
## 73 46 -1.3669217 -1.792310 -0.9415338 1 -1.3669217
## 74 44 -1.3176150 -1.743003 -0.8922270 1 -1.3176150
## 75 39 -1.2382709 -1.663659 -0.8128830 1 -1.2382709
## 76 68 -1.0815005 -1.506888 -0.6561125 1 -1.0815005
## 77 52 -0.9744085 -1.399796 -0.5490206 1 -0.9744085
## 78 31 -0.6943493 -1.119737 -0.2689614 1 -0.6943493
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log cloroA",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

cloroB: clorofila B
## Anova preliminar.
m0 <- lm(cloroB~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

anova(m0)
## Analysis of Variance Table
##
## Response: log(cloroB)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 65.839 0.85505 8.5057 < 2.2e-16 ***
## Residuals 154 15.481 0.10053
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
pred
## acesso Estimate lwr upr cld m
## 1 10 -2.7620272 -3.1236488 -2.4004055 5 -2.7620272
## 2 17 -2.4565969 -2.8182186 -2.0949752 5 -2.4565969
## 3 14 -2.3377053 -2.6993270 -1.9760836 5 -2.3377053
## 4 29 -2.3311044 -2.6927261 -1.9694827 5 -2.3311044
## 5 6 -2.2418112 -2.6034329 -1.8801896 5 -2.2418112
## 6 21 -2.2100412 -2.5716629 -1.8484195 5 -2.2100412
## 7 23 -2.1782711 -2.5398928 -1.8166494 5 -2.1782711
## 8 22 -2.0256741 -2.3872958 -1.6640525 5 -2.0256741
## 9 34 -2.0250937 -2.3867154 -1.6634720 5 -2.0250937
## 10 33 -1.9960899 -2.3577116 -1.6344682 5 -1.9960899
## 11 75 -1.9789921 -2.3406138 -1.6173704 5 -1.9789921
## 12 26 -1.9217087 -2.2833304 -1.5600870 4 -1.9217087
## 13 41 -1.8986048 -2.2602265 -1.5369831 4 -1.8986048
## 14 4 -1.8489262 -2.2105479 -1.4873046 4 -1.8489262
## 15 24 -1.8319311 -2.1935527 -1.4703094 4 -1.8319311
## 16 28 -1.8242236 -2.1858453 -1.4626019 4 -1.8242236
## 17 35 -1.7946251 -2.1562468 -1.4330034 4 -1.7946251
## 18 69 -1.7881524 -2.1497741 -1.4265307 4 -1.7881524
## 19 12 -1.7701300 -2.1317517 -1.4085083 4 -1.7701300
## 20 15 -1.7563823 -2.1180040 -1.3947606 4 -1.7563823
## 21 9 -1.7177839 -2.0794056 -1.3561622 4 -1.7177839
## 22 19 -1.6987311 -2.0603528 -1.3371094 4 -1.6987311
## 23 59 -1.6871692 -2.0487909 -1.3255475 4 -1.6871692
## 24 8 -1.6644453 -2.0260670 -1.3028236 4 -1.6644453
## 25 60 -1.6626319 -2.0242536 -1.3010102 4 -1.6626319
## 26 18 -1.6127880 -1.9744097 -1.2511663 4 -1.6127880
## 27 36 -1.5801010 -1.9417226 -1.2184793 4 -1.5801010
## 28 61 -1.5611160 -1.9227377 -1.1994943 4 -1.5611160
## 29 2 -1.5219832 -1.8836048 -1.1603615 4 -1.5219832
## 30 37 -1.5105160 -1.8721377 -1.1488943 4 -1.5105160
## 31 54 -1.4921124 -1.8537341 -1.1304907 4 -1.4921124
## 32 25 -1.4753958 -1.8370175 -1.1137742 4 -1.4753958
## 33 48 -1.4313386 -1.7929603 -1.0697169 3 -1.4313386
## 34 78 -1.4140882 -1.7757099 -1.0524665 3 -1.4140882
## 35 50 -1.4060695 -1.7676912 -1.0444478 3 -1.4060695
## 36 38 -1.3391278 -1.7007495 -0.9775062 3 -1.3391278
## 37 70 -1.3341650 -1.6957867 -0.9725433 3 -1.3341650
## 38 1 -1.3232350 -1.6848567 -0.9616133 3 -1.3232350
## 39 5 -1.3137315 -1.6753532 -0.9521098 3 -1.3137315
## 40 47 -1.3111673 -1.6727890 -0.9495457 3 -1.3111673
## 41 65 -1.2942842 -1.6559059 -0.9326625 3 -1.2942842
## 42 55 -1.2681417 -1.6297634 -0.9065200 3 -1.2681417
## 43 49 -1.2616940 -1.6233157 -0.9000723 3 -1.2616940
## 44 43 -1.2465839 -1.6082056 -0.8849622 3 -1.2465839
## 45 63 -1.2160405 -1.5776622 -0.8544188 3 -1.2160405
## 46 45 -1.2073229 -1.5689446 -0.8457012 3 -1.2073229
## 47 32 -1.1934134 -1.5550351 -0.8317917 3 -1.1934134
## 48 72 -1.1899746 -1.5515963 -0.8283529 3 -1.1899746
## 49 7 -1.1799693 -1.5415910 -0.8183476 3 -1.1799693
## 50 11 -1.1746358 -1.5362575 -0.8130142 3 -1.1746358
## 51 73 -1.1453665 -1.5069882 -0.7837448 3 -1.1453665
## 52 71 -1.1301254 -1.4917471 -0.7685037 3 -1.1301254
## 53 42 -1.1195518 -1.4811734 -0.7579301 3 -1.1195518
## 54 39 -1.1064531 -1.4680748 -0.7448314 3 -1.1064531
## 55 64 -1.1036637 -1.4652854 -0.7420420 3 -1.1036637
## 56 20 -1.1036637 -1.4652854 -0.7420420 3 -1.1036637
## 57 30 -1.0887606 -1.4503823 -0.7271390 3 -1.0887606
## 58 77 -1.0845926 -1.4462143 -0.7229709 3 -1.0845926
## 59 58 -1.0651569 -1.5080512 -0.6222626 3 -1.0651569
## 60 16 -1.0310415 -1.3926632 -0.6694198 3 -1.0310415
## 61 40 -1.0161527 -1.3777744 -0.6545310 3 -1.0161527
## 62 56 -0.9810466 -1.3426683 -0.6194249 3 -0.9810466
## 63 27 -0.9199145 -1.2815362 -0.5582928 3 -0.9199145
## 64 62 -0.9147526 -1.2763743 -0.5531309 3 -0.9147526
## 65 67 -0.9082683 -1.2698899 -0.5466466 3 -0.9082683
## 66 53 -0.8939716 -1.2555933 -0.5323499 3 -0.8939716
## 67 3 -0.8596571 -1.2212788 -0.4980354 3 -0.8596571
## 68 51 -0.8096550 -1.1712767 -0.4480333 2 -0.8096550
## 69 76 -0.7728371 -1.1344588 -0.4112154 2 -0.7728371
## 70 13 -0.7674117 -1.1290334 -0.4057900 2 -0.7674117
## 71 57 -0.7179524 -1.1608467 -0.2750581 2 -0.7179524
## 72 74 -0.6740967 -1.0357184 -0.3124751 2 -0.6740967
## 73 66 -0.6456475 -1.0072692 -0.2840258 2 -0.6456475
## 74 46 -0.5244330 -0.8860546 -0.1628113 2 -0.5244330
## 75 44 -0.5008154 -0.8624371 -0.1391937 2 -0.5008154
## 76 52 -0.1760228 -0.5376445 0.1855989 1 -0.1760228
## 77 68 -0.1401364 -0.5017581 0.2214853 1 -0.1401364
## 78 31 -0.1334766 -0.4950983 0.2281451 1 -0.1334766
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log cloroB",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

carot: carotenóides
## Anova preliminar.
m0 <- lm(carot~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

anova(m0)
## Analysis of Variance Table
##
## Response: log(carot)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 121.291 1.57521 23.862 < 2.2e-16 ***
## Residuals 154 10.166 0.06601
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
pred
## acesso Estimate lwr upr cld m
## 1 23 -0.512636087 -0.8056760338 -0.219596140 6 -0.512636087
## 2 64 -0.401541005 -0.6945809519 -0.108501059 6 -0.401541005
## 3 29 -0.383835621 -0.6768755681 -0.090795675 6 -0.383835621
## 4 48 -0.375929948 -0.6689698945 -0.082890001 6 -0.375929948
## 5 22 -0.354559224 -0.6475991703 -0.061519277 6 -0.354559224
## 6 66 -0.297811317 -0.5908512632 -0.004771370 6 -0.297811317
## 7 47 -0.296991308 -0.5900312546 -0.003951361 6 -0.296991308
## 8 9 -0.232585931 -0.5256258777 0.060454016 6 -0.232585931
## 9 8 -0.194608839 -0.4876487855 0.098431108 6 -0.194608839
## 10 18 -0.191074147 -0.4841140933 0.101965800 6 -0.191074147
## 11 54 -0.156391724 -0.4494316708 0.136648222 6 -0.156391724
## 12 55 -0.146329600 -0.4393695467 0.146710347 6 -0.146329600
## 13 10 -0.134804554 -0.4278445004 0.158235393 6 -0.134804554
## 14 59 -0.122703841 -0.4157437872 0.170336106 6 -0.122703841
## 15 25 -0.096027384 -0.3890673308 0.197012563 6 -0.096027384
## 16 60 -0.074597921 -0.3676378675 0.218442026 6 -0.074597921
## 17 49 -0.074249543 -0.3672894898 0.218790404 6 -0.074249543
## 18 41 0.003183417 -0.2898565297 0.296223364 6 0.003183417
## 19 34 0.020954039 -0.2720859077 0.313993986 6 0.020954039
## 20 6 0.040258629 -0.2527813180 0.333298575 6 0.040258629
## 21 1 0.041126007 -0.2519139396 0.334165954 6 0.041126007
## 22 72 0.170404849 -0.1226350973 0.463444796 5 0.170404849
## 23 12 0.212969148 -0.0800707985 0.506009095 5 0.212969148
## 24 69 0.220693868 -0.0723460788 0.513733815 5 0.220693868
## 25 50 0.235255737 -0.0577842094 0.528295684 5 0.235255737
## 26 14 0.237116175 -0.0559237712 0.530156122 5 0.237116175
## 27 51 0.241427470 -0.0516124768 0.534467416 5 0.241427470
## 28 32 0.276036599 -0.0170033472 0.569076546 5 0.276036599
## 29 63 0.293245428 0.0002054817 0.586285375 5 0.293245428
## 30 35 0.340488757 0.0474488101 0.633528703 5 0.340488757
## 31 57 0.344569580 -0.0143295922 0.703468751 5 0.344569580
## 32 26 0.381696222 0.0886562757 0.674736169 5 0.381696222
## 33 33 0.415962941 0.1229229945 0.709002888 5 0.415962941
## 34 76 0.446950779 0.1539108319 0.739990725 5 0.446950779
## 35 11 0.468859088 0.1758191417 0.761899035 5 0.468859088
## 36 61 0.488365433 0.1953254865 0.781405380 5 0.488365433
## 37 38 0.501668766 0.2086288195 0.794708713 5 0.501668766
## 38 17 0.518037077 0.2249971306 0.811077024 5 0.518037077
## 39 70 0.518271623 0.2252316767 0.811311570 5 0.518271623
## 40 75 0.546513742 0.2534737955 0.839553689 5 0.546513742
## 41 56 0.570534844 0.2774948977 0.863574791 5 0.570534844
## 42 28 0.590551572 0.2975116254 0.883591519 5 0.590551572
## 43 65 0.620915303 0.3278753559 0.913955249 5 0.620915303
## 44 24 0.648409973 0.3553700259 0.941449919 5 0.648409973
## 45 7 0.755351293 0.4623113466 1.048391240 4 0.755351293
## 46 78 0.788820298 0.4957803515 1.081860245 4 0.788820298
## 47 45 0.870723313 0.5776833663 1.163763260 4 0.870723313
## 48 73 0.906404421 0.6133644739 1.199444367 4 0.906404421
## 49 46 0.932876402 0.6398364555 1.225916349 4 0.932876402
## 50 15 0.985219167 0.6921792199 1.278259113 4 0.985219167
## 51 27 1.002908235 0.7098682884 1.295948182 4 1.002908235
## 52 36 1.043338528 0.7502985811 1.336378474 4 1.043338528
## 53 44 1.060643436 0.7676034890 1.353683382 4 1.060643436
## 54 67 1.066645630 0.7736056834 1.359685577 4 1.066645630
## 55 4 1.089496550 0.7964566033 1.382536497 4 1.089496550
## 56 39 1.117869633 0.8248296867 1.410909580 4 1.117869633
## 57 2 1.118578003 0.8255380559 1.411617949 4 1.118578003
## 58 42 1.132645356 0.8396054098 1.425685303 4 1.132645356
## 59 68 1.137939138 0.8448991910 1.430979084 4 1.137939138
## 60 37 1.163428750 0.8703888031 1.456468696 4 1.163428750
## 61 43 1.209844848 0.9168049009 1.502884794 4 1.209844848
## 62 16 1.304061931 1.0110219841 1.597101877 3 1.304061931
## 63 52 1.345123870 1.0520839230 1.638163816 3 1.345123870
## 64 20 1.352250574 1.0592106278 1.645290521 3 1.352250574
## 65 74 1.367563215 1.0745232683 1.660603162 3 1.367563215
## 66 21 1.424693482 1.1316535352 1.717733429 3 1.424693482
## 67 5 1.458125209 1.1650852626 1.751165156 3 1.458125209
## 68 19 1.469229024 1.1761890772 1.762268970 3 1.469229024
## 69 30 1.495583208 1.2025432616 1.788623155 3 1.495583208
## 70 58 1.502935353 1.1440361810 1.861834525 3 1.502935353
## 71 71 1.557666432 1.2646264855 1.850706379 3 1.557666432
## 72 53 1.560935703 1.2678957566 1.853975650 3 1.560935703
## 73 13 1.587414601 1.2943746547 1.880454548 3 1.587414601
## 74 62 1.592566737 1.2995267906 1.885606684 3 1.592566737
## 75 40 1.613475230 1.3204352835 1.906515177 3 1.613475230
## 76 77 2.293933429 2.0008934825 2.586973376 2 2.293933429
## 77 3 2.712319742 2.4192797957 3.005359689 1 2.712319742
## 78 31 2.737243788 2.4442038412 3.030283735 1 2.737243788
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log CAROT",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

ativ: atividade antioxidante
## Anova preliminar.
m0 <- lm(ativ~acesso, da)
par(mfrow=c(2,2)); plot(m0, which=1:3);
MASS::boxcox(m0); abline(v=0, col=2)

layout(1)
## Variável com padrão de variância suspeito. Mistura de
## variâncias. Será que houve alteração no processo químico de
## determinação da ativ? Troca de reagente? Troca de laboritorista?
## Acessos de lugares diferetes?
## Anova com a variável transformada.
m0 <- update(m0, log(.)~.)
par(mfrow=c(2,2)); plot(m0); layout(1)

anova(m0)
## Analysis of Variance Table
##
## Response: log(ativ)
## Df Sum Sq Mean Sq F value Pr(>F)
## acesso 77 29.9787 0.38933 32.309 < 2.2e-16 ***
## Residuals 154 1.8558 0.01205
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pred <- meansci(m0)
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if ((lam < valchisq) | (ord1 == k)) {: the condition has
## length > 1 and only the first element will be used
## Warning in if (lam > valchisq) {: the condition has length > 1 and
## only the first element will be used
## Warning in if (lam < valchisq) {: the condition has length > 1 and
## only the first element will be used
pred
## acesso Estimate lwr upr cld m
## 1 51 -9.509063 -9.634265 -9.383860 8 -9.509063
## 2 54 -9.507255 -9.632458 -9.382053 8 -9.507255
## 3 24 -9.496240 -9.621442 -9.371037 8 -9.496240
## 4 23 -9.495215 -9.620418 -9.370013 8 -9.495215
## 5 28 -9.430316 -9.555518 -9.305113 8 -9.430316
## 6 26 -9.359310 -9.484513 -9.234108 7 -9.359310
## 7 55 -9.287351 -9.412553 -9.162148 7 -9.287351
## 8 52 -9.256069 -9.381271 -9.130866 7 -9.256069
## 9 70 -9.194484 -9.319687 -9.069281 7 -9.194484
## 10 58 -9.133672 -9.258875 -9.008469 6 -9.133672
## 11 43 -9.112116 -9.265458 -8.958775 6 -9.112116
## 12 8 -9.111328 -9.236531 -8.986125 6 -9.111328
## 13 21 -9.109546 -9.234748 -8.984343 6 -9.109546
## 14 57 -9.108091 -9.233293 -8.982888 6 -9.108091
## 15 63 -9.104798 -9.230000 -8.979595 6 -9.104798
## 16 29 -9.098386 -9.223589 -8.973183 6 -9.098386
## 17 50 -9.096392 -9.221595 -8.971189 6 -9.096392
## 18 59 -9.091844 -9.217046 -8.966641 6 -9.091844
## 19 48 -9.079523 -9.204726 -8.954320 6 -9.079523
## 20 38 -9.079051 -9.204254 -8.953849 6 -9.079051
## 21 9 -9.077708 -9.202910 -8.952505 6 -9.077708
## 22 19 -9.067087 -9.192290 -8.941884 6 -9.067087
## 23 37 -9.048728 -9.173931 -8.923525 6 -9.048728
## 24 17 -9.033390 -9.158592 -8.908187 6 -9.033390
## 25 39 -9.021124 -9.146327 -8.895922 6 -9.021124
## 26 42 -9.014264 -9.139467 -8.889062 6 -9.014264
## 27 22 -9.007841 -9.133044 -8.882638 6 -9.007841
## 28 27 -9.007543 -9.132745 -8.882340 6 -9.007543
## 29 25 -8.990965 -9.116168 -8.865763 6 -8.990965
## 30 36 -8.980348 -9.105550 -8.855145 6 -8.980348
## 31 2 -8.921243 -9.046445 -8.796040 5 -8.921243
## 32 76 -8.912688 -9.037891 -8.787485 5 -8.912688
## 33 41 -8.912256 -9.037459 -8.787053 5 -8.912256
## 34 4 -8.911484 -9.036686 -8.786281 5 -8.911484
## 35 35 -8.907762 -9.032965 -8.782560 5 -8.907762
## 36 68 -8.906876 -9.032079 -8.781674 5 -8.906876
## 37 67 -8.891079 -9.016281 -8.765876 5 -8.891079
## 38 71 -8.863160 -9.016502 -8.709819 5 -8.863160
## 39 34 -8.821981 -8.947184 -8.696779 5 -8.821981
## 40 47 -8.819322 -8.944525 -8.694119 5 -8.819322
## 41 64 -8.814215 -8.939417 -8.689012 5 -8.814215
## 42 65 -8.809455 -8.934658 -8.684252 5 -8.809455
## 43 33 -8.808169 -8.933371 -8.682966 5 -8.808169
## 44 56 -8.806124 -8.931326 -8.680921 5 -8.806124
## 45 6 -8.800716 -8.925919 -8.675513 5 -8.800716
## 46 1 -8.799293 -8.924496 -8.674091 5 -8.799293
## 47 72 -8.737628 -8.862831 -8.612426 4 -8.737628
## 48 69 -8.726888 -8.852091 -8.601686 4 -8.726888
## 49 31 -8.713409 -8.838611 -8.588206 4 -8.713409
## 50 10 -8.679212 -8.804415 -8.554009 4 -8.679212
## 51 15 -8.654634 -8.779837 -8.529432 4 -8.654634
## 52 11 -8.633320 -8.758523 -8.508117 4 -8.633320
## 53 61 -8.614116 -8.739319 -8.488913 4 -8.614116
## 54 66 -8.601629 -8.726831 -8.476426 4 -8.601629
## 55 18 -8.595538 -8.720741 -8.470335 4 -8.595538
## 56 77 -8.593557 -8.718759 -8.468354 4 -8.593557
## 57 7 -8.572949 -8.698151 -8.447746 4 -8.572949
## 58 20 -8.557514 -8.682716 -8.432311 4 -8.557514
## 59 74 -8.529616 -8.654818 -8.404413 3 -8.529616
## 60 78 -8.527638 -8.652841 -8.402436 3 -8.527638
## 61 45 -8.514191 -8.639393 -8.388988 3 -8.514191
## 62 14 -8.509531 -8.634733 -8.384328 3 -8.509531
## 63 62 -8.495564 -8.620766 -8.370361 3 -8.495564
## 64 46 -8.451886 -8.577089 -8.326684 3 -8.451886
## 65 32 -8.447995 -8.573198 -8.322792 3 -8.447995
## 66 44 -8.442573 -8.567775 -8.317370 3 -8.442573
## 67 60 -8.434811 -8.560013 -8.309608 3 -8.434811
## 68 75 -8.389427 -8.514630 -8.264224 3 -8.389427
## 69 13 -8.382669 -8.507872 -8.257467 3 -8.382669
## 70 12 -8.373094 -8.498297 -8.247891 3 -8.373094
## 71 30 -8.322769 -8.447972 -8.197567 2 -8.322769
## 72 49 -8.251240 -8.376442 -8.126037 2 -8.251240
## 73 16 -8.173186 -8.298388 -8.047983 1 -8.173186
## 74 73 -8.171348 -8.296551 -8.046146 1 -8.171348
## 75 5 -8.153648 -8.278851 -8.028446 1 -8.153648
## 76 53 -8.109375 -8.234577 -7.984172 1 -8.109375
## 77 3 -8.091369 -8.216572 -7.966166 1 -8.091369
## 78 40 -8.001909 -8.127112 -7.876706 1 -8.001909
## Gráfico.
p0 <- segplot(acesso~lwr+upr, data=pred,
centers=Estimate, draw=FALSE,
xlab="log ATIV",
ylab="Acesso ID",
pch=pred$cld)+
layer(panel.abline(h=1:nlevels(pred$acesso), col="gray70"),
under=TRUE)
p0

Análise de componentes principais
##----------------------------------------------------------------------
## Todas as variáveis foram transformadas por log para serem feitas as
## análises de variância, exceto ft e flav. As transformações serão
## mantidas na análise de componentes principais.
db <- da
i <- c(5, 8:12)
names(db)[i]
## [1] "aa" "anto" "cloroA" "cloroB" "carot" "ativ"
db[,i] <- sapply(db[,i], FUN=log)
head(db)
## acesso rept sst at aa ft flav anto cloroA
## 1 1 1 9.4 0.24 4.059235 85.20904 38.74 2.014903 -2.040221
## 2 1 2 9.5 0.23 4.074482 86.73446 39.69 1.944481 -1.771957
## 3 1 3 10.2 0.25 3.981922 86.33898 38.80 1.969906 -1.427116
## 4 2 1 12.4 0.23 4.452951 125.88701 69.70 2.448416 -2.525729
## 5 2 2 11.5 0.24 4.288265 130.63277 67.86 2.452728 -2.207275
## 6 2 3 11.5 0.27 4.504355 129.16384 69.46 2.448416 -2.659260
## cloroB carot ativ
## 1 -1.560648 -0.09431068 -8.800076
## 2 -1.237874 0.10436002 -8.802407
## 3 -1.171183 0.11332869 -8.795397
## 4 -1.386294 0.43178242 -8.736237
## 5 -1.347074 1.57069708 -9.007934
## 6 -1.832581 1.35325451 -9.019556
## Médias dos acessos em cada uma das variáveis.
dc <- ddply(db, .(acesso), .fun=colwise(.fun=mean, na.rm=TRUE))
str(dc)
## 'data.frame': 78 obs. of 12 variables:
## $ acesso: Factor w/ 78 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ rept : num 2 2 2 2 2 2 2 2 2 2 ...
## $ sst : num 9.7 11.8 14.4 12.6 12 ...
## $ at : num 0.24 0.247 0.333 0.247 0.407 ...
## $ aa : num 4.04 4.42 4.62 4.22 5.3 ...
## $ ft : num 86.1 128.6 167.4 99.5 165.2 ...
## $ flav : num 39.1 69 192.3 52.9 133.9 ...
## $ anto : num 1.98 2.45 2.88 1.99 2.05 ...
## $ cloroA: num -1.75 -2.46 -1.89 -2.76 -2.31 ...
## $ cloroB: num -1.32 -1.52 -0.86 -1.85 -1.31 ...
## $ carot : num 0.0411 1.1186 2.7123 1.0895 1.4581 ...
## $ ativ : num -8.8 -8.92 -8.09 -8.91 -8.15 ...
##----------------------------------------------------------------------
## A variável sst não será considerada na análise multivariada.
## X <- as.matrix(subset(dc, select=-c(acesso, rept, ativ)))
X <- as.matrix(subset(dc, select=-c(acesso, rept, sst)))
rownames(X) <- as.character(dc$acesso)
X <- na.omit(X)
str(X)
## num [1:77, 1:9] 0.24 0.247 0.333 0.247 0.407 ...
## - attr(*, "dimnames")=List of 2
## ..$ : chr [1:77] "1" "2" "3" "4" ...
## ..$ : chr [1:9] "at" "aa" "ft" "flav" ...
## - attr(*, "na.action")=Class 'omit' Named num 41
## .. ..- attr(*, "names")= chr "41"
## pc <- princomp(x=X)
pca <- princomp(x=X, cor=TRUE, scores=TRUE)
summary(pca, loadings=TRUE, cutoff=0)
## Importance of components:
## Comp.1 Comp.2 Comp.3 Comp.4
## Standard deviation 2.0620655 1.1707242 1.0728889 0.9241363
## Proportion of Variance 0.4724571 0.1522884 0.1278989 0.0948920
## Cumulative Proportion 0.4724571 0.6247455 0.7526444 0.8475364
## Comp.5 Comp.6 Comp.7 Comp.8
## Standard deviation 0.67865972 0.58140154 0.52004468 0.49469704
## Proportion of Variance 0.05117545 0.03755864 0.03004961 0.02719168
## Cumulative Proportion 0.89871187 0.93627051 0.96632012 0.99351180
## Comp.9
## Standard deviation 0.241648036
## Proportion of Variance 0.006488197
## Cumulative Proportion 1.000000000
##
## Loadings:
## Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7 Comp.8 Comp.9
## at -0.316 0.122 0.203 0.659 -0.028 0.616 0.164 -0.031 0.044
## aa -0.175 -0.339 0.538 -0.607 -0.056 0.408 0.154 0.058 0.012
## ft -0.379 -0.171 0.216 0.125 -0.611 -0.413 -0.031 -0.464 0.068
## flav -0.388 -0.224 -0.279 0.000 -0.284 0.102 -0.539 0.577 -0.082
## anto -0.325 -0.207 -0.510 -0.186 0.308 0.272 -0.150 -0.597 -0.096
## cloroA -0.331 0.561 0.080 -0.232 0.144 -0.040 -0.227 -0.005 0.664
## cloroB -0.350 0.533 0.164 -0.152 0.085 -0.122 0.004 0.016 -0.722
## carot -0.388 -0.050 -0.379 -0.087 -0.021 -0.169 0.757 0.281 0.120
## ativ -0.295 -0.382 0.328 0.251 0.647 -0.393 -0.099 0.111 0.027
##----------------------------------------------------------------------
## Variâncias.
## Variância de cada componente.
screeplot(pca, type="lines", main=NULL)

## Proporção de variância acumulada.
## str(pca)
plot(cumsum(pca$sdev^2)/sum(pca$sdev^2), type="o",
xlab="Componente", ylab="Proporção de variância acumulada")
abline(h=0.8, lty=2)

##----------------------------------------------------------------------
## Gráficos biplot.
biplot(pca, choices=c(1,2))

biplot(pca, choices=c(1,3))

biplot(pca, choices=c(2,3))

##----------------------------------------------------------------------
## Carregamentos.
## A fração dos carregamentos mais importantes.
imp <- function(x, f=0.25){
a <- abs(x)
k <- ceiling(f*length(x))
i <- sort(a, decreasing=TRUE)[k]
x[a<=i] <- NA
return(x)
}
apply(pca$loadings[,1:4], MARGIN=2, FUN=imp, f=0.4)
## Comp.1 Comp.2 Comp.3 Comp.4
## at NA NA NA 0.6585510
## aa NA NA 0.5382593 -0.6069466
## ft -0.3787414 NA NA NA
## flav -0.3879656 NA NA NA
## anto NA NA -0.5096948 NA
## cloroA NA 0.5613416 NA NA
## cloroB NA 0.5327776 NA NA
## carot -0.3879338 NA -0.3787054 NA
## ativ NA -0.3823485 NA 0.2512098
UPGMA
##----------------------------------------------------------------------
## Matriz de covariância residual.
## db <- da
##
## i <- c(5, 8:12)
## names(db)[i]
##
## db[,i] <- sapply(db[,i], FUN=log)
## head(db)
##
## ## Médias dos acessos em cada uma das variáveis.
##
## dc <- ddply(db, .(acesso), .fun=colwise(.fun=mean, na.rm=TRUE))
## str(dc)
##----------------------------------------------------------------------
Y <- as.matrix(subset(db, select=-c(acesso, rept, sst)))
## Y <- na.omit(Y)
str(Y)
## num [1:234, 1:9] 0.24 0.23 0.25 0.23 0.24 0.27 0.3 0.33 0.37 0.24 ...
## - attr(*, "dimnames")=List of 2
## ..$ : chr [1:234] "1" "2" "3" "4" ...
## ..$ : chr [1:9] "at" "aa" "ft" "flav" ...
m0 <- aov(Y~acesso, data=db)
## Matriz de covariância resídual.
psi <- var(residuals(m0))
dim(psi)
## [1] 9 9
dim(X)
## [1] 77 9
## Distância entre genótipos.
d <- mahalanobis(x=X, center=colMeans(X), cov=psi)
dim(d)
## NULL
## Essa distância não é pairwise. Esta retorna a distância de cada um
## para com o centroide geral. Precisa-se da distância entre cada
## indivíduo para com o outro.
##----------------------------------------------------------------------
## method=
## "euclidean"
## "maximum"
## "manhattan"
## "canberra"
## "binary"
## "minkowski"
## Essa distância euclidiana apenas será usada para passar de herança os
## atributos para o objeto com distâncias de Mahalanobis.
D <- dist(scale(X), method="euclidean")
str(D)
## Class 'dist' atomic [1:2926] 2.61 6.49 2.5 5.56 3.73 ...
## ..- attr(*, "Size")= int 77
## ..- attr(*, "Labels")= chr [1:77] "1" "2" "3" "4" ...
## ..- attr(*, "Diag")= logi FALSE
## ..- attr(*, "Upper")= logi FALSE
## ..- attr(*, "method")= chr "euclidean"
## ..- attr(*, "call")= language dist(x = scale(X), method = "euclidean")
d <- matrix(NA, nrow=nrow(X), ncol=nrow(X))
n <- nrow(X)
for (i in 2:n){
for (j in 1:(i-1)){
d[i,j] <-
mahalanobis(x=X[i,], center=X[j,], cov=psi)
}
}
## diag(d) <- 0
## d[upper.tri(d)] <- t(d)[upper.tri(d)]
## d[1:4, 1:4]
## Herda atributos e classe do objeto anterior para que a função
## hclust() trabalhe normalmente.
d <- d[lower.tri(d)]
class(d) <- "dist"
attributes(d) <- attributes(D)
str(d)
## Class 'dist' atomic [1:2926] 235.2 2574.2 83.1 1277.8 88.8 ...
## ..- attr(*, "Size")= int 77
## ..- attr(*, "Labels")= chr [1:77] "1" "2" "3" "4" ...
## ..- attr(*, "Diag")= logi FALSE
## ..- attr(*, "Upper")= logi FALSE
## ..- attr(*, "method")= chr "euclidean"
## ..- attr(*, "call")= language dist(x = scale(X), method = "euclidean")
write.table(x=as.matrix(d), file="distMahala.csv",
sep=";", row.names=FALSE, col.names=FALSE)
## method=
## "ward.D"
## "ward.D2"
## "single"
## "complete"
## "average" (= UPGMA)
## "mcquitty" (= WPGMA)
## "median" (= WPGMC)
## "centroid" (= UPGMC)
h <- hclust(d, method="average")
## plot(h, hang=-1)
plot(h)

## Coeficiente de correlação cofenético.
cph <- cophenetic(h)
cor(d, cph)
## [1] 0.6711827
##----------------------------------------------------------------------
## Corte no dendograma. Escolhe o corte (número de grupos) que maximiza
## o valor da estatística F da Manova (Pillai).
dc <- droplevels(na.omit(db))
Y <- as.matrix(subset(dc, select=-c(acesso, rept, sst)))
m0 <- manova(Y~acesso, data=dc)
summary(m0)
## Df Pillai approx F num Df den Df Pr(>F)
## acesso 76 7.802 12.854 684 1350 < 2.2e-16 ***
## Residuals 150
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Grupos de 2 à 20.
k <- 2:20
aF <- sapply(k,
FUN=function(k){
g <- cutree(h, k=k)
## m0 <- aov(X~g)
levels(dc$acesso) <- g
m0 <- manova(Y~acesso, data=dc)
sm0 <- summary.manova(m0)
approxF <- sm0$stats[1, 3]
return(approxF)
})
plot(aF~k, type="o")

## plot(log(aF)~k, type="o")
plot(h)
rect.hclust(h, 2)

g <- cutree(h, k=2)
table(g)
## g
## 1 2
## 61 16
split(as.integer(names(g)), g)
## $`1`
## [1] 1 2 4 6 7 8 9 10 11 12 14 15 17 18 19 20 21 22 23 24 25 26
## [23] 27 28 29 32 33 34 35 36 37 38 39 42 44 45 46 47 48 49 50 51 52 54
## [45] 55 56 57 58 59 60 61 62 63 64 65 66 68 70 71 73 78
##
## $`2`
## [1] 3 5 13 16 30 31 40 43 53 67 69 72 74 75 76 77