Hello R community,
I have a question about the logistic regression function.
Specifically, when the predictor variable has not just 0's and 1's,
but also fractional values (between zero and one). I get a warning
when I use the "glm(formula = ... , family = binomial(link =
"logit"))" which says:
"In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!"
I looked this up on a few forums and got the impression that I could
go ahead and ignore this warning. If that is not so, please suggest
another function that can be used (and no need to read further).
But if this is usable, then the numbers are not making sense for me.
What I am seeing is best explained through an example:
#Setting up the data:
c(1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1)->resp
indep<-rep(2:3,10)
#Running the logistic regression:
glm(formula = resp~as.factor(indep) , family = binomial(link = "logit"),na.action = na.pass)
#Gives me:
Coefficients:
(Intercept) as.factor(indep)3
-1.692e-16 -4.055e-01
resp
indep 0 1
2 5 5
3 6 4
Meaning that the odds for '2' to have a favorable outcome are 5/5 =1;
and the odds for 3 are 4/6 = 0.6666
And indeed, exp( -1.692e-16) = 1 and exp( -1.692e-16+-4.055e-01) = 0.66.
But when I change all the 1's of the independent variable to 0.5, the
odds should both be half of what they were before (right?).