Some data
set.seed(123)
x <- rnorm(100,0,5)
z <- 5 + 5*x - 0.5*x^2
pr <- exp(z) / ( 1 + exp(z)) ## inverse-logit
y <- rbinom(100, 1, pr)
df <- data.frame(y=y, x=x)
Logistic Regression
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## Call:
## glm(formula = y ~ poly(x, degree = 2, raw = TRUE), family = binomial,
## data = df)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.31828 -0.00093 0.00093 0.00639 1.95644
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.8998 2.3243 2.108 0.0350 *
## poly(x, degree = 2, raw = TRUE)1 4.0819 1.7397 2.346 0.0190 *
## poly(x, degree = 2, raw = TRUE)2 -0.4153 0.1796 -2.313 0.0207 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 135.372 on 99 degrees of freedom
## Residual deviance: 16.619 on 97 degrees of freedom
## AIC: 22.619
##
## Number of Fisher Scoring iterations: 10
Sensitivity Plots
library(plotmo)
## Loading required package: plotrix
## Loading required package: TeachingDemos
plotmo(quad.logit, type="response") #prob

plotmo(quad.logit, type="link") #log-odds
