User Tools

Site Tools


categorical_tests_in_linear_regression

m <- mean(mtcars$mpg)
m <- round(m,3)
leg.m <- paste("grand mean: ", m)
k <- tapply(mtcars$mpg, mtcars$am, mean)
k <- round(k,3)
leg.1 <- paste("auto,0: ", k[1])
leg.2 <- paste("manual,1: ", k[2])

plot(x=(mtcars$am), mtcars$mpg)
abline(h=mean(mtcars$mpg), lwd=3, col='red')
abline(h=k[1], lwd=3, col='green')
abline(h=k[2], lwd=3, col='blue')
text(x = .2, y = 18, leg.1)
text(x = .8, y = 25, leg.2)
text(x = .5, y = 21, leg.m)
categorical_tests_in_linear_regression.txt · Last modified: 2022/10/15 19:35 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki