I am trying to run the logistic regression without an intercept. Firstly, I tried the function glm
but I got the following error:
Warning message:
glm.fit: fitted probabilities numerically 0 or 1 occurred
Since it was not possible to change the data set at all given the nature of my work, I decided to use a different R program package which had the code bayesglm
.
When I use this function including the intercept, I get no error message as above. However, when I exclude the intercept by adding -1
at the end of my function I still get the same error above with the following output:
> regress=bayesglm(y~x1*x2+x3+x4-1, data = DATA, family=binomial(link="logit"))
> summary(regress)
Call:
bayesglm(formula = y ~ x1 * x2 + x3 + x4 - 1, family = binomial(link = "logit"),
data = DATA, maxit = 10000)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.01451 -0.43143 -0.22778 -0.05431 2.89066
Coefficients:
Estimate Std. Error z value Pr(>|z|)
x1 -20.45537 9.70594 -2.108 0.03507 *
x2 -7.04844 2.87415 -2.452 0.01419 *
x1:x2 0.13409 17.57010 0.008 0.99391
x3 -0.17779 0.06377 -2.788 0.00531 **
x4 -0.02593 0.05313 -0.488 0.62548
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 494.91 on 357 degrees of freedom
Residual deviance: 124.93 on 352 degrees of freedom
(165 observations deleted due to missingness)
AIC: 134.93
Number of Fisher Scoring iterations: 123
and get the same error as below:
Warning message:
glm.fit: fitted probabilities numerically 0 or 1 occurred
which I do not get if I do not add -1
to remove the intercept.
Therefore, I have two questions to ask:
1. Is it possible for me to ignore this warning message?
2. Otherwise, may I know how I can fix the problem according to this warning message?