I would like to test the significance of a binary factor cropBin on a binary variables scaleBin.

Here is the data :

structure(list(cropBin = c(1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 
1, 0, 1, 1), scaleBin = c(1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 
0, 1, 0, 0)), row.names = c(NA, -16L), class = "data.frame", .Names = c("cropBin", 

When I run a glm (binomial) on the data :

summary(glm(data = test, cropBin ~ scaleBin, family = binomial))

The p-value of assocated with scaleBin is 0.996

When I run a fisher.test on the same data :

fisher.test(test$scaleBin, test$cropBin) 

The pvalue is 0.006993.

I know this question may seem very broad but why am I getting such different outputs in terms of significance?

  • $\begingroup$ The large standard errors suggest complete or quasi-complete separation (which you can actually can see with table(test)) and there's perfect negative dependence between the intercept and the predictor (put your glm fit into vcov, though the opposite sign and near equality of magnitude of the intercept and coefficient is a bit of a giveaway). Try some searches on complete separation and quasi-complete separation. Note that the 2x2 chi-square statistic has a p-value not so very far from the Fisher test. $\endgroup$ – Glen_b Jul 23 '19 at 3:11

Notice that in your dataset scaleBin=0 necesairly gives cropBin=1. This results with large uncertainity of parameter estimation in GLM. See how large standard error is there.

To play with those data, change one last cropBin from 1 to 0 and see what happens.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.