You most likely have a problem with complete or quasi-complete separation: for some combination of your predictors you observed only successes of failures. That is a quite common phenomenon for logistic regression in small samples or if you have large parameter spaces.
There are several implementations that add a small penalty to the likelihood in order to get estimates for all parameters. Look up Firth logistic regression. In R that can be handled by the logistf()
function from the logistf
package.
Replace
glm(factor(data$B) ~ value,family="binomial", data = .)
in your code with
logistf(factor(data$B) ~ value, data = .)
and you should be up and running. (Remember to load the package first).
It should be noted that separation is not necessarily a problem in and of itself. Only if you want parameter estimates.
You can actually see the separation problem if you tabulate B
against G
:
xtabs(~ B + G, data=data)
This produces
G B k r s u f 9 6 0 0 m 0 0 9 9
So you can see that if you know, say, G
then you know the outcome of B
.