Документ взят из кэша поисковой машины. Адрес оригинального документа : http://herba.msu.ru/shipunov/school/biol_240/20160330.r
Дата изменения: Wed Mar 30 22:05:21 2016
Дата индексирования: Sun Apr 10 07:29:03 2016
Кодировка:
getwd()
exam1 <- c(63, 72, 77, 76, 67, 56, 55, 51, 77, 64)
exam2 <- c(87, 86, 76, 79, 54, 60, 97, 80, 73, 97)
Normality <- function(x, p=.05)
{
ifelse(shapiro.test(x)$p.value > p,"NORMAL", "NOT NORMAL")
}
Normality(exam1)
Normality(exam2)
t.test(exam1, exam2, paired=T, alt="less")
mean(exam1); mean(exam2) # is not enough to show difference

# install.packages("effsize")
library(effsize)

cohen.d(exam1, exam2)
cliff.delta(exam1, exam2)

a <- 1:9
b <- rep(5, 9)
cliff.delta(a, b)

boxplot(extra ~ group, data=sleep)
t.test(extra ~ group, data=sleep)
cohen.d(extra ~ group, data=sleep)

bb <- c(rep("boy", 6), rep("girl", 7))
table(bb)
mosaicplot(table(bb))

with(airquality, table(cut(Temp, quantile(Temp)), Month))
mosaicplot(with(airquality, table(cut(Temp, quantile(Temp)), Month)))

Titanic
ftable(Titanic, row.vars=1:3)
mosaicplot(Titanic)
margin.table(Titanic, c(1,4))
mosaicplot(margin.table(Titanic, c(1,4)))

chisq.test(table(bb))
chisq.test(margin.table(Titanic, c(1,4)))

margin.table(HairEyeColor, 1:2)
chisq.test(margin.table(HairEyeColor, 1:2))
mosaicplot(margin.table(HairEyeColor, 1:2))
assocplot(margin.table(HairEyeColor, 1:2))

margin.table(HairEyeColor, c(1,3))
chisq.test(margin.table(HairEyeColor, c(1,3)))
assocplot(margin.table(HairEyeColor, c(1,3)))

margin.table(HairEyeColor, 2:3)
chisq.test(margin.table(HairEyeColor, 2:3))
assocplot(margin.table(HairEyeColor, 2:3))