library(readxl)
library(outliers)
datos = read_excel("//cloud//project//pesosecopa.xlsx", sheet = 1)
tratamiento<- as.factor(datos$tratamiento)
bloque<- as.factor(datos$bloque)
sujeto<- as.factor(datos$sujeto)
dca1<-aov(datos$pesoseco~tratamiento+bloque+Error(sujeto)) 
dca1
## 
## Call:
## aov(formula = datos$pesoseco ~ tratamiento + bloque + Error(sujeto))
## 
## Grand Mean: 0.33425
## 
## Stratum 1: sujeto
## 
## Terms:
##                 tratamiento    bloque Residuals
## Sum of Squares    0.0858515 0.0268960 0.0238415
## Deg. of Freedom           3         1         3
## 
## Residual standard error: 0.08914688
## Estimated effects may be unbalanced
## 
## Stratum 2: Within
## 
## Terms:
##                 Residuals
## Sum of Squares   0.037516
## Deg. of Freedom         8
## 
## Residual standard error: 0.06847992
summary(dca1)
## 
## Error: sujeto
##             Df  Sum Sq  Mean Sq F value Pr(>F)
## tratamiento  3 0.08585 0.028617   3.601  0.160
## bloque       1 0.02690 0.026896   3.384  0.163
## Residuals    3 0.02384 0.007947               
## 
## Error: Within
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  8 0.03752 0.00469
x <-dca1$sujeto$residuals  
y <-dca1$Within$residuals

sc.error.a <-sum(x^2)       #SUMA DE CUADRADOS DEL ERROR EXPERIMENTAL
sc.error.b <-sum(y^2)       #SUMA DE CUADRADOS DEL ERROR MUESTRAL

format(x, big.mark = ",")
##             2             3             4             5             6 
## "-0.04400000" "-0.07707626" " 0.10900229" " 0.03225523" "-0.03950443" 
##             7             8 
## " 0.02520417" "-0.02910326"
dca2<-aov(datos$pesoseco~tratamiento+bloque+sujeto%in%bloque%in%tratamiento)
summary(dca2)
##                           Df  Sum Sq  Mean Sq F value Pr(>F)  
## tratamiento                3 0.08585 0.028617   6.102 0.0183 *
## bloque                     1 0.02690 0.026896   5.735 0.0435 *
## tratamiento:bloque:sujeto  3 0.02384 0.007947   1.695 0.2447  
## Residuals                  8 0.03752 0.004690                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod1 = aov(datos$pesoseco ~ tratamiento*bloque, datos)
sum1<-summary(mod1)
sum1 <- unlist(sum1)
sum1 = sum1[9]
summary(mod1)
##                    Df  Sum Sq  Mean Sq F value Pr(>F)  
## tratamiento         3 0.08585 0.028617   6.102 0.0183 *
## bloque              1 0.02690 0.026896   5.735 0.0435 *
## tratamiento:bloque  3 0.02384 0.007947   1.695 0.2447  
## Residuals           8 0.03752 0.004690                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod1, "tratamiento")
## Warning in replications(paste("~", xx), data = mf): non-factors ignored: bloque
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## tratamiento, bloque
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = datos$pesoseco ~ tratamiento * bloque, data = datos)
## 
## $tratamiento
##           diff        lwr         upr     p adj
## T2-T1 -0.14575 -0.3008163  0.00931627 0.0655851
## T3-T1 -0.15900 -0.3140663 -0.00393373 0.0446064
## T4-T1 -0.19025 -0.3453163 -0.03518373 0.0183232
## T3-T2 -0.01325 -0.1683163  0.14181627 0.9922768
## T4-T2 -0.04450 -0.1995663  0.11056627 0.7958844
## T4-T3 -0.03125 -0.1863163  0.12381627 0.9142578
library(agricolae)
duncan.test(mod1, 'tratamiento', console = T)
## 
## Study: mod1 ~ "tratamiento"
## 
## Duncan's new multiple range test
## for datos$pesoseco 
## 
## Mean Square Error:  0.0046895 
## 
## tratamiento,  means
## 
##    datos.pesoseco        std r         se   Min   Max     Q25    Q50     Q75
## T1        0.45800 0.05021288 4 0.03423996 0.397 0.513 0.43000 0.4610 0.48900
## T2        0.31225 0.13477729 4 0.03423996 0.187 0.481 0.21325 0.2905 0.38950
## T3        0.29900 0.08610459 4 0.03423996 0.193 0.374 0.24700 0.3145 0.36650
## T4        0.26775 0.03629853 4 0.03423996 0.214 0.292 0.26200 0.2825 0.28825
## 
## Alpha: 0.05 ; DF Error: 8 
## 
## Critical Range
##         2         3         4 
## 0.1116628 0.1163631 0.1189904 
## 
## Means with the same letter are not significantly different.
## 
##    datos$pesoseco groups
## T1        0.45800      a
## T2        0.31225      b
## T3        0.29900      b
## T4        0.26775      b

Muestreo 2

library(readxl)
library(outliers)
datos = read_excel("//cloud//project//pesoseco2.xlsx", sheet = 1)
tratamiento<- as.factor(datos$tratamiento)
bloque<- as.factor(datos$bloque)
sujeto<- as.factor(datos$sujeto)
dca2<-aov(datos$pesoseco2~tratamiento+bloque+Error(sujeto)) 
dca2
## 
## Call:
## aov(formula = datos$pesoseco2 ~ tratamiento + bloque + Error(sujeto))
## 
## Grand Mean: 0.3759375
## 
## Stratum 1: sujeto
## 
## Terms:
##                 tratamiento     bloque  Residuals
## Sum of Squares   0.26381069 0.00841806 0.01402869
## Deg. of Freedom           3          1          3
## 
## Residual standard error: 0.06838296
## Estimated effects may be unbalanced
## 
## Stratum 2: Within
## 
## Terms:
##                 Residuals
## Sum of Squares  0.0889495
## Deg. of Freedom         8
## 
## Residual standard error: 0.1054452
summary(dca2)
## 
## Error: sujeto
##             Df  Sum Sq Mean Sq F value Pr(>F)  
## tratamiento  3 0.26381 0.08794    18.8  0.019 *
## bloque       1 0.00842 0.00842     1.8  0.272  
## Residuals    3 0.01403 0.00468                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  8 0.08895 0.01112
x <-dca2$sujeto$residuals  
y <-dca2$Within$residuals

sc.error.a <-sum(x^2)       #SUMA DE CUADRADOS DEL ERROR EXPERIMENTAL
sc.error.b <-sum(y^2)       #SUMA DE CUADRADOS DEL ERROR MUESTRAL

format(x, big.mark = ",")
##             2             3             4             5             6 
## "-0.03962500" "-0.01926907" " 0.02725057" " 0.04561586" "-0.05586778" 
##             7             8 
## "-0.05130848" " 0.05924593"
dca3<-aov(datos$pesoseco2~tratamiento+bloque+sujeto%in%bloque%in%tratamiento)
summary(dca3)
##                           Df  Sum Sq Mean Sq F value  Pr(>F)   
## tratamiento                3 0.26381 0.08794   7.909 0.00889 **
## bloque                     1 0.00842 0.00842   0.757 0.40958   
## tratamiento:bloque:sujeto  3 0.01403 0.00468   0.421 0.74335   
## Residuals                  8 0.08895 0.01112                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod2 = aov(datos$pesoseco2 ~ tratamiento*bloque, datos)
sum2<-summary(mod2)
sum2 <- unlist(sum2)
sum2 = sum2[9]
summary(mod2)
##                    Df  Sum Sq Mean Sq F value  Pr(>F)   
## tratamiento         3 0.26381 0.08794   7.909 0.00889 **
## bloque              1 0.00842 0.00842   0.757 0.40958   
## tratamiento:bloque  3 0.01403 0.00468   0.421 0.74335   
## Residuals           8 0.08895 0.01112                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod2, "tratamiento")
## Warning in replications(paste("~", xx), data = mf): non-factors ignored: bloque
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## tratamiento, bloque
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = datos$pesoseco2 ~ tratamiento * bloque, data = datos)
## 
## $tratamiento
##           diff         lwr         upr     p adj
## T2-T1 -0.34950 -0.58827059 -0.11072941 0.0068112
## T3-T1 -0.20975 -0.44852059  0.02902059 0.0866085
## T4-T1 -0.26000 -0.49877059 -0.02122941 0.0335708
## T3-T2  0.13975 -0.09902059  0.37852059 0.3098582
## T4-T2  0.08950 -0.14927059  0.32827059 0.6434344
## T4-T3 -0.05025 -0.28902059  0.18852059 0.9040651
library(agricolae)
duncan.test(mod2, 'tratamiento', console = T)
## 
## Study: mod2 ~ "tratamiento"
## 
## Duncan's new multiple range test
## for datos$pesoseco2 
## 
## Mean Square Error:  0.01111869 
## 
## tratamiento,  means
## 
##    datos.pesoseco2        std r         se   Min   Max     Q25    Q50     Q75
## T1         0.58075 0.14502730 4 0.05272259 0.456 0.769 0.47250 0.5490 0.65725
## T2         0.23125 0.03119161 4 0.05272259 0.190 0.260 0.21625 0.2375 0.25250
## T3         0.37100 0.10601887 4 0.05272259 0.249 0.507 0.32700 0.3640 0.40800
## T4         0.32075 0.06233979 4 0.05272259 0.270 0.404 0.27450 0.3045 0.35075
## 
## Alpha: 0.05 ; DF Error: 8 
## 
## Critical Range
##         2         3         4 
## 0.1719380 0.1791756 0.1832211 
## 
## Means with the same letter are not significantly different.
## 
##    datos$pesoseco2 groups
## T1         0.58075      a
## T3         0.37100      b
## T4         0.32075      b
## T2         0.23125      b

MUESTREO 3

library(readxl)
library(outliers)
datos = read_excel("//cloud//project//pesoseco3.xlsx", sheet = 1)
tratamiento<- as.factor(datos$tratamiento)
bloque<- as.factor(datos$bloque)
sujeto<- as.factor(datos$sujeto)
dca3<-aov(datos$pesoseco3~tratamiento+bloque+Error(sujeto)) 
dca3
## 
## Call:
## aov(formula = datos$pesoseco3 ~ tratamiento + bloque + Error(sujeto))
## 
## Grand Mean: 0.606625
## 
## Stratum 1: sujeto
## 
## Terms:
##                 tratamiento    bloque Residuals
## Sum of Squares    0.5902652 0.0088360 0.0349205
## Deg. of Freedom           3         1         3
## 
## Residual standard error: 0.1078896
## Estimated effects may be unbalanced
## 
## Stratum 2: Within
## 
## Terms:
##                 Residuals
## Sum of Squares   0.115494
## Deg. of Freedom         8
## 
## Residual standard error: 0.120153
summary(dca3)
## 
## Error: sujeto
##             Df Sum Sq Mean Sq F value Pr(>F)  
## tratamiento  3 0.5903 0.19676  16.903  0.022 *
## bloque       1 0.0088 0.00884   0.759  0.448  
## Residuals    3 0.0349 0.01164                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  8 0.1155 0.01444
x <-dca3$sujeto$residuals  
y <-dca3$Within$residuals

sc.error.a <-sum(x^2)       #SUMA DE CUADRADOS DEL ERROR EXPERIMENTAL
sc.error.b <-sum(y^2)       #SUMA DE CUADRADOS DEL ERROR MUESTRAL

