lungdata <- read.csv(file = 'A:/R files/lungcapdata.csv')
View(lungdata)
attach(lungdata)
names(lungdata)
## [1] "LungCap"   "Age"       "Height"    "Smoke"     "Gender"    "Caesarean"
# Ho : mu <  8 + 95% confidence interval

t.test(LungCap,mu = 8, alt = 'less', conf.level = 0.95)
## 
##  One Sample t-test
## 
## data:  LungCap
## t = -1.3842, df = 724, p-value = 0.08336
## alternative hypothesis: true mean is less than 8
## 95 percent confidence interval:
##      -Inf 8.025974
## sample estimates:
## mean of x 
##  7.863148
#
t.test(LungCap, mu = 8, alt = 'two.sided', confint = 0.95)
## 
##  One Sample t-test
## 
## data:  LungCap
## t = -1.3842, df = 724, p-value = 0.1667
## alternative hypothesis: true mean is not equal to 8
## 95 percent confidence interval:
##  7.669052 8.057243
## sample estimates:
## mean of x 
##  7.863148
#
t.test(LungCap, mu = 8, alt = 'two.sided', confint = 0.90)
## 
##  One Sample t-test
## 
## data:  LungCap
## t = -1.3842, df = 724, p-value = 0.1667
## alternative hypothesis: true mean is not equal to 8
## 95 percent confidence interval:
##  7.669052 8.057243
## sample estimates:
## mean of x 
##  7.863148
boxplot(LungCap~Smoke)

#Ho : mean of smokers = non smokers
#assumption - non equal varience
t.test(LungCap ~ Smoke, mu = 0, alt = 'two.sided', paired = FALSE, conf.level = 0.95)
## 
##  Welch Two Sample t-test
## 
## data:  LungCap by Smoke
## t = -3.6498, df = 117.72, p-value = 0.0003927
## alternative hypothesis: true difference in means between group no and group yes is not equal to 0
## 95 percent confidence interval:
##  -1.3501778 -0.4003548
## sample estimates:
##  mean in group no mean in group yes 
##          7.770188          8.645455
t.test(LungCap ~ Smoke)
## 
##  Welch Two Sample t-test
## 
## data:  LungCap by Smoke
## t = -3.6498, df = 117.72, p-value = 0.0003927
## alternative hypothesis: true difference in means between group no and group yes is not equal to 0
## 95 percent confidence interval:
##  -1.3501778 -0.4003548
## sample estimates:
##  mean in group no mean in group yes 
##          7.770188          8.645455
t.test(LungCap[Smoke == 'no'], LungCap[Smoke == 'yes'])
## 
##  Welch Two Sample t-test
## 
## data:  LungCap[Smoke == "no"] and LungCap[Smoke == "yes"]
## t = -3.6498, df = 117.72, p-value = 0.0003927
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.3501778 -0.4003548
## sample estimates:
## mean of x mean of y 
##  7.770188  8.645455