setwd("C:/Users/Shreyas Jadhav/Downloads")
titanic <- read.csv(paste("Titanic Data.csv",sep="."))
View(titanic)
titanic$Survived = factor(titanic$Survived, levels = c(0,1), labels = c("Not Survived","Survived"))
aggregate(Age ~ Survived, data= titanic,mean)
## Survived Age
## 1 Not Survived 30.41530
## 2 Survived 28.42382
log.transformed.Age=log(titanic$Age)
t.test(log.transformed.Age ~ titanic$Survived,var.equal=TRUE)
##
## Two Sample t-test
##
## data: log.transformed.Age by titanic$Survived
## t = 3.844, df = 887, p-value = 0.0001297
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.09102778 0.28094770
## sample estimates:
## mean in group Not Survived mean in group Survived
## 3.304318 3.118330
Null Hypothesis: “There is no significant difference in the average age of the survivors and the average age of the people who died.”
Alternative Hypothesis: “There is a significant difference in the average age of the survivors and the average age of the people who died.”