データ解析基礎論A 06

ssize = c(24,25,26,23.5,25,27,24,22,27.5,28)
t.test(ssize, mu=24)

dat<-read.csv("http://www.matsuka.info/data_folder/datWA01.txt")
t.test(dat$h[dat$gender=="M"],mu=171)
t.test(dat$h[dat$gender=="F"],mu=158)

A=c(12,19,10,10,14,18,15,11,16)
B=c(15,20,16,14,17,16,12,12,19)
d=A-B
t.test(d, mu=0)

X1=c(78,70,66,76,78,76,88,76)
X2=c(76,72,60,72,70,72,84,70)
t.value=(mean(X1)-mean(X2))/sqrt((var(X1)+var(X2))/8)

t.test(X1,X2,var.equal=T)
t.test(X1,X2)

dat<-read.csv("http://www.matsuka.info/data_folder//mobH.csv")

###
may = dat$height[dat$mob=="may"]
dec = dat$height[dat$mob=="dec"]
dat3 = data.frame(height = c(may,dec),
 mob = c(rep('may',length(may)),rep('dec',length(dec))))
boxplot(height~mob, data=dat3,col=c('skyblue','orange'),
  ylab = "height", xlab ="mob")

spring = dat$height[dat$mob =="march"|
                    dat$mob =="April"|
                    dat$mob =="may"]
fall = dat$height[dat$mob =="sep"|
                  dat$mob =="oct"|
                  dat$mob =="nov"]
dat4 = data.frame(height = c(spring,fall),
 season = c(rep('spring',length(spring)), 
 rep('fall',length(fall))))
boxplot(height~season, data=dat4, col=c('skyblue','orange'),
  ylab = "height", xlab ="season")