install.packages(“rmarkdown”)
# set seed replace 12345678 with your student ID
seed = 78944924
# loads in data for the full population
pop<-read.csv("HW3.csv")
set.seed(seed + 25)
# assigns a random sample of 10 from the population to data
sample<-pop[sample(1:nrow(pop), 10, replace=FALSE),]
# creates data table for homework
sample
## A B
## 459 17 22
## 927 15 16
## 791 20 22
## 49 19 26
## 451 16 22
## 914 19 22
## 407 19 22
## 99 20 26
## 442 14 26
## 349 17 20
t.test(sample$B,sample$A,paired=TRUE)
##
## Paired t-test
##
## data: sample$B and sample$A
## t = 4.7579, df = 9, p-value = 0.001033
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 2.517823 7.082177
## sample estimates:
## mean difference
## 4.8