Skip to content
Prev 299401 / 398503 Next

Plotting the probability curve from a logit model with 10 predictors

Try the following:

 library(TeachingDemos)
 ?TkPredict
      fit.glm1 <- glm( Species=='virginica' ~ Sepal.Width+Sepal.Length,
              data=iris, family=binomial)
       TkPredict(fit.glm1)

(you may need to install the TeachingDemos package first if you don't
already have it installed)

You will now see a plot that shows the predicted probability compared
to one of the predictor variables, there are controls that you can
then change which variable is shown on the x axis and what the value
of the other variables are.  Play with the controls to see the effects
of the different variables.  You can now do the same thing with other
logistic regression models.  This also works to show nonlinear
(polynomial, spline, etc.) fits of the variables and interactions.
There is a button that you can click that will show the command to
create the same plot in regular R graphics, and you can then use that
command (and change add=TRUE to overlay multiple ones) to create a
static plot showing the relationship.
On Fri, Jul 6, 2012 at 2:30 PM, Abraham Mathew <abmathewks at gmail.com> wrote: