##Descargar y separar Datos
##install.packages("tidyverse")
##library(tydiverse)
file.choose()
## [1] "C:\\Users\\sguerra\\Downloads\\Act-3.3.Rmd"
base <- read.csv("C:\\Users\\sguerra\\Downloads\\Base de datos turismo limpia")
españa <- base[base$Q13 == 2,]
mexico <- base[base$Q13 == 1,]
#Hipotesis 1; Hipotesis Alterna
q9 <- as.numeric(españa$Q9)
q9data <- sum(q9 == 1) / length(q9)
hipotesis1 <- 0.866
##res1 <- t.test(q9data, alternative = "two.sided", conf.level = 0.95, mu = hipotesis1)
#Hipotesis 2; Hipotesis Alterna
q6 <- as.numeric(mexico$Q6_4)
q6data <- mean(q6)
hipotesis2 <- .50
res2 <- t.test(q6, alternative = "less", conf.level = 0.95, mu = hipotesis2)
res2
##
## One Sample t-test
##
## data: q6
## t = 58.055, df = 441, p-value = 1
## alternative hypothesis: true mean is less than 0.5
## 95 percent confidence interval:
## -Inf 5.111478
## sample estimates:
## mean of x
## 4.984163
#Hipotesis 3; Hipotesis Alterna
q611 <- as.numeric(españa$Q6_11)
q6media <- mean(q611)
hipotesis3 <- 0.55
res3 <- t.test(q611, alternative = "less", conf.level = 0.95, mu = hipotesis3)
res3
##
## One Sample t-test
##
## data: q611
## t = 17.828, df = 286, p-value = 1
## alternative hypothesis: true mean is less than 0.55
## 95 percent confidence interval:
## -Inf 2.667168
## sample estimates:
## mean of x
## 2.487805
#Hipotesis4; Hipotesis Alterna
vmex <- mexico$Q7
vesp <- españa$Q7
res4 <- t.test(vmex, vesp)
res4
##
## Welch Two Sample t-test
##
## data: vmex and vesp
## t = 0.2395, df = 457.41, p-value = 0.8108
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.6081497 0.7769579
## sample estimates:
## mean of x mean of y
## 3.753394 3.668990
#Hipotesis 5; Hipotesis Alterna
q12 <- as.numeric(mexico$Q12)
hipotesis5 <- c(25, 36)
res5 <- t.test(q12, mu = mean(hipotesis5), conf.level = 0.95)
res5
##
## One Sample t-test
##
## data: q12
## t = 11.309, df = 441, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 30.5
## 95 percent confidence interval:
## 39.19774 42.85656
## sample estimates:
## mean of x
## 41.02715
#Hipotesis6; Hipotesis Alterna
q12 <- as.numeric(españa$Q12)
hipotesis6 <- c(15,29)
res6 <- t.test(q12, mu = mean(hipotesis6), conf.level = 0.95)
res6
##
## One Sample t-test
##
## data: q12
## t = 14.223, df = 286, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 22
## 95 percent confidence interval:
## 34.58792 38.63159
## sample estimates:
## mean of x
## 36.60976