#LIBRERIAS
library(agricolae)
## Warning: package 'agricolae' was built under R version 4.4.1
library(collapsibleTree)
library(dplyr)
## 
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(lattice)
library(readxl)
FisioPro <- read_excel("C:/Users/Brandon S/Downloads/FisioPro.xlsx", 
    sheet = "15 Días", col_types = c("text", 
        "text", "text", "numeric", "numeric", 
        "numeric", "numeric", "numeric"))
View(FisioPro)

FisioPro
## # A tibble: 210 × 8
##    muestreo trat  rep   hojas flores  clor  area  diam
##    <chr>    <chr> <chr> <dbl>  <dbl> <dbl> <dbl> <dbl>
##  1 1        1     1      16.5    1    69.8 110.      0
##  2 1        1     2      21.5    4.5  76.7 108.      0
##  3 1        1     3      15      4.5  50.1  84.1     0
##  4 1        1     4      20.5    9.5  53.4 111.      0
##  5 1        1     5      11.5    4.5  51.0  79.7     0
##  6 1        1     6      16.5    5    53.6  83.3     0
##  7 1        2     1      18.5   10    65.2  90.8     0
##  8 1        2     2      14      4.5  60.6  95.1     0
##  9 1        2     3      11      5    79.8 148.      0
## 10 1        2     4      10.5    6.5  84.2 139.      0
## # ℹ 200 more rows
#MUESTREOS CON DATOS DE ARANDANOS "DÍA 15" EXCEL.
M1 = FisioPro[1:42,]; M1
## # A tibble: 42 × 8
##    muestreo trat  rep   hojas flores  clor  area  diam
##    <chr>    <chr> <chr> <dbl>  <dbl> <dbl> <dbl> <dbl>
##  1 1        1     1      16.5    1    69.8 110.      0
##  2 1        1     2      21.5    4.5  76.7 108.      0
##  3 1        1     3      15      4.5  50.1  84.1     0
##  4 1        1     4      20.5    9.5  53.4 111.      0
##  5 1        1     5      11.5    4.5  51.0  79.7     0
##  6 1        1     6      16.5    5    53.6  83.3     0
##  7 1        2     1      18.5   10    65.2  90.8     0
##  8 1        2     2      14      4.5  60.6  95.1     0
##  9 1        2     3      11      5    79.8 148.      0
## 10 1        2     4      10.5    6.5  84.2 139.      0
## # ℹ 32 more rows
M2 = FisioPro[43:84,]; M2
## # A tibble: 42 × 8
##    muestreo trat  rep   hojas flores  clor  area  diam
##    <chr>    <chr> <chr> <dbl>  <dbl> <dbl> <dbl> <dbl>
##  1 2        1     1      17.6    1.5  35.8 132.      0
##  2 2        1     2      20.5   10    55.9 157.      0
##  3 2        1     3      19      5    42.6  38.3     0
##  4 2        1     4      20.5    9    35.4 139       0
##  5 2        1     5      11.5    4.5  47.2  32.1     0
##  6 2        1     6      16.5    4    54.2  78.0     0
##  7 2        2     1      23     14.5  40.1  62.8     0
##  8 2        2     2      13.5    9    42.8  54.2     0
##  9 2        2     3      12.5    6.5  29.5 237.      0
## 10 2        2     4      10.5    5.5  56   261.      0
## # ℹ 32 more rows
M3 = FisioPro[85:126,]; M3
## # A tibble: 42 × 8
##    muestreo trat  rep   hojas flores  clor  area  diam
##    <chr>    <chr> <chr> <dbl>  <dbl> <dbl> <dbl> <dbl>
##  1 3        1     1      17      9    47.1 112.    7.8
##  2 3        1     2      19.5   12.5  60.8 163.    0  
##  3 3        1     3      20     10.5  50.2  86.4  10  
##  4 3        1     4      21.5    9    43.4 113.    0  
##  5 3        1     5      11.5    4.5  42.1  56.6   0  
##  6 3        1     6      17      9    54.6  84.4   0  
##  7 3        2     1      28     18.5  40.6  80.4   9.5
##  8 3        2     2      14      7.5  51.2  81.7   0  
##  9 3        2     3      14      6.5  32.6 164.    7  
## 10 3        2     4      10.5    7    59.6 178.    0  
## # ℹ 32 more rows
# M4 = FisioPro[1:42,]; M4 #NO SE ENCEUNTRAN EN EL EXCEL#
M5 = FisioPro[127:168,]; M5
## # A tibble: 42 × 8
##    muestreo trat  rep   hojas flores  clor  area  diam
##    <chr>    <chr> <chr> <dbl>  <dbl> <dbl> <dbl> <dbl>
##  1 5        1     1      17      1    57.8  92.9    NA
##  2 5        1     2      21.5   13    50.1 168.     NA
##  3 5        1     3      22.5    4.5  49.8 135.     NA
##  4 5        1     4      23      9    41.3  86.8    NA
##  5 5        1     5      15.5    4    53.4  81.1    NA
##  6 5        1     6      18      6    57.2  90.8    NA
##  7 5        2     1      28.5   10.5  40.4  97.9    NA
##  8 5        2     2      16      5    62.8 109.     NA
##  9 5        2     3      15      5.5  44    91.2    NA
## 10 5        2     4       6.5    6.5  61.8  94.9    NA
## # ℹ 32 more rows
# M6 = FisioPro[1:42,]; M6 #NO SE ENCEUNTRAN EN EL EXCEL#
M7 = FisioPro[169:210,]; M7
## # A tibble: 42 × 8
##    muestreo trat  rep   hojas flores  clor  area  diam
##    <chr>    <chr> <chr> <dbl>  <dbl> <dbl> <dbl> <dbl>
##  1 7        1     1      16.5    4.5  53.1  22.6    NA
##  2 7        1     2      19.5   12    55.9  27.1    NA
##  3 7        1     3      18.5    8    50.3  10.3    NA
##  4 7        1     4      23      6.5  62.1  22.4    NA
##  5 7        1     5      10      3    60.4  24.8    NA
##  6 7        1     6      13      6    60.2  24      NA
##  7 7        2     1      22      7    55.2  24.2    NA
##  8 7        2     2      12      4    67    13.2    NA
##  9 7        2     3      14      5.5  54.7  17.0    NA
## 10 7        2     4       9      4.5  69.2  16.7    NA
## # ℹ 32 more rows
#ANÁLISIS DESCRIPTIVO
# NUMERO DE HOJAS
#MUESTREO 1
boxplot(hojas~trat, data=M1)

mod1=aov(hojas~trat, data=M1);mod1
## Call:
##    aov(formula = hojas ~ trat, data = M1)
## 
## Terms:
##                     trat Residuals
## Sum of Squares  189.7024  371.5417
## Deg. of Freedom        6        35
## 
## Residual standard error: 3.25814
## Estimated effects may be unbalanced
anova(mod1)
## Analysis of Variance Table
## 
## Response: hojas
##           Df Sum Sq Mean Sq F value  Pr(>F)  
## trat       6 189.70  31.617  2.9784 0.01862 *
## Residuals 35 371.54  10.616                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Tt=TukeyHSD(mod1)
a=duncan.test(mod1, "trat", console=T)
## 
## Study: mod1 ~ "trat"
## 
## Duncan's new multiple range test
## for hojas 
## 
## Mean Square Error:  10.61548 
## 
## trat,  means
## 
##      hojas      std r      se  Min  Max    Q25   Q50    Q75
## 1 16.91667 3.666288 6 1.33013 11.5 21.5 15.375 16.50 19.500
## 2 14.58333 3.307819 6 1.33013 10.5 18.5 11.750 15.25 16.875
## 3 14.75000 3.921097 6 1.33013 10.0 19.0 11.250 15.75 17.625
## 4 14.83333 2.503331 6 1.33013 10.0 17.0 14.750 15.75 16.000
## 5 12.75000 4.192255 6 1.33013  8.0 20.5 11.000 12.50 12.500
## 6 10.08333 2.311205 6 1.33013  7.5 13.0  8.000 10.25 11.750
## 7 11.66667 2.316607 6 1.33013  9.0 15.0  9.875 11.50 13.125
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 3.818812 4.014414 4.141878 4.233379 4.302886 4.357681 
## 
## Means with the same letter are not significantly different.
## 
##      hojas groups
## 1 16.91667      a
## 4 14.83333     ab
## 3 14.75000     ab
## 2 14.58333     ab
## 5 12.75000    abc
## 7 11.66667     bc
## 6 10.08333      c
plot(a)

#MUESTREO 2
boxplot(hojas~trat, data=M2)

mod2=aov(hojas~trat, data=M2);mod2
## Call:
##    aov(formula = hojas ~ trat, data = M2)
## 
## Terms:
##                     trat Residuals
## Sum of Squares  179.0133  445.9917
## Deg. of Freedom        6        35
## 
## Residual standard error: 3.569681
## Estimated effects may be unbalanced
anova(mod2)
## Analysis of Variance Table
## 
## Response: hojas
##           Df Sum Sq Mean Sq F value  Pr(>F)  
## trat       6 179.01  29.836  2.3414 0.05256 .
## Residuals 35 445.99  12.743                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Tt=TukeyHSD(mod2)
b=duncan.test(mod1, "trat", console=T)
## 
## Study: mod1 ~ "trat"
## 
## Duncan's new multiple range test
## for hojas 
## 
## Mean Square Error:  10.61548 
## 
## trat,  means
## 
##      hojas      std r      se  Min  Max    Q25   Q50    Q75
## 1 16.91667 3.666288 6 1.33013 11.5 21.5 15.375 16.50 19.500
## 2 14.58333 3.307819 6 1.33013 10.5 18.5 11.750 15.25 16.875
## 3 14.75000 3.921097 6 1.33013 10.0 19.0 11.250 15.75 17.625
## 4 14.83333 2.503331 6 1.33013 10.0 17.0 14.750 15.75 16.000
## 5 12.75000 4.192255 6 1.33013  8.0 20.5 11.000 12.50 12.500
## 6 10.08333 2.311205 6 1.33013  7.5 13.0  8.000 10.25 11.750
## 7 11.66667 2.316607 6 1.33013  9.0 15.0  9.875 11.50 13.125
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 3.818812 4.014414 4.141878 4.233379 4.302886 4.357681 
## 
## Means with the same letter are not significantly different.
## 
##      hojas groups
## 1 16.91667      a
## 4 14.83333     ab
## 3 14.75000     ab
## 2 14.58333     ab
## 5 12.75000    abc
## 7 11.66667     bc
## 6 10.08333      c
plot(b)

#MUESTREO 3
boxplot(hojas~trat, data=M3)

mod3=aov(hojas~trat, data=M3);mod3
## Call:
##    aov(formula = hojas ~ trat, data = M3)
## 
## Terms:
##                     trat Residuals
## Sum of Squares  191.1429  755.3333
## Deg. of Freedom        6        35
## 
## Residual standard error: 4.64553
## Estimated effects may be unbalanced
anova(mod3)
## Analysis of Variance Table
## 
## Response: hojas
##           Df Sum Sq Mean Sq F value Pr(>F)
## trat       6 191.14  31.857  1.4762 0.2149
## Residuals 35 755.33  21.581
Tt=TukeyHSD(mod3)
c=duncan.test(mod3, "trat", console=T)
## 
## Study: mod3 ~ "trat"
## 
## Duncan's new multiple range test
## for hojas 
## 
## Mean Square Error:  21.58095 
## 
## trat,  means
## 
##      hojas      std r      se  Min  Max    Q25   Q50    Q75
## 1 17.75000 3.531997 6 1.89653 11.5 21.5 17.000 18.25 19.875
## 2 16.66667 6.013873 6 1.89653 10.5 28.0 14.000 15.25 16.875
## 3 15.16667 4.273952 6 1.89653 10.0 19.5 11.250 16.50 18.375
## 4 16.25000 1.695582 6 1.89653 13.5 18.0 15.375 16.75 17.375
## 5 16.25000 5.972855 6 1.89653  8.0 24.5 12.375 17.00 19.375
## 6 10.58333 3.555512 6 1.89653  6.0 16.5  9.500  9.50 11.750
## 7 15.66667 5.741661 6 1.89653 10.0 24.5 11.250 14.25 19.125
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 5.444949 5.723843 5.905585 6.036048 6.135153 6.213280 
## 
## Means with the same letter are not significantly different.
## 
##      hojas groups
## 1 17.75000      a
## 2 16.66667     ab
## 4 16.25000     ab
## 5 16.25000     ab
## 7 15.66667     ab
## 3 15.16667     ab
## 6 10.58333      b
plot(c)

#MUESTREO 5
boxplot(hojas~trat, data=M5)

mod5=aov(hojas~trat, data=M5);mod5
## Call:
##    aov(formula = hojas ~ trat, data = M5)
## 
## Terms:
##                     trat Residuals
## Sum of Squares   188.500  1461.958
## Deg. of Freedom        6        35
## 
## Residual standard error: 6.46299
## Estimated effects may be unbalanced
anova(mod5)
## Analysis of Variance Table
## 
## Response: hojas
##           Df Sum Sq Mean Sq F value Pr(>F)
## trat       6  188.5  31.417  0.7521  0.612
## Residuals 35 1462.0  41.770
Tt=TukeyHSD(mod5)
d=duncan.test(mod1, "trat", console=T)
## 
## Study: mod1 ~ "trat"
## 
## Duncan's new multiple range test
## for hojas 
## 
## Mean Square Error:  10.61548 
## 
## trat,  means
## 
##      hojas      std r      se  Min  Max    Q25   Q50    Q75
## 1 16.91667 3.666288 6 1.33013 11.5 21.5 15.375 16.50 19.500
## 2 14.58333 3.307819 6 1.33013 10.5 18.5 11.750 15.25 16.875
## 3 14.75000 3.921097 6 1.33013 10.0 19.0 11.250 15.75 17.625
## 4 14.83333 2.503331 6 1.33013 10.0 17.0 14.750 15.75 16.000
## 5 12.75000 4.192255 6 1.33013  8.0 20.5 11.000 12.50 12.500
## 6 10.08333 2.311205 6 1.33013  7.5 13.0  8.000 10.25 11.750
## 7 11.66667 2.316607 6 1.33013  9.0 15.0  9.875 11.50 13.125
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 3.818812 4.014414 4.141878 4.233379 4.302886 4.357681 
## 
## Means with the same letter are not significantly different.
## 
##      hojas groups
## 1 16.91667      a
## 4 14.83333     ab
## 3 14.75000     ab
## 2 14.58333     ab
## 5 12.75000    abc
## 7 11.66667     bc
## 6 10.08333      c
plot(d)

#MUESTREO 7
boxplot(hojas~trat, data=M7)

mod7=aov(hojas~trat, data=M7);mod7
## Call:
##    aov(formula = hojas ~ trat, data = M7)
## 
## Terms:
##                     trat Residuals
## Sum of Squares  173.9524  723.7917
## Deg. of Freedom        6        35
## 
## Residual standard error: 4.547501
## Estimated effects may be unbalanced
anova(mod7)
## Analysis of Variance Table
## 
## Response: hojas
##           Df Sum Sq Mean Sq F value Pr(>F)
## trat       6 173.95  28.992   1.402 0.2415
## Residuals 35 723.79  20.680
Tt=TukeyHSD(mod7)
e=duncan.test(mod7, "trat", console=T)
## 
## Study: mod7 ~ "trat"
## 
## Duncan's new multiple range test
## for hojas 
## 
## Mean Square Error:  20.67976 
## 
## trat,  means
## 
##      hojas      std r       se  Min  Max    Q25   Q50    Q75
## 1 16.75000 4.677072 6 1.856509 10.0 23.0 13.875 17.50 19.250
## 2 13.91667 4.340699 6 1.856509  9.0 22.0 12.250 13.25 13.875
## 3 12.16667 5.335416 6 1.856509  6.5 21.0  8.625 11.00 14.500
## 4 15.16667 1.437591 6 1.856509 13.0 16.5 14.250 15.50 16.375
## 5 14.66667 6.470446 6 1.856509  7.0 22.5 10.750 12.75 20.375
## 6 10.16667 3.600926 6 1.856509  6.5 17.0  8.625  9.25 10.250
## 7 15.25000 4.321458 6 1.856509 10.5 21.0 11.750 14.75 18.500
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 5.330050 5.603059 5.780965 5.908676 6.005690 6.082168 
## 
## Means with the same letter are not significantly different.
## 
##      hojas groups
## 1 16.75000      a
## 7 15.25000     ab
## 4 15.16667     ab
## 5 14.66667     ab
## 2 13.91667     ab
## 3 12.16667     ab
## 6 10.16667      b
plot(e)

#comparación muestreos del N_hojas 
par(mfcol= c(3,2))
plot(a, main = "M1"); plot(b, main = "M2"); plot(c, main = "M3");plot(d, main = "M5"); plot(e, main = "M7")


FisioPro
## # A tibble: 210 × 8
##    muestreo trat  rep   hojas flores  clor  area  diam
##    <chr>    <chr> <chr> <dbl>  <dbl> <dbl> <dbl> <dbl>
##  1 1        1     1      16.5    1    69.8 110.      0
##  2 1        1     2      21.5    4.5  76.7 108.      0
##  3 1        1     3      15      4.5  50.1  84.1     0
##  4 1        1     4      20.5    9.5  53.4 111.      0
##  5 1        1     5      11.5    4.5  51.0  79.7     0
##  6 1        1     6      16.5    5    53.6  83.3     0
##  7 1        2     1      18.5   10    65.2  90.8     0
##  8 1        2     2      14      4.5  60.6  95.1     0
##  9 1        2     3      11      5    79.8 148.      0
## 10 1        2     4      10.5    6.5  84.2 139.      0
## # ℹ 200 more rows
dats <- FisioPro %>%
  group_by(muestreo,trat) %>% 
  summarise(media = mean(hojas),
            desviacion = sd(hojas),
            n = n()) %>% 
  mutate(error = 1.96 * desviacion / sqrt(n));dats
## `summarise()` has grouped output by 'muestreo'. You can override using the
## `.groups` argument.
## # A tibble: 35 × 6
## # Groups:   muestreo [5]
##    muestreo trat  media desviacion     n error
##    <chr>    <chr> <dbl>      <dbl> <int> <dbl>
##  1 1        1      16.9       3.67     6  2.93
##  2 1        2      14.6       3.31     6  2.65
##  3 1        3      14.8       3.92     6  3.14
##  4 1        4      14.8       2.50     6  2.00
##  5 1        5      12.8       4.19     6  3.35
##  6 1        6      10.1       2.31     6  1.85
##  7 1        7      11.7       2.32     6  1.85
##  8 2        1      17.6       3.38     6  2.71
##  9 2        2      15.4       4.40     6  3.52
## 10 2        3      14.6       4.20     6  3.36
## # ℹ 25 more rows
dats$muestreo <- factor(dats$muestreo, labels = c("M1","M2","M3","M5","M7"))
dats$trat <- factor(dats$trat, labels = c("T_1", "T_2", "T_3", "T_4","T_5","T_6", "T_7"))
labels <- c("T_1", "T_2", "T_3", "T_4","T_5","T_6","T_7")

ggplot(dats)+
  aes(x=dats$trat, y = media, fill=dats$trat)+
  geom_col(strat = 'identity', position = 'dodge', color = 'black')+
  geom_errorbar(aes(ymin = media - error, ymax = media + error),
                width = 0.2, position = position_dodge(0.9))+
  geom_text(aes(label = c("b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c")
                , y = media+ 0.23), color = 'black', size = 4)  +
  facet_grid(~dats$muestreo)+
  labs(title = "Número de hojas por tratamientos en los muestreos", x = "Muestreos", y = "#hojas")+ 
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, size = 7))+
  scale_fill_manual(values = c("#98F5FF", "#C1CDCD", "#CDCD00", "#FFD39B","#FF7F24", "#BF3EFF", "#9AFF9A"))+
  scale_x_discrete(labels = labels)+
  theme_bw()
## Warning in geom_col(strat = "identity", position = "dodge", color = "black"):
## Ignoring unknown parameters: `strat`

#ANALISIS DESCRIPTIVO 
#NUMERO DE FLORES 

#MUESTREO 1
boxplot(flores~trat, data=M1)

mod1f=aov(flores~trat, data=M1);mod1f
## Call:
##    aov(formula = flores ~ trat, data = M1)
## 
## Terms:
##                      trat Residuals
## Sum of Squares   60.33333 203.50000
## Deg. of Freedom         6        35
## 
## Residual standard error: 2.411283
## Estimated effects may be unbalanced
anova(mod1f)
## Analysis of Variance Table
## 
## Response: flores
##           Df  Sum Sq Mean Sq F value Pr(>F)
## trat       6  60.333 10.0556  1.7295 0.1432
## Residuals 35 203.500  5.8143
Tt=TukeyHSD(mod1f)
f=duncan.test(mod1f, "trat", console=T)
## 
## Study: mod1f ~ "trat"
## 
## Duncan's new multiple range test
## for flores 
## 
## Mean Square Error:  5.814286 
## 
## trat,  means
## 
##     flores       std r        se Min  Max   Q25  Q50   Q75
## 1 4.833333 2.7141604 6 0.9844022 1.0  9.5 4.500 4.50 4.875
## 2 6.916667 2.3112046 6 0.9844022 4.5 10.0 5.250 6.25 8.750
## 3 4.416667 2.5182666 6 0.9844022 0.0  7.5 4.000 4.75 5.500
## 4 5.916667 2.0103897 6 0.9844022 4.0  9.0 4.250 5.50 7.125
## 5 3.000000 3.3615473 6 0.9844022 0.0  7.0 0.125 2.00 6.125
## 6 4.916667 0.8612007 6 0.9844022 4.0  6.0 4.125 5.00 5.500
## 7 3.833333 2.3593784 6 0.9844022 0.0  6.5 2.750 4.25 5.375
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 2.826225 2.970986 3.065320 3.133037 3.184478 3.225031 
## 
## Means with the same letter are not significantly different.
## 
##     flores groups
## 2 6.916667      a
## 4 5.916667     ab
## 6 4.916667     ab
## 1 4.833333     ab
## 3 4.416667     ab
## 7 3.833333     ab
## 5 3.000000      b
plot(f)

#MUESTREO 2
boxplot(flores~trat, data=M2)

mod2f=aov(flores~trat, data=M2);mod2f
## Call:
##    aov(formula = flores ~ trat, data = M2)
## 
## Terms:
##                     trat Residuals
## Sum of Squares   69.6667  316.2917
## Deg. of Freedom        6        35
## 
## Residual standard error: 3.006145
## Estimated effects may be unbalanced
anova(mod2f)
## Analysis of Variance Table
## 
## Response: flores
##           Df Sum Sq Mean Sq F value Pr(>F)
## trat       6  69.67 11.6111  1.2849 0.2896
## Residuals 35 316.29  9.0369
Tt=TukeyHSD(mod2f)
g=duncan.test(mod2f, "trat", console=T)
## 
## Study: mod2f ~ "trat"
## 
## Duncan's new multiple range test
## for flores 
## 
## Mean Square Error:  9.036905 
## 
## trat,  means
## 
##     flores      std r       se Min  Max   Q25  Q50   Q75
## 1 5.666667 3.219731 6 1.227253 1.5 10.0 4.125 4.75 8.000
## 2 7.916667 3.583527 6 1.227253 4.5 14.5 5.750 7.00 8.625
## 3 6.250000 2.962263 6 1.227253 3.0  9.5 3.750 6.00 9.000
## 4 7.333333 1.861899 6 1.227253 6.0 11.0 6.500 6.50 7.250
## 5 3.833333 3.920034 6 1.227253 0.0 10.5 1.625 2.25 5.500
## 6 6.583333 3.322900 6 1.227253 4.0 13.0 4.625 5.50 6.750
## 7 5.000000 1.183216 6 1.227253 3.5  6.0 4.000 5.50 5.875
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 3.523452 3.703926 3.821532 3.905955 3.970087 4.020643 
## 
## Means with the same letter are not significantly different.
## 
##     flores groups
## 2 7.916667      a
## 4 7.333333     ab
## 6 6.583333     ab
## 3 6.250000     ab
## 1 5.666667     ab
## 7 5.000000     ab
## 5 3.833333      b
plot(g)

#MUESTREO 3
boxplot(flores~trat, data=M3)

mod3f=aov(flores~trat, data=M3);mod3f
## Call:
##    aov(formula = flores ~ trat, data = M3)
## 
## Terms:
##                     trat Residuals
## Sum of Squares   68.5595  425.0417
## Deg. of Freedom        6        35
## 
## Residual standard error: 3.484831
## Estimated effects may be unbalanced
anova(mod3f)
## Analysis of Variance Table
## 
## Response: flores
##           Df Sum Sq Mean Sq F value Pr(>F)
## trat       6  68.56  11.427  0.9409 0.4786
## Residuals 35 425.04  12.144
Tt=TukeyHSD(mod3f)
h=duncan.test(mod3f, "trat", console=T)
## 
## Study: mod3f ~ "trat"
## 
## Duncan's new multiple range test
## for flores 
## 
## Mean Square Error:  12.14405 
## 
## trat,  means
## 
##     flores      std r       se Min  Max   Q25  Q50    Q75
## 1 9.083333 2.634704 6 1.422676 4.5 12.5 9.000 9.00 10.125
## 2 9.416667 4.565267 6 1.422676 6.5 18.5 7.125 7.50  9.000
## 3 8.416667 3.760541 6 1.422676 3.5 13.0 5.625 9.00 10.875
## 4 9.333333 4.377975 6 1.422676 6.0 18.0 7.125 8.00  8.875
## 5 5.583333 2.200379 6 1.422676 2.0  8.5 5.000 5.50  6.750
## 6 8.500000 4.135215 6 1.422676 4.5 16.5 6.750 7.75  8.000
## 7 7.250000 1.405347 6 1.422676 5.0  9.0 6.625 7.50  8.000
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 4.084513 4.293724 4.430057 4.527924 4.602267 4.660874 
## 
## Means with the same letter are not significantly different.
## 
##     flores groups
## 2 9.416667      a
## 4 9.333333      a
## 1 9.083333      a
## 6 8.500000      a
## 3 8.416667      a
## 7 7.250000      a
## 5 5.583333      a
plot(h)

#MUESTREO 5
boxplot(flores~trat, data=M5)

mod5f=aov(flores~trat, data=M5);mod5f
## Call:
##    aov(formula = flores ~ trat, data = M5)
## 
## Terms:
##                      trat Residuals
## Sum of Squares   81.11905 281.50000
## Deg. of Freedom         6        35
## 
## Residual standard error: 2.835993
## Estimated effects may be unbalanced
anova(mod5f)
## Analysis of Variance Table
## 
## Response: flores
##           Df  Sum Sq Mean Sq F value Pr(>F)
## trat       6  81.119 13.5198   1.681 0.1549
## Residuals 35 281.500  8.0429
Tt=TukeyHSD(mod5f)
i=duncan.test(mod5f, "trat", console=T)
## 
## Study: mod5f ~ "trat"
## 
## Duncan's new multiple range test
## for flores 
## 
## Mean Square Error:  8.042857 
## 
## trat,  means
## 
##     flores      std r       se Min  Max   Q25  Q50    Q75
## 1 6.250000 4.216041 6 1.157789   1 13.0 4.125 5.25  8.250
## 2 6.833333 2.089657 6 1.157789   5 10.5 5.500 6.00  7.625
## 3 6.500000 3.098387 6 1.157789   4 11.0 4.000 5.25  8.750
## 4 8.750000 2.583602 6 1.157789   6 13.0 7.125 8.00 10.000
## 5 3.833333 2.804758 6 1.157789   0  8.0 2.125 4.25  4.875
## 6 6.416667 2.375219 6 1.157789   4 10.0 4.375 6.25  7.750
## 7 5.250000 2.091650 6 1.157789   2  8.0 4.250 5.50  6.375
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 3.324020 3.494279 3.605228 3.684873 3.745375 3.793070 
## 
## Means with the same letter are not significantly different.
## 
##     flores groups
## 4 8.750000      a
## 2 6.833333     ab
## 3 6.500000     ab
## 6 6.416667     ab
## 1 6.250000     ab
## 7 5.250000     ab
## 5 3.833333      b
plot(i)

#MUESTREO 7
boxplot(flores~trat, data=M7)

mod7f=aov(flores~trat, data=M7);mod7f
## Call:
##    aov(formula = flores ~ trat, data = M7)
## 
## Terms:
##                     trat Residuals
## Sum of Squares   59.0714  347.9583
## Deg. of Freedom        6        35
## 
## Residual standard error: 3.153041
## Estimated effects may be unbalanced
anova(mod7f)
## Analysis of Variance Table
## 
## Response: flores
##           Df Sum Sq Mean Sq F value Pr(>F)
## trat       6  59.07  9.8452  0.9903 0.4469
## Residuals 35 347.96  9.9417
Tt=TukeyHSD(mod7f)
j=duncan.test(mod7f, "trat", console=T)
## 
## Study: mod7f ~ "trat"
## 
## Duncan's new multiple range test
## for flores 
## 
## Mean Square Error:  9.941667 
## 
## trat,  means
## 
##     flores      std r       se Min  Max   Q25  Q50    Q75
## 1 6.666667 3.125167 6 1.287224 3.0 12.0 4.875 6.25  7.625
## 2 5.000000 1.140175 6 1.287224 4.0  7.0 4.125 4.75  5.375
## 3 6.750000 4.546977 6 1.287224 1.0 12.5 3.625 6.50 10.125
## 4 7.000000 2.280351 6 1.287224 5.0 10.0 5.000 6.50  8.750
## 5 4.250000 2.995830 6 1.287224 2.0  9.0 2.125 2.75  6.000
## 6 8.000000 4.147288 6 1.287224 4.0 14.5 5.000 6.75 10.375
## 7 5.750000 2.544602 6 1.287224 2.5 10.0 4.375 5.75  6.375
## 
## Alpha: 0.05 ; DF Error: 35 
## 
## Critical Range
##        2        3        4        5        6        7 
## 3.695627 3.884920 4.008272 4.096821 4.164086 4.217113 
## 
## Means with the same letter are not significantly different.
## 
##     flores groups
## 6 8.000000      a
## 4 7.000000      a
## 3 6.750000      a
## 1 6.666667      a
## 7 5.750000      a
## 2 5.000000      a
## 5 4.250000      a
plot(j)

#comparación muestreos del N_flores 
par(mfcol= c(3,2))
plot(f, main = "M1"); plot(g, main = "M2"); plot(h, main = "M3");plot(i, main = "M5"); plot(j, main = "M7")
dats
## # A tibble: 35 × 6
## # Groups:   muestreo [5]
##    muestreo trat  media desviacion     n error
##    <fct>    <fct> <dbl>      <dbl> <int> <dbl>
##  1 M1       T_1    16.9       3.67     6  2.93
##  2 M1       T_2    14.6       3.31     6  2.65
##  3 M1       T_3    14.8       3.92     6  3.14
##  4 M1       T_4    14.8       2.50     6  2.00
##  5 M1       T_5    12.8       4.19     6  3.35
##  6 M1       T_6    10.1       2.31     6  1.85
##  7 M1       T_7    11.7       2.32     6  1.85
##  8 M2       T_1    17.6       3.38     6  2.71
##  9 M2       T_2    15.4       4.40     6  3.52
## 10 M2       T_3    14.6       4.20     6  3.36
## # ℹ 25 more rows
dats <- FisioPro %>%
  group_by(muestreo,trat) %>% 
  summarise(media = mean(flores),
            desviacion = sd(flores),
            n = n()) %>% 
  mutate(error = 1.96 * desviacion / sqrt(n));dats
## `summarise()` has grouped output by 'muestreo'. You can override using the
## `.groups` argument.
## # A tibble: 35 × 6
## # Groups:   muestreo [5]
##    muestreo trat  media desviacion     n error
##    <chr>    <chr> <dbl>      <dbl> <int> <dbl>
##  1 1        1      4.83      2.71      6 2.17 
##  2 1        2      6.92      2.31      6 1.85 
##  3 1        3      4.42      2.52      6 2.02 
##  4 1        4      5.92      2.01      6 1.61 
##  5 1        5      3         3.36      6 2.69 
##  6 1        6      4.92      0.861     6 0.689
##  7 1        7      3.83      2.36      6 1.89 
##  8 2        1      5.67      3.22      6 2.58 
##  9 2        2      7.92      3.58      6 2.87 
## 10 2        3      6.25      2.96      6 2.37 
## # ℹ 25 more rows
dats$muestreo <- factor(dats$muestreo, labels = c("M1","M2","M3","M5","M7"))
dats$trat <- factor(dats$trat, labels = c("T_1", "T_2", "T_3", "T_4","T_5","T_6", "T_7"))
labels <- c("T_1", "T_2", "T_3", "T_4","T_5","T_6","T_7")

ggplot(dats)+
  aes(x=dats$trat, y = media, fill=dats$trat)+
  geom_col(strat = 'identity', position = 'dodge', color = 'black')+
  geom_errorbar(aes(ymin = media - error, ymax = media + error),
                width = 0.2, position = position_dodge(0.9))+
  geom_text(aes(label = c("b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c",
                          "b","b","a","a","b","b","c")
                , y = media+ 0.23), color = 'black', size = 4)  +
  facet_grid(~dats$muestreo)+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, size = 7))+
  scale_fill_manual(values = c("#98F5FF", "#C1CDCD", "#CDCD00", "#FFD39B","#FF7F24", "#BF3EFF", "#9AFF9A"))+
  scale_x_discrete(labels = labels)+
  theme_bw()
## Warning in geom_col(strat = "identity", position = "dodge", color = "black"):
## Ignoring unknown parameters: `strat`