Я делаю бинарную линейную регрессию с полом и ростом. Для функции очков нет указания пола. Казалось бы, по умолчанию R распознает свой пол по x-координате.
library("MASS") #data
survey #data
surveyNA <- survey[complete.cases(survey),]
surveyNA
plot(surveyNA$Height~surveyNA$Sex, xlab="Gender", ylab = "Height (cm)")
points(surveyNA$Height~as.numeric(surveyNA$Sex),cex=0.5)
means.sex <- tapply(surveyNA$Height, INDEX = surveyNA$Sex, FUN = mean, na.rm = TRUE)
means.sex
points(1:2,means.sex,pch =5, cex = 2)
#How does the points function know its sex variable for the x-coordinate?
survfit2 <- lm(Height~Sex,data=surveyNA)
summary(survfit2)