0
$\begingroup$

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 ?

$\endgroup$
1
$\begingroup$

1) Poisson regression is for Poisson outcomes, not for binary outcomes, so using Poisson regression for this is a bad idea indeed.

2) The logit link is for binary outcomes and probabilities, it won't work for Poisson regression.

3) McFadden R^2 is about predictive power, not about whether the model is appropriate. The value is low indeed, which indicates that you can't predict your binary variables well from your explanatory variables. It might be that another model would do a better job (there are other link functions for binary data, such as probit, and there are loads of supervised classification methods such as nearest neighbours with a suitable distance that could in principle be tried). However it might also be (and is often the case in practice in my experience) that your explanatory variables just don't carry much information about your dependent variable, in which case whatever you do will lead to a bad prediction quality. You might want to look at plots (or suitable tables) of your explanatory variables against your labels to assess how much hope there is to find something good.

$\endgroup$

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.