format(x, big.mark = ",")
##             2             3             4             5             6 
## " 0.00450000" " 0.01645448" "-0.02327015" "-0.08980869" " 0.10999273" 
##             7             8 
## " 0.07724913" "-0.08919962"
dca4<-aov(datos$pesoseco3~tratamiento+bloque+sujeto%in%bloque%in%tratamiento)
summary(dca4)
##                           Df Sum Sq Mean Sq F value  Pr(>F)   
## tratamiento                3 0.5903 0.19676  13.629 0.00165 **
## bloque                     1 0.0088 0.00884   0.612 0.45655   
## tratamiento:bloque:sujeto  3 0.0349 0.01164   0.806 0.52486   
## Residuals                  8 0.1155 0.01444                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod3 = aov(datos$pesoseco3 ~ tratamiento*bloque, datos)
sum3<-summary(mod3)
sum3 <- unlist(sum3)
sum3 = sum3[9]
summary(mod3)
##                    Df Sum Sq Mean Sq F value  Pr(>F)   
## tratamiento         3 0.5903 0.19676  13.629 0.00165 **
## bloque              1 0.0088 0.00884   0.612 0.45655   
## tratamiento:bloque  3 0.0349 0.01164   0.806 0.52486   
## Residuals           8 0.1155 0.01444                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod3, "tratamiento")
## Warning in replications(paste("~", xx), data = mf): non-factors ignored: bloque
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## tratamiento, bloque
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = datos$pesoseco3 ~ tratamiento * bloque, data = datos)
## 
## $tratamiento
##           diff         lwr         upr     p adj
## T2-T1 -0.50450 -0.77657509 -0.23242491 0.0015569
## T3-T1 -0.31325 -0.58532509 -0.04117491 0.0254694
## T4-T1 -0.42675 -0.69882509 -0.15467491 0.0044974
## T3-T2  0.19125 -0.08082509  0.46332509 0.1892851
## T4-T2  0.07775 -0.19432509  0.34982509 0.7978312
## T4-T3 -0.11350 -0.38557509  0.15857509 0.5678663
library(agricolae)
duncan.test(mod3, 'tratamiento', console = T)
## 
## Study: mod3 ~ "tratamiento"
## 
## Duncan's new multiple range test
## for datos$pesoseco3 
## 
## Mean Square Error:  0.01443675 
## 
## tratamiento,  means
## 
##    datos.pesoseco3        std r         se   Min   Max     Q25    Q50     Q75
## T1         0.91775 0.14409112 4 0.06007651 0.781 1.069 0.80200 0.9105 1.02625
## T2         0.41325 0.08551949 4 0.06007651 0.361 0.541 0.36850 0.3755 0.42025
## T3         0.60450 0.11061193 4 0.06007651 0.489 0.748 0.53925 0.5905 0.65575
## T4         0.49100 0.11301622 4 0.06007651 0.368 0.636 0.42875 0.4800 0.54225
## 
## Alpha: 0.05 ; DF Error: 8 
## 
## Critical Range
##         2         3         4 
## 0.1959205 0.2041676 0.2087773 
## 
## Means with the same letter are not significantly different.
## 
##    datos$pesoseco3 groups
## T1         0.91775      a
## T3         0.60450      b
## T4         0.49100      b
## T2         0.41325      b

MUESTREO4

library(readxl)
library(outliers)
datos = read_excel("//cloud//project//pesoseco4.xlsx", sheet = 1)
tratamiento<- as.factor(datos$tratamiento)
bloque<- as.factor(datos$bloque)
sujeto<- as.factor(datos$sujeto)
dca4<-aov(datos$pesoseco4~tratamiento+bloque+Error(sujeto)) 
dca4
## 
## Call:
## aov(formula = datos$pesoseco4 ~ tratamiento + bloque + Error(sujeto))
## 
## Grand Mean: 0.6469375
## 
## Stratum 1: sujeto
## 
## Terms:
##                 tratamiento    bloque Residuals
## Sum of Squares    0.7908832 0.0425391 0.1395052
## Deg. of Freedom           3         1         3
## 
## Residual standard error: 0.2156426
## Estimated effects may be unbalanced
## 
## Stratum 2: Within
## 
## Terms:
##                 Residuals
## Sum of Squares  0.3437115
## Deg. of Freedom         8
## 
## Residual standard error: 0.2072774
summary(dca4)
## 
## Error: sujeto
##             Df Sum Sq Mean Sq F value Pr(>F)  
## tratamiento  3 0.7909 0.26363   5.669  0.094 .
## bloque       1 0.0425 0.04254   0.915  0.409  
## Residuals    3 0.1395 0.04650                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  8 0.3437 0.04296
x <-dca4$sujeto$residuals  
y <-dca4$Within$residuals

sc.error.a <-sum(x^2)       #SUMA DE CUADRADOS DEL ERROR EXPERIMENTAL
sc.error.b <-sum(y^2)       #SUMA DE CUADRADOS DEL ERROR MUESTRAL

format(x, big.mark = ",")
##             2             3             4             5             6 
## "-0.31937500" "-0.07570505" " 0.10706311" "-0.03676148" " 0.04502343" 
##             7             8 
## "-0.08518681" " 0.09836525"
dca5<-aov(datos$pesoseco4~tratamiento+bloque+sujeto%in%bloque%in%tratamiento)
summary(dca5)
##                           Df Sum Sq Mean Sq F value Pr(>F)  
## tratamiento                3 0.7909 0.26363   6.136  0.018 *
## bloque                     1 0.0425 0.04254   0.990  0.349  
## tratamiento:bloque:sujeto  3 0.1395 0.04650   1.082  0.410  
## Residuals                  8 0.3437 0.04296                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod4 = aov(datos$pesoseco4 ~ tratamiento*bloque, datos)
sum4<-summary(mod4)
sum3 <- unlist(sum4)
sum4 = sum4[9]
summary(mod4)
##                    Df Sum Sq Mean Sq F value Pr(>F)  
## tratamiento         3 0.7909 0.26363   6.136  0.018 *
## bloque              1 0.0425 0.04254   0.990  0.349  
## tratamiento:bloque  3 0.1395 0.04650   1.082  0.410  
## Residuals           8 0.3437 0.04296                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod4, "tratamiento")
## Warning in replications(paste("~", xx), data = mf): non-factors ignored: bloque
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## tratamiento, bloque
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = datos$pesoseco4 ~ tratamiento * bloque, data = datos)
## 
## $tratamiento
##           diff      lwr         upr     p adj
## T2-T1 -0.56075 -1.03011 -0.09138996 0.0210671
## T3-T1 -0.32475 -0.79411  0.14461004 0.1985392
## T4-T1 -0.52375 -0.99311 -0.05438996 0.0297826
## T3-T2  0.23600 -0.23336  0.70536004 0.4250043
## T4-T2  0.03700 -0.43236  0.50636004 0.9939012
## T4-T3 -0.19900 -0.66836  0.27036004 0.5558746
library(agricolae)
duncan.test(mod4, 'tratamiento', console = T)
## 
## Study: mod4 ~ "tratamiento"
## 
## Duncan's new multiple range test
## for datos$pesoseco4 
## 
## Mean Square Error:  0.04296394 
## 
## tratamiento,  means
## 
##    datos.pesoseco4        std r        se   Min   Max     Q25    Q50     Q75
## T1         0.99925 0.38519378 4 0.1036387 0.424 1.239 0.97000 1.1670 1.19625
## T2         0.43850 0.06452131 4 0.1036387 0.376 0.529 0.41200 0.4245 0.45100
## T3         0.67450 0.13079883 4 0.1036387 0.543 0.810 0.57375 0.6725 0.77325
## T4         0.47550 0.07487545 4 0.1036387 0.406 0.572 0.42250 0.4620 0.51500
## 
## Alpha: 0.05 ; DF Error: 8 
## 
## Critical Range
##         2         3         4 
## 0.3379848 0.3522120 0.3601643 
## 
## Means with the same letter are not significantly different.
## 
##    datos$pesoseco4 groups
## T1         0.99925      a
## T3         0.67450     ab
## T4         0.47550      b
## T2         0.43850      b