[R] As.Factor with Logistic Regression

Frank E Harrell Jr f.harrell at vanderbilt.edu
Thu Jun 22 17:05:05 CEST 2006

Justin Rapp wrote:
> I am modeling the probability of player succeeding in the NFL with a
> binomial logistic regression with 1 signifying success and 0
> signifying no success.   I performed the regression of the binomial
> variable against overall draft position using the college conference
> for which each player played as a factor using the
> as.factor(Conference) command.
> My question is:
> How do I plot specific factors against the curve for the entire set.
> There are only a few factors that have significant coefficients and I
> would like to plot those against the logistic curve for the entire
> set.
> Any help would be greatly appreciated.

It will bias the analysis to omit insignificant factors.

To get the plots you want:

library(Hmisc); library(Design)
dd <- datadist(mydata); options(datadist='dd')
f <- lrm(y ~ x1+x2+....)
plot(f, x1=NA, fun=plogis)
plot(f, x2=NA, fun=plogis)
plot(f, fun=plogis) # plot partial effects of all predictors, 
probability scale

Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

More information about the R-help mailing list