dane <- read.table("http://ls.home.amu.edu.pl/data_sets/kontekst.txt") View(dane) colnames(dane) <- c("number", "context") dane$context <- as.factor(dane$context) aggregate(dane$number, list(CONTEXT = dane$context), FUN = mean) boxplot(number ~ context, data = dane, xlab = "Kontekst", ylab = "Words number") summary(aov(number ~ context, data = dane)) rests <- lm(number ~ context, data = dane)$residuals shapiro.test(rests)$p.value qqnorm(rests) qqline(rests) bartlett.test(number ~ context, data = dane)$p.value fligner.test(number ~ context, data = dane)$p.value library(car) leveneTest(number ~ context, data = dane)[[3]][1] leveneTest(number ~ context, data = dane, center = "mean")[[3]][1] attach(dane) pairwise.t.test(number, context, data = dane) boxplot(number ~ context, data = dane, xlab = "Kontekst", ylab = "Words number") model_aov <- aov(number ~ context, data = dane) TukeyHSD(model_aov)$context plot(TukeyHSD(model_aov)) library(agricolae) install.packages("agricolae") library(agricolae) HSD.test(model_aov, "context", console = TRUE) SNK.test(model_aov, "context", console = TRUE) LSD.test(model_aov, "context", p.adj = "holm", console = TRUE) scheffe.test(model_aov, "context", console = TRUE) C1 <- c(-3, 2, 2, -3, 2) C2 <- c(0, -1, -1, 0, 2) C3 <- c(0, 1, -1, 0, 0) C4 <- c(1, 0, 0, -1, 0) con <- cbind(C1, C2, C3, C4) contrasts(dane$context) <- con model_aov_2 <- aov(number ~ context, data = dane) summary(model_aov_2, split = list(context = list('C1' = 1, 'C2' = 2, 'C3' = 3, 'C4' = 4))) dane <- read.table("http://ls.home.amu.edu.pl/data_sets/eysenck.txt") dane <- read.table("http://ls.home.amu.edu.pl/data_sets/eysenck.txt") View(dane) colnames(dane) <- c("result", "instruction") dane <- read.table("http://ls.home.amu.edu.pl/data_sets/Eysenck.txt", header = TRUE) dane$Nr <- NULL dane$context <- as.factor(dane$context) dane$Instrukcja <- as.factor(dane$Instrukcja) aggregate(dane$Wynik, list(CONTEXT = dane$Instrukcja), FUN = mean) boxplot(number ~ context, data = dane, xlab = "Instrukcja", ylab = "Wynik") boxplot(Wynik ~ Instrukcja, data = dane, xlab = "Instrukcja", ylab = "Wynik") summary(aov(Wynik ~ Instrukcja, data = dane)) rests <- lm(Wynik ~ Instrukcja, data = dane)$residuals shapiro.test(rests)$p.value qqnorm(rests) qqline(rests) bartlett.test(Wynik ~ Instrukcja, data = dane)$p.value fligner.test(Wynik ~ Instrukcja, data = dane)$p.value leveneTest(Wynik ~ Instrukcja, data = dane)[[3]][1] leveneTest(Wynik ~ Instrukcja, data = dane, center = "mean")[[3]][1] attach(dane) pairwise.t.test(Wynik, Instrukcja, data = dane) model_aov <- aov(Wynik ~ Instrukcja, data = dane) TukeyHSD(model_aov)$Instrukcja plot(TukeyHSD(model_aov)) HSD.test(model_aov, "Instrukcja", console = TRUE) SNK.test(model_aov, "Instrukcja", console = TRUE) LSD.test(model_aov, "Instrukcja", p.adj = "holm", console = TRUE) scheffe.test(model_aov, "Instrukcja", console = TRUE) C1 <- c(0, 1, -1, 1, -1) C2 <- c(4, -1, -1, -1, -1) C3 <- c(0, 1, 0, -1, 0) C4 <- c(0, 0, -1, 0, 1) con <- cbind(C1, C2, C3, C4) contrasts(dane$Instrukcja) <- con View(con) model_aov_2 <- aov(Wynik ~ Instrukcja, data = dane) View(model_aov_2) summary(model_aov_2, split = list(Instrukcja = list('C1' = 1, 'C2' = 2, 'C3' = 3, 'C4' = 4))) boxplot(Wynik ~ Instrukcja, data = dane, xlab = "Instrukcja", ylab = "Wynik") contrasts(dane$Instrukcja) <- con c <- contrasts(dane$Instrukcja) <- con View(c) View(dane) contrasts(dane$Instrukcja) <- con contrasts(dane$Instrukcja) View(dane)