# Paired t-test using a built-in dataset
#data() #look at all pre-loaded R datasets
rm(list = ls())
data(sleep) #Loads the sleep dataset in your environment
Copyright By PowCoder代写 加微信 powcoder
# Compute t-test
res <- t.test(extra ~ group, data = sleep, paired = TRUE)
#How is p-value obtained?
pvalue <- 2*pt(res$statistic,9)
#write.csv(sleep, "~/Documents/Courses/Stat453_558/sleep")
#Clean data (it keeps the loaded packages)
rm(list = ls())
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com