Ejercicio 1

Datos

Colombia Ocarina
0.45 0.28
0.41 0.25
0.49 0.32
0.46 0.34
0.39 0.36
0.44 0.40
0.48 0.39
0.42 0.36
0.44 0.39
0.48 0.41
0.50 0.37
0.47 0.42
0.44 0.41
0.52
Colombia = c(0.45, 0.41, 0.49, 0.46, 0.39, 0.44, 0.48, 0.42, 0.44, 0.48, 0.50, 0.47, 0.44, 0.52)

Ocarina = c(0.28, 0.25, 0.32, 0.34, 0.36, 0.40, 0.39, 0.36, 0.39, 0.41, 0.37, 0.42, 0.41, NA)

Hipótesis

\[ H_0: \mu_col = \mu_oca \\ H_a: \mu_col \neq \mu_oca\]

Test_1 <- t.test(Colombia, Ocarina, alternative = 't')
Test_1
## 
##  Welch Two Sample t-test
## 
## data:  Colombia and Ocarina
## t = 5.4526, df = 21.265, p-value = 1.989e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.05872686 0.13105336
## sample estimates:
## mean of x mean of y 
## 0.4564286 0.3615385
ifelse(Test_1$p.value<0.05, 'Rechazo Ho','No rechazo Ho')
## [1] "Rechazo Ho"

Gráfico

boxplot(Colombia, Ocarina, main = "Conductancia Estomática",at = c(1,2),names = c("Colombia","Ocarina"),ylab = "mol/m^2s", col = rgb(0.4, 0.8, 0.6))

### Varianzas

var(Colombia)
## [1] 0.001317033
var(Ocarina)
## [1] NA

Se encuentra que las varianzas no son significativamente diferentes, y de acuerdo al artículo, se tiene que no hay diferencia en plantas con déficit de agua. La hipótesis nula se rechaza, las medias son desiguales.

Ejercicio 2

Datos

45dds 77dds
69 873
66 850
72 832
68 834
65 843
66 840
67 895
68 790
69 905
69 910
66 920
68 840
64 832
67 800
60 759
68 812

Hipótesis

\[H_0: \mu_{45dds} = \mu_{77dds}\\ H_a: \mu_{45dds} < \mu_{77dds}\]

T1 <- c(69, 66, 72, 68, 65, 66, 67, 68, 69, 69, 66, 68, 64, 67, 60, 68)
T2 <- c(873, 850, 832, 834, 843, 840, 895, 790, 905, 910, 920, 840, 832, 800, 759, 812)
tt1 <- t.test(x = T1, y = T2, mu = 0, paired = TRUE, conf.level = 0.95, alternative = 'less')
ifelse(tt1$p.value<0.05, 'Rechazo Ho', 'No rechazo Ho')
## [1] "Rechazo Ho"

Gráficas

library(ggplot2)
par(mfrow=c(2,2))
barplot(T1, main = '45dds', pch=19, col = rgb(0.8, 0.2, 0.2), xlab = 'Tuberculo', ylab = 'Kg/ha')
barplot(T2, main = '77dds', pch=19, col = rgb(0.2, 0.2, 0.8), xlab = 'Tuberculo', ylab = 'Kg/ha')
barplot(T1, main = '45dds_reescalado',ylim = c(0,1000), pch=19, col = rgb(0.8, 0.2, 0.2), xlab = 'Tuberculo', ylab = 'Kg/ha')
barplot(T2, main = '77dds_reescalado', ylim = c(0,1000), pch=19, col = rgb(0.2, 0.2, 0.8), xlab = 'Tuberculo', ylab = 'Kg/ha')

Corelación de pearson

RC <- (mean(T2)-mean(T1))*100/mean(T1)
RC
## [1] 1162.593
cor(T1, T2, method = 'pearson')
## [1] 0.391328

