Los datos a continuación muestran las medidas de tres covariables en suelo de cada parcela experimental.

##Instalar readxl para importar datos de excel y cargarlo.
library(readxl)

# Usamos la funcion "file.choose" para encontrar el archivo y lo copiamos en la sig

ruta_excel5= ("C:\\Users\\LENOVO\\Desktop\\UN Materias\\Unal 2023-1\\DISEÑO EXPERIMENTOS\\Taller parcial diseño.xlsx")

excel_sheets(ruta_excel5)
## [1] "Hoja 1" "Hoja 2" "Hoja 3" "Hoja 4" "Hoja 5"
data_excel5= read_excel(ruta_excel5, sheet = "Hoja 5")
print(data_excel5)
## # A tibble: 12 × 5
##    rtp_g Factor   CIC    CE Ca_Mg
##    <chr> <chr>  <dbl> <dbl> <dbl>
##  1 9.5   f1        74     9    52
##  2 10.5  f1        81    11    54
##  3 8.5   f1        63     7    44
##  4 12    f2        77    12    57
##  5 11.6  f2        65     9    46
##  6 10.4  f2        68     8    45
##  7 9.6   f3        87    11    50
##  8 12.2  f3        67    10    43
##  9 14.2  f3        66    11    47
## 10 13.8  f4        61     7    37
## 11 14.1  f4        86    13    56
## 12 15    f4        78    10    52
data_excel5$Factor = as.factor(data_excel5$Factor)
data_excel5$rtp_g = as.numeric(data_excel5$rtp_g)

ANALISIS DESCRIPTIVO

data_excel5$Factor=as.factor(data_excel5$Factor)
library(ggplot2)

ggplot(data_excel5)+ aes(Factor , rtp_g, fill=Factor)+ 
 geom_boxplot() +
 xlab("Factor (profundida)")+ ylab("Respuesta germinacion")

data_excel5$Factor=as.factor(data_excel5$Factor)
data_excel5$rtp_g=as.numeric(data_excel5$rtp_g)

Hipotesis1

\[H_0: \theta = 0 \]

Hipotesis 2

\[H_1: \mu_{f_1} = \mu_{f_2} = \mu_{f_3} = \mu_{f_4}\]

Modelo

\[y_{ij} = \mu + \tau_{i} + \theta(x_{ij}-\bar{x}) + \epsilon_{ij}\]

Ancova

mod5b = aov(rtp_g ~CIC+CE+Ca_Mg+ Factor, data_excel5)
summary(mod5b)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## CIC          1  0.003   0.003   0.004 0.95332   
## CE           1 14.137  14.137  19.789 0.00671 **
## Ca_Mg        1  2.924   2.924   4.093 0.09896 . 
## Factor       3 29.561   9.854  13.793 0.00747 **
## Residuals    5  3.572   0.714                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

-Con un nivel de significancia del 5% hay evidencia estadistica que muestra que la profundidad tiene efecto significativos sobre la covariable “CE”. - vamos al pvalor 0.00671 < 0.05 rechazo H0 Por tanto, la pendiente no es 0 y hay una relación entre la profundidad y CE.

REVISION DE SUPUESTOS.

prueba de normalidad:

#1. Estraemos los residuales
res_mod=mod5b$residuals

#2. Prueba de Normalidad
shapiro.test(res_mod)
## 
##  Shapiro-Wilk normality test
## 
## data:  res_mod
## W = 0.99036, p-value = 0.9998

-Se cumple supuesto de normalidad debido a p-value > 5%

### Prueba Homocedasticidad {data-width=5}
bartlett.test(res_mod, data_excel5$Factor)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  res_mod and data_excel5$Factor
## Bartlett's K-squared = 2.4474, df = 3, p-value = 0.4849

Se cumple supuesto de Homocedasticidad debido a p-value > 5.

PRUEBA DE TUKEY.

library(TukeyC)
tt = TukeyC(mod5b, "Factor")
plot(tt)

No hay diferencias entre el “f3-f2-f1”, siendo el menos significativo el f4 (Factor de profundidad)

TUKEY 2.

TukeyHSD(mod5b, conf.level = 0.95)
## Warning in replications(paste("~", xx), data = mf): non-factors ignored: CIC
## Warning in replications(paste("~", xx), data = mf): non-factors ignored: CE
## Warning in replications(paste("~", xx), data = mf): non-factors ignored: Ca_Mg
## Warning in TukeyHSD.aov(mod5b, conf.level = 0.95): 'which' specified some
## non-factors which will be dropped
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = rtp_g ~ CIC + CE + Ca_Mg + Factor, data = data_excel5)
## 
## $Factor
##              diff        lwr      upr     p adj
## f2-f1  0.70028257 -1.8461900 3.246755 0.7491551
## f3-f1  0.07084901 -2.4756236 2.617322 0.9995590
## f4-f1  3.58044806  1.0339755 6.126921 0.0130043
## f3-f2 -0.62943356 -3.1759062 1.917039 0.8003250
## f4-f2  2.88016549  0.3336929 5.426638 0.0314446
## f4-f3  3.50959905  0.9631265 6.056072 0.0141442

Solo hay diferencias en las que tenga relacion f4. Ya que el pvalor es menor al 0.05 en esta comparación.

INTERPRETACION BIOLOGICA:

La profundidad de siembra en cm si afecta el tiempo que dura en germinar las semillas.

REVISION DE DATOS ATIPICOS.

#Instalamos libreria
#Valor #Valor p ≤ α: Existe un valor atípico (Rechaza H0)
library(outliers)
grubbs.test(mod5b$residuals)
## 
##  Grubbs test for one outlier
## 
## data:  mod5b$residuals
## G.2 = 1.82896, U = 0.66825, p-value = 0.3
## alternative hypothesis: highest value 1.04222615185057 is an outlier

En este caso pvalor > 0.05, no existen datos atípicos. No es necesario imputar (ver clase 12).

MODALIDADES DE ANALISIS DE VARIANZA:

Oneway Test.

mod1v = oneway.test(rtp_g~Factor, data_excel5)
mod1v
## 
##  One-way analysis of means (not assuming equal variances)
## 
## data:  rtp_g and Factor
## F = 14.692, num df = 3.0000, denom df = 4.2388, p-value = 0.01069

Test de Kruskal-Wallis.

mod2v = kruskal.test(rtp_g~Factor, data_excel5)
mod2v
## 
##  Kruskal-Wallis rank sum test
## 
## data:  rtp_g by Factor
## Kruskal-Wallis chi-squared = 7.1026, df = 3, p-value = 0.0687

Analisis varianza permutacional.

library(RVAideMemoire)
## *** Package RVAideMemoire v 0.9-82-2 ***
## 
## Attaching package: 'RVAideMemoire'
## The following object is masked from 'package:TukeyC':
## 
##     cv
perm1<-perm.anova(rtp_g~Factor, data= data_excel5, nperm = 1000, progress = F)
perm1
## Permutation Analysis of Variance Table
## 
## Response: rtp_g
## 1000 permutations
##           Sum Sq Df Mean Sq F value  Pr(>F)  
## Factor    35.390  3 11.7967  6.3737 0.02597 *
## Residuals 14.807  8  1.8508                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1