You are on page 1of 1

#one sample t-test

MPG=read.csv(file.choose(), header=T) #read UltraGreenCarmpg.csv


attach(MPG)

sd(mpg)
qt(0.05, 24)
100+(qt(0.05,24)*sd(mpg))/5

#compute the test statistic value in normalised form


t.obs = (mean(mpg)-100)/(sd(mpg)/sqrt(25))

#using t.test
Conclusion=t.test(mpg,y=NULL,alternative="less",mu=100, paired=F,var.equal=F,
conf.level=0.95)
Conclusion

#p-value computation directly


pt(t.obs, 24)

You might also like