First of all, I should say that I've just started to learn most of the terms I'll use in my question. Therefore I am sorry for any inconvenience I cause.
I have a dataset with 2000 instances. The dependent variable is a binary variable (either 0 or 1) and I have 3 independent varibles where one of them is categorical (Male or Female) and other two are continious (between 0 and 1). Here i a couple of examples:
Gender Freq_A Freq_B Labels 1 Female 5.842289e-03 9.090465e-03 0 2 Male 3.180251e-03 4.009848e-03 1 3 Male 2.060638e-05 2.365917e-04 0 4 Male 1.930360e-02 3.868656e-03 0 5 Female 2.551375e-03 1.110913e-02 0 6 Female 3.564216e-02 3.755856e-02 1
I first apply logistic regression. However, the McFadden R2 I obtained was too small (6 e-3)
llh llhNull G2 McFadden r2ML r2CU -1.230380e+03 -1.239047e+03 1.733430e+01 6.995017e-03 9.583948e-03 1.281971e-02
Then, it has been told that maybe Poisson Regression might be a better fit for my case. However, all of the resources I read about Poisson regression was saying that it is a regression model best for explaning counting data. But then I found that it can also be used for binary outcome. (Source: Poisson regression for binary outcomes , link) So, I decided to apply it in my data as follows:
mydata1 <- read.csv(fname) mydata <- mydata1[sample(nrow(mydata1)),] train <- mydata[1:1800,] test <- mydata[1801:2000,] model <- glm(Labels ~ Gender + Freq_A + Freq_B,family=poisson(link='logit'),data=train)
When I do that, I get error saying:
Error in family$linkfun(mustart) : Value 1.1 out of range (0, 1)
This error disappears if I don't use
logit as a
link function however I think I should use it because my output variable is binary.
So basically, I am wondering what I am doing wrong and is it possible to apply poisson regression for binary outcome data in R ?