I’m trying to run a logit model and plot the probability curve for a number of the important predictors. I’m trying to do this
with the Effects package.
df=data.frame(income=c(5,5,3,3,6,5),
won=c(0,0,1,1,1,0),
age=c(18,18,23,50,19,39),
home=c(0,0,1,0,0,1))
str(df)
md1 = glm(factor(won) ~ income + age + home,
data=df, family=binomial(link="logit"))
summary(md1)
plot(effect("income", md1), grid=TRUE)
But I want to know how to plot a graph so that it shows the probability of won (response) based on income (or any of the other predictors).
However, what I want to do is generate the same plot, with won on the y axis and income on x axis, but the curves showing the probabilities for age and home (in separate plots).
Not seeing how to do this in the effects documentation. Help!
Thanks.
If I understand you correctly, you’ll need to introduce an interaction term into the model. For example,
Will show you the effect of income on won at different values of age.