Negative value reponse in Poisson GLM

84 views
Skip to first unread message

Pranavchandra Vivekananda

unread,
Dec 23, 2024, 10:34:29 AM12/23/24
to pystatsmodels
Hi!

I am running a poisson GLM using statsmodels. I was wondering how I am ending up with negative response variable values with statsmodels if im using a log link function? Am i supposed to take the exponential values of my linear component? i.e e^(xT * β)

Thanks for building such an amazing and useful library!

josef...@gmail.com

unread,
Dec 23, 2024, 10:44:24 AM12/23/24
to pystat...@googlegroups.com
>  how I am ending up with negative response variable values with statsmodels

what exactly are you doing?

predict will have only positive values, i.e. it returns exp( x b) which will be > 0 except for maybe some degenerate cases when exp underflows.
There is an option in predict to return the linear predictor `x b` which will in general have negative values.

except for overflow and underflow in exp, it is a link that forces the predicted mean to be finite and strictly positive, which is the usual case.

This applies to both GLM with log link and count models that always use exp mean function, i.e. log link, like Poisson, negative binomial, and others in statsmodels discrete.

Josef


--
You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pystatsmodels/c7e7adb9-bc37-465a-bfdc-3b78676740d7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages