effect of a continuous variable in a logistic regression


I created a logistic regression and one fo the explanatory variables is age in a continuous format. I wonder if I could examine the effect of this variable along the range 18 - 90. I would like to know whether there is any 'jump'. Do you have any advice?

Many thanks,


See my post using the CHD dataset, which contains the binary outcome of coronary heart disease detected against age cohort, using the continuous variable age binned into age groups.

I suggest using a generalized additive model to plot the smooths for the predictor (similar to geom_smooth()). For example:

#> Loading required package: nlme
#> This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.


mod <- gam(Class ~ s(A) + s(B), data = two_class_dat, family = binomial)

# The `trans` argument puts them back on the probability scale

plot(mod, trans = function(x) binomial()$linkinv(x), pages = 1)

Created on 2021-01-20 by the reprex package (v0.3.0)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.