I'm utilizing the following code to plot each regressor in X_train
against the response variable won
using a logistic model from glm()
require(reshape2)
require(ggplot2)
regressors = melt(X_train[2:16], id.vars='won')
ggplot(regressors) +
geom_jitter(aes(value,won, colour=variable),) +
geom_smooth(aes(value,won, colour=variable), method="glm", method.args = list(family = "binomial")) +
facet_wrap(~variable, scales="free_x")
I thought the geom_smooth()
command would add the fitted logistic regression line to each plot, but I can't seem to get it to work. I also tried passing "data=X_train
" to the command as well. Any advice is appreciated, thank you.