My linear model is trying to predict the amount gambled based on the variables sex, income, verbal, and status. Sex is a binary variable that is "Male" or "Female" (they are factors), while the rest are all numeric.
lm3 <- lm(gamble ~ sex + status + income + verbal, data=teengamb)
That is my linear model. I'm having trouble predicting the function for a male with mean status, income, and verbal:
newdata <- c(as.factor("Male"), mean(teengamb$status), mean(teengamb$income), mean(teengamb$verbal))
newdata <- data.frame(newdata)
predict(lm3, newdata)
I'm not sure how to go about doing this.
Note that the way I converted it to Male and Female is:
However, I have converted the 0=male, 1=female to "Male" and "Female."
teengamb$sex[teengamb$sex==0] <- "Male"
teengamb$sex[teengamb$sex==1] <- "Female"
teengamb$sex <- as.factor(teengamb$sex)
predict? - David Robinson