set.seed(28614)
a <- rnorm(100, 10, 25)
b <- a + runif(100, 5, 10)
x <- a
y <- b
t.test(x, y)
##
## Welch Two Sample t-test
##
## data: x and y
## t = -2.2055, df = 197.99, p-value = 0.02857
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -13.9979730 -0.7823098
## sample estimates:
## mean of x mean of y
## 9.665833 17.055974
boxplot(x, y, ylab = "Valores Numericos", xlab = "Grupos")
legend("bottomright", c("0.02857"))
### 2.
x <- iris$Petal.Width
y <- iris$Sepal.Width
t.test(x, y)
##
## Welch Two Sample t-test
##
## data: x and y
## t = -25.916, df = 237.03, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.999237 -1.716763
## sample estimates:
## mean of x mean of y
## 1.199333 3.057333
boxplot(x, y, ylab = "Valores Numericos", xlab = "Grupos")
legend("bottomright", c("< 2.2e-16"))
x <- mtcars$mpg[mtcars$am == "0"]
y <- mtcars$mpg[mtcars$am == "1"]
t.test(x, y)
##
## Welch Two Sample t-test
##
## data: x and y
## t = -3.7671, df = 18.332, p-value = 0.001374
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -11.280194 -3.209684
## sample estimates:
## mean of x mean of y
## 17.14737 24.39231
boxplot(x, y, ylab = "Valores Numericos", xlab = "Grupos")
legend("bottomright", c("0.001374"))