mtcars_Data <- read.csv("D:/College/Datasets_csv_files/a412dfbd88b3db70b74b-5f23f993cd87c283ce766e7ac6b329ee7cc2e1d1/mtcars.csv")

View(mtcars_Data)
attach(mtcars_Data)
names(mtcars_Data)
##  [1] "model" "mpg"   "cyl"   "disp"  "hp"    "drat"  "wt"    "qsec"  "vs"   
## [10] "am"    "gear"  "carb"
# Ho : mu <  20 + 95% confidence interval

t.test(mpg,mu=20,alt='two.sided',confint=0.95)
## 
##  One Sample t-test
## 
## data:  mpg
## t = 0.08506, df = 31, p-value = 0.9328
## alternative hypothesis: true mean is not equal to 20
## 95 percent confidence interval:
##  17.91768 22.26357
## sample estimates:
## mean of x 
##  20.09062
#
boxplot(mpg~am)

#assumption - non equal varience
t.test(mpg ~ am,mu=0,alt='two.sided',paired=FALSE,conf.level=0.95)
## 
##  Welch Two Sample t-test
## 
## data:  mpg by am
## t = -3.7671, df = 18.332, p-value = 0.001374
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -11.280194  -3.209684
## sample estimates:
## mean in group 0 mean in group 1 
##        17.14737        24.39231
t.test(mpg ~ am)
## 
##  Welch Two Sample t-test
## 
## data:  mpg by am
## t = -3.7671, df = 18.332, p-value = 0.001374
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -11.280194  -3.209684
## sample estimates:
## mean in group 0 mean in group 1 
##        17.14737        24.39231
t.test(mpg[am==0],mpg[am==1])
## 
##  Welch Two Sample t-test
## 
## data:  mpg[am == 0] and mpg[am == 1]
## 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