datos <- data.frame(
Alimento = c(
rep("L", 7),
rep("C",8),
rep("z",10),
rep("L",8),
rep("c",8),
rep("z",8)
),
Temperatura = c(
rep("20",7),
rep("20",8),
rep("20",10),
rep("8",8),
rep("8",8),
rep("8",8)
),
Supervivencia = c(
13.1, 15.0, 33.6, 35.5, 42.0, 11.1, 12.8,
19.0, 19.0, 66.6, 66.6, 11.0, 11.0, 49.0, 49.0,
1.2, 1.2, 0.2, 0.1, 0.3, 0.2, 0.1, 0.4, 0.2, 0.3,
6.2, 28.5, 41.0, 35.9, 25.0, 23.8, 79.0, 41.6,
84.3, 68.7, 68.7, 30.5, 30.5, 11.0, 11.0, 20.0,
25.8, 21.8, 16.0, 16.0, 20.1, 15.4, 13.3, 25.2
)
)
datos$Temperatura = factor(datos$Temperatura,
levels = c("8", "20"))
str(datos)
## 'data.frame': 49 obs. of 3 variables:
## $ Alimento : chr "L" "L" "L" "L" ...
## $ Temperatura : Factor w/ 2 levels "8","20": 2 2 2 2 2 2 2 2 2 2 ...
## $ Supervivencia: num 13.1 15 33.6 35.5 42 11.1 12.8 19 19 66.6 ...
head(datos)
## Alimento Temperatura Supervivencia
## 1 L 20 13.1
## 2 L 20 15.0
## 3 L 20 33.6
## 4 L 20 35.5
## 5 L 20 42.0
## 6 L 20 11.1
table(datos$Alimento, datos$Temperatura)
##
## 8 20
## c 8 0
## C 0 8
## L 8 7
## z 8 10
datos$Alimento = as.factor(datos$Alimento)
datos$Temperatura = as.factor(datos$Temperatura)
datos$Supervivencia = as.numeric(datos$Supervivencia)
modelo = aov(
Supervivencia ~ Alimento * Temperatura,
data = datos
)
summary(modelo)
## Df Sum Sq Mean Sq F value Pr(>F)
## Alimento 3 8044 2681.4 8.111 0.000216 ***
## Temperatura 1 1991 1991.4 6.024 0.018239 *
## Alimento:Temperatura 1 98 98.1 0.297 0.588661
## Residuals 43 14216 330.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction.plot(
x.factor = datos$Temperatura,
trace.factor = datos$Alimento,
response = datos$Supervivencia,
fun = mean,
type = "b",
pch = c(16, 17, 15),
xlab = "Temperatura (°C)",
ylab = "Supervivencia media (%)",
trace.label = "Alimento"
)

par(mfrow = c(2, 2))
plot(modelo)

par(mfrow = c(1, 1))