Se muestran dos gráficas, donde en primera instancia los límites no estan definidos exactamente igual para las dos medidas (45 días y 77 días), por ende estos gráficos no son concluyentes en cambios significativos; pero al delimitar extactamente igual las dos gráficas, se evidencia un cambio significativo bastante alto. La hipótesis nula se rechaza, las medias son desiguales. A lo largo del tiempo hay un aumento en el peso de los tubérculos. Se muestra una correlación baja, ya que no son dos variables sino una misma medida en dos tiempos diferentes.

Ejercicio 3

\[H_0: Mediana_{Palma} = Mediana_{Maíz}\\ H_a: Mediana_{Palma} \neq Mediana_{Maíz}\] ### Datos

Palma <- c(3,4,3,4,4,3,3,4,4,3,4,4,2,4,3,4,3,3,3,4,4)
Maíz <- c(3,4,4,4,4,4,3,4,3,4,4,4,4,3,4,4,4,3,3,4,3)
wil_test1 <- wilcox.test(Palma,Maíz,mu = 0, alternative = 't',conf.level = 0.95)
## Warning in wilcox.test.default(Palma, Maíz, mu = 0, alternative = "t",
## conf.level = 0.95): cannot compute exact p-value with ties
wil_test1$p.value
## [1] 0.3111338
ifelse(wil_test1$p.value<0.05, 'Rechazo Ho','No rechazo Ho')
## [1] "No rechazo Ho"
par(mfrow=c(1,2))
boxplot(Palma, ylim=c(1,5), main="Palma",col = 'chartreuse3')
text(1.35, median(Palma),"mediana")
boxplot(Maíz, ylim=c(1,5), main="Maíz",col = 'cyan3')
text(1.35, median(Maíz),"mediana")

Gráfico

tablap <- table(Palma)
tablam <- table(Maíz)
par(mfrow=c(1,2))
barplot(tablap, ylim=c(0,15),ylab = 'Frecuencia', xlab = 'Calidad', main="Palma", col = rgb(0.8, 0.2, 0.2))
barplot(tablam, ylim=c(0,15),ylab = 'Frecuencia', xlab = 'Calidad', main="Maíz", col = rgb(0.2, 0.2, 0.8))

Se puede evidenciar que con el aceite de maíz, se puede obtener una mayor calidad en el frito

Ejercicio 4

Hipótesis

\[H_0: \mu_{Palma} = \mu_{Maíz}\\ H_a: \mu_{Palma} \neq \mu_{Maíz}\]

L4 <- c(69.26,68.15,69.17,68.88,70.01,70.15,70.66,68.68,71.00,72.18,69.15,70.00,68.64,68.12,68.12)
a4 <- c(-1.31,-1.25,-1.47,-1.35,-1.32,-1.15,-1.25,-1.29,-1.42,-1.45,-1.29,-1.22,-1.19,-1.25,-1.25)
b4 <- c(28.68,27.66,28.02,27.66,27.66,26.88,26.25,26.26,28.15,30.00,28.24,25.59,24.69,25.56,26.26)
L12 <- c(62.20,60.45,63.12,61.64,61.25,62.55,64.12,65.65,66.87,65.11,66.14,62.64,61.97,60.58,60.68)
a12 <- c(0.81,0.78,0.55,0.81,0.77,0.69,0.59,0.55,0.42,0.39,0.41,0.37,0.35,0.34,0.34)
b12 <- c(37.31,35.90,36.36,36.12,36.45,35.99,36.14,36.14,35.55,34.77,32.32,31.96,30.17,36.65,37.15)
wil_test2 <- wilcox.test(L4,L12,mu = 0, alternative = 't',conf.level = 0.90,paired = TRUE);wil_test2
## 
##  Wilcoxon signed rank exact test
## 
## data:  L4 and L12
## V = 120, p-value = 6.104e-05
## alternative hypothesis: true location shift is not equal to 0
wil_test2$p.value
## [1] 6.103516e-05
ifelse(wil_test2$p.value<0.05, 'Rechazo Ho','No rechazo Ho')
## [1] "Rechazo Ho"
wil_test3 <- wilcox.test(a4,a12,mu = 0, alternative = 't',conf.level = 0.95, paired = TRUE);wil_test3
## Warning in wilcox.test.default(a4, a12, mu = 0, alternative = "t", conf.level =
## 0.95, : cannot compute exact p-value with ties
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  a4 and a12
## V = 0, p-value = 0.0007069
## alternative hypothesis: true location shift is not equal to 0
wil_test3$p.value
## [1] 0.0007068908
ifelse(wil_test3$p.value<0.05, 'Rechazo Ho','No rechazo Ho')
## [1] "Rechazo Ho"
wil_test4 <- wilcox.test(b4,b12,mu = 0, alternative = 't',conf.level = 0.95, paired = TRUE);wil_test4
## 
##  Wilcoxon signed rank exact test
## 
## data:  b4 and b12
## V = 0, p-value = 6.104e-05
## alternative hypothesis: true location shift is not equal to 0
wil_test4$p.value
## [1] 6.103516e-05
ifelse(wil_test4$p.value<0.05, 'Rechazo Ho','No rechazo Ho')
## [1] "Rechazo Ho"

