11
$\begingroup$

In case of a linear regression, it's easy to test a linear relationship between a continuous dependent variable and each independent variable. For example, I can plot a scatter plot between the dependent variable on Y-axis and one of independent variables on X-axis to visualize the relationship before using the linear regression.

But, a logistic regression is different, it assumes a linear relationship between log odds of a binary dependent variable and independent variables. I want to test this assumption to determine if the logistic regression is appropriate for my dataset. Can I test it? and How?

Besides, is there any package in R to do the task?

$\endgroup$
1
  • $\begingroup$ In terms of packages in R, have a look at the gam() function of package mgcv which allows for non-linearity using smoothing splines. Then you can plot the resulting model using plot() to view that non-linearity on the log.odds scale $\endgroup$
    – Lachlan
    Jul 3, 2021 at 6:43

1 Answer 1

1
$\begingroup$

Nice question. In practice, very few people pretest this assumption, or test it at all. To do so you could divide each independent variable (X) into perhaps 8 or 10 or 15 equal-interval categories. Then compute log-odds as ln(p/[1-p]) within each category, where p = the proportion of cases for which the dependent variable = 1 rather than 0. Finally, use ANOVA or, informally, view a scatterplot to assess the linearity of the relationship between log-odds and this X.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.