Hi All,
I'm fitting a logistic regression and I summed up the deviance and used a chi-square distribution to test over-dispersion with this code below:
2 Questions:
Q1: I'm getting a p-value < 0.05, so does this mean overdispersion id detected?
Q2: How does it impact my model coefficient? What should be my next step?
Thank you so much and have a wonderful day!
All the best,
Kathy
P.S. Here is the R code:
p_hat = predict(model_obj,newdata = model_obj$model, type = "response")
D = -2 * sum(p_hat * log(p_hat/(1-p_hat))+log(1-p_hat))
chi_sq_n = nrow(model_obj$model)
chi_sq_p = length(strsplit(Reduce(paste, deparse(model_obj$formula)), "[~+ ]+")[[1]])-1
chi_sq_df = chi_sq_n - chi_sq_p
chi_sq_pval = pchisq(D, df = chi_sq_df)
Where model_obj is a logistic regression object.