#tabla
tabla1 <- matrix(c(16, 31, 3, 28), ncol = 2)
#nombres
colnames(tabla1) <- c("Grupo1", "Grupo2")
rownames(tabla1) <- c("Si", "No")
#tabla 1
tabla1
Grupo1 Grupo2
Si 16 3
No 31 28
#chi-2 de tabla
chisq.test(tabla1)
Pearson's Chi-squared test with Yates' continuity correction
data: tabla1
X-squared = 5, df = 1, p-value = 0.03
#Ahora veamos las infecciones
tabla2 <- matrix(c(4, 43, 1, 30), ncol = 2)
#tabla
colnames(tabla2) <- c("Grupo1", "Grupo2")
rownames(tabla2) <- c("Si", "No")
#la tabla
tabla2
Grupo1 Grupo2
Si 4 1
No 43 30
#chi2-para infecciones
chisq.test(tabla2)
Chi-squared approximation may be incorrect
Pearson's Chi-squared test with Yates' continuity correction
data: tabla2
X-squared = 0.2, df = 1, p-value = 0.6
#para extrusiones
tabla3 <- matrix(c(6, 41, 1, 30), ncol = 2)
#tabla
colnames(tabla3) <- c("Grupo1", "Grupo2")
rownames(tabla3) <- c("Si", "No")
#tabla3
tabla3
Grupo1 Grupo2
Si 6 1
No 41 30
#chi2 para extrusiones
chisq.test(tabla3)
Chi-squared approximation may be incorrect
Pearson's Chi-squared test with Yates' continuity correction
data: tabla3
X-squared = 1, df = 1, p-value = 0.3
#abro el df de internet
df <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vRL8kMetTG8BjJl6uuWsdsIwM0HhFuEIqLLuE3KFODC6ErSDPv4tH3lIZykkaF5aYhlOsL1mw7rmouo/pub?gid=1937824523&single=true&output=csv")
#t.test para edad
t.test(df$Edad_op~df$Grupo)
Welch Two Sample t-test
data: df$Edad_op by df$Grupo
t = -4, df = 82, p-value = 4e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-15.3 -5.7
sample estimates:
mean in group Grupo 1 mean in group Grupo 2
45.4 55.9
#para tiempo operatorio
t.test(df$Tiempo_op~df$Grupo)
Welch Two Sample t-test
data: df$Tiempo_op by df$Grupo
t = 0.8, df = 78, p-value = 0.4
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-13.3 30.5
sample estimates:
mean in group Grupo 1 mean in group Grupo 2
119 110
#para seguimiento en meses
t.test(df$Seg_Meses~df$Grupo)
Welch Two Sample t-test
data: df$Seg_Meses by df$Grupo
t = 2, df = 98, p-value = 0.08
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-4.11 64.52
sample estimates:
mean in group Grupo 1 mean in group Grupo 2
117.1 86.9