Antes de concluir, cabe resaltar que las variables de Cielab no deben tomarse por separado, ya que estas son variables que funcionan en un gráfico con cordenadas x,y y z. Pero si éstas son tomadas como pruebas independientes, se rechazó en cada caso la hipotesis nula, lo que traduce en que, las temperaturas de almacenamiento poscosecha si inciden en la variación del color de las papas.

\[Ho: \Delta E \leq 2.5\\ Ha: \Delta E > 2.5\]

deltaE <- function(x,y,z,a,b,c){
  E <- sqrt((x-a)^2+(y-b)^2+(z-c)^2)
  return(E)
}
dE <- deltaE(L12,a12,b12,L4,a4,b4);dE
##  [1] 11.349665 11.458992 10.499452 11.342610 12.584506 12.005736 11.998721
##  [8] 10.496709  8.671937  8.724872  5.347570  9.862789  8.768746 13.504362
## [15] 13.284344
testde <- wilcox.test(dE,mu = 0, alternative = 't',conf.level = 0.95)
ifelse(testde$p.value<0.05, 'Rechazo Ho','No rechazo Ho')
## [1] "Rechazo Ho"

Para ΔE, se pasa de tener 6 variables a solo 1, esto comparando el color tanto en 4ºC, como en 12ºC. Con esto solo se quiere observar si la diferencia entre los colores son perceptibles por el ojo humano. Cuando el ΔE es mayor a 2.5 se es capaz de diferenciar colores, esto de acuerdo a los ojos promedio de los humanos. La hipotesis nula es rechazada en la prueba, lo que permite negar que no es perceptible por el ojo humano promedio; lo que en pocas palabras (aunque no se afirma), existe diferencia notoria entre los colores de acuerdo al almacenamiento.

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
p <- plot_ly(x=a4,y=b4,z=L4)%>%
 layout(
    scene = list(
      xaxis = list(title = "a 4ºC"),
      yaxis = list(title = "b 4ºC"),
      zaxis = list(title = "L 4ºC")
    )
  )%>%
  add_markers(color = 'chocolate3')
p 
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
library(htmlwidgets)
saveWidget(p, file=paste0( getwd(), "/Prueba2.html"))
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
library(plotly)
p <- plot_ly(x=a12,y=b12,z=L12)%>%
 layout(
    scene = list(
      xaxis = list(title = "a 12ºC"),
      yaxis = list(title = "b 12ºC"),
      zaxis = list(title = "L 12ºC")
    )
  )%>%
  add_markers(color = 'chocolate3')
p 
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
library(htmlwidgets)
saveWidget(p, file=paste0( getwd(), "/Prueba2.html"))
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels