I am trying to replicate the method in section 3a of this paper where, for a logistic regression model, they plot the functional relationship between a continuous variable and the odds for developing the outcome (using a smoothing spline).
I was wondering how do you replicate this from an R glm
model, as example:
x <- c( 0,1,2,2,2,3,4,5,5,6,6,6,7,8,10 )
y <- c( 0,0,0,0,0,0,1,0,1,0,1,1,0,1,1 )
m <- glm( y ~ x , family = "binomial" )
summary(m)
Call:
glm(formula = y ~ x, family = "binomial")
Deviance Residuals:
Min 1Q Median 3Q Max
-1.6671 -0.5085 -0.3056 0.7814 1.6066
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.7311 1.9556 -1.908 0.0564 .
x 0.6906 0.3611 1.912 0.0559 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 20.19 on 14 degrees of freedom
Residual deviance: 13.47 on 13 degrees of freedom
AIC: 17.47
Number of Fisher Scoring iterations: 5
how can I extract the OR for each single value in order to replicate the example? Is the m$effect
or what other parameter? I know how to plot predicted values, like this, but this is a different question
glm
is rather uninteresting: It's a horizontal straight line. $\endgroup$