# Logistic regression in R: Handling mixed numerical and categorical variables

I'm attempting to fit a logistic regression model in R and need some guidance on handling both numerical and categorical variables simultaneously, especially when looking for significant explanatory variables.

Background

I have a dataset named df containing 12 columns in R. My response variable, renewal, is binary with values indicating whether a customer renewed their insurance policy (1) or not (0). The other 11 variables are potential predictors. Among them, 4 are categorical: AccInsurance, ProdNumber, CompNumber, and LivingForm. I converted these categorical variables into factors using the following R code:

df$$AccInsurance <- as.factor(df$$AccInsurance)
df$$ProdNumber <- as.factor(df$$ProdNumber)
df$$CompNumber <- as.factor(df$$CompNumber)
df$$LivingForm <- as.factor(df$$LivingForm).


I'm seeking to determine the significance of each explanatory variable in predicting the renewal outcome.

Challenges

Significance Testing: I proceeded to fit a logistic regression model using the following code:

logit_model <- glm(renewal ~., data = df, family = binomial)


However, upon looking at the summary output, I noticed coefficients for individual categories within categorical variables (e.g., ProdNumber50, ProdNumber51, etc.), rather than the overall significance of the categorical variable itself. What can I do in order to see the overall significance of the categorical variable? I want to do this analysis in order to know of I should keep all the explanatory variables or remove some that are not statistically significant.

Is my approach using drop1(logit_model, test = "Chisq") or Anova(logit_model, type = "II") to do this appropriate for assessing the significance of explanatory variables, or is there a better method?

The summary

summary(logit_model)

Call:
glm(formula = renewal ~ ., family = binomial,
data = df)

Coefficients: (1 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
(Intercept)       -3.588e-02  1.629e-02  -2.203  0.02760 *
System            -7.961e-03  5.833e-02  -0.136  0.89144
ProdNumber50       7.599e-02  8.896e-03   8.543  < 2e-16 ***
ProdNumber51       1.741e-01  3.583e-02   4.859 1.18e-06 ***
ProdNumber52       1.902e-01  2.321e-02   8.195 2.51e-16 ***
ProdNumber53       2.664e-01  2.697e-02   9.875  < 2e-16 ***
CompNumber        -2.713e-03  4.449e-04  -6.099 1.07e-09 ***
AccInsurance1      3.769e-02  1.204e-02   3.130  0.00175 **
AccInsurance2      2.736e-01  2.604e-02  10.507  < 2e-16 ***
AccInsurance3      4.065e-01  8.223e-03  49.436  < 2e-16 ***
LivingForm             NA         NA      NA       NA
Duration           8.050e-02  9.783e-04  82.285  < 2e-16 ***
NoCars            -8.314e-04  3.769e-04  -2.206  0.02740 *
VAge               5.461e-03  4.177e-04  13.075  < 2e-16 ***
OAge               1.311e-03  7.063e-05  18.565  < 2e-16 ***
Moment             2.497e-01  4.009e-03  62.280  < 2e-16 ***
YrPremium.        -2.635e-05  1.404e-06 -18.771  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 646530  on 590043  degrees of freedom
Residual deviance: 623236  on 590028  degrees of freedom
AIC: 623268

Number of Fisher Scoring iterations: 4


Conclusion

In summary, I seek clarification on if my method for assessing the significance of explanatory variables in logistic regression is correct. Any insights or alternative approaches would be greatly appreciated. Thank you.