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?

**Answer**

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.

**Attribution***Source : Link , Question Author : Cha.Po , Answer Author : rolando2*