I am trying to look at how the likelihood of event X occurring is affected by three factors A (5 levels), B (2 levels) and C (3 levels). To do this I have run a binomial glm followed by a type 3 ANOVA to determine the significance of each of the terms in the model as follows:
type3.Li.Full <- list(A = contr.sum, B = contr.sum, C = contr.sum)
model.lik<-glm(X ~ A*B*C, family = binomial (link = "logit"), data = likelihood, contrasts = type3.Li.Full, method = brglmFit)
summary(model.lik)
Call:
glm(formula = X ~ A * B * C,
family = binomial(link = "logit"), data = likelihood, method = brglmFit,
contrasts = type3.Li.Full)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.2534 -1.0731 0.5415 0.9738 1.6651
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.54796 0.16566 3.308 0.000940 ***
A1 0.64720 0.34125 1.897 0.057886 .
A2 0.70109 0.29486 2.378 0.017420 *
A3 0.75656 0.35739 2.117 0.034267 *
A4 -0.33962 0.21995 -1.544 0.122572
B1 0.38930 0.16566 2.350 0.018771 *
C1 0.62192 0.16566 3.754 0.000174 ***
A1:B1 0.18165 0.34125 0.532 0.594520
A2:B1 -0.58628 0.29486 -1.988 0.046771 *
A3:B1 0.39197 0.35739 1.097 0.272747
A4:B1 -0.09776 0.21995 -0.444 0.656725
A1:C1 0.12427 0.34125 0.364 0.715740
A2:C1 0.11557 0.29486 0.392 0.695086
A3:C1 0.04053 0.35739 0.113 0.909714
A4:C1 -0.70748 0.21995 -3.216 0.001298 **
B1:C1 -0.13459 0.16566 -0.812 0.416535
A1:B1:C1 -0.53189 0.34125 -1.559 0.119081
A2:B1:C1 -0.13863 0.29486 -0.470 0.638249
A3:B1:C1 0.82033 0.35739 2.295 0.021713 *
A4:B1:C1 0.38356 0.21995 1.744 0.081193 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 583.11 on 435 degrees of freedom
Residual deviance: 486.65 on 416 degrees of freedom
AIC: 526.65
Type of estimator: AS_mixed (mixed bias-reducing adjusted score equations)
Number of Fisher Scoring iterations: 7
library(car)
Anova(model.lik, type = 3)
Analysis of Deviance Table (Type III tests)
Response: X
LR Chisq Df Pr(>Chisq)
A 44.904 4 4.164e-09 ***
B 5.810 1 0.015939 *
C 20.969 1 4.667e-06 ***
A:B 6.359 4 0.173862
A:C 13.550 4 0.008877 **
B:C -2.479 1 1.000000
A:B:C 13.371 4 0.009597 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
According to the output of the ANOVA table the chi-squared value for the interaction between B and C is negative however, I was under the impression that chi-squared values should be positive. As a result, would anyone be able to explain why this error may have occurred?
Is this as a result of my use of a penalized maximum likelihood (method = brglmFit). This was used because complete separation was detected in my original model as follows (I believe if any of the values are infinity this indicates the presence of complete separation):
model.lik.orig<-glm(X ~ A*B*C, family = binomial (link = "logit"), data = likelihood, contrasts = type3.Li.Full)
library("detectseparation")
update(model.lik.orig, method = "detect_separation")
Implementation: ROI | Solver: lpsolve
Separation: TRUE
Existence of maximum likelihood estimates
(Intercept) A1
-Inf Inf
A2 A3
Inf Inf
A4 B1
Inf Inf
C1 A1:B1
Inf -Inf
A2:B1 A3:B1
-Inf -Inf
A4:B1 A1:C1
-Inf -Inf
A2:C1 A3:C1
-Inf -Inf
A4:C1 B1:C1
-Inf -Inf
A1:B1:C1 A2:B1:C1
Inf Inf
A3:B1:C1 A4:B1:C1
Inf Inf
0: finite value, Inf: infinity, -Inf: -infinity
method = brglmFit
which uses penalized maximum likelihood to do the estimation? $\endgroup$