Bug or feature under development? offset parameter for the logit model

189 views
Skip to first unread message

Xingchen Xu

unread,
Apr 25, 2022, 7:31:14 PM4/25/22
to pystatsmodels
Hi everyone,

Currently I'm using statsmodel version 0.13.2. When I add the offset specification to the model following the instruction in , there will be no error/warning. 

However, the model will not take the offset variable into account at all. In other words, the following two specifications output the same result.

For data with columns [ 'y', 'x', 'offset' ] (assume the coefficient of offset is 1), we run:
log_reg = smf.logit("y ~ x", data=data).fit(disp=0)
log_reg = smf.logit("y ~ x", data=data, offset=data['offset']).fit(disp=0)

Besides, after checking the document of the current version of statsmodel, the logit model does not have the offset parameter at all.

So shall I use this parameter in a different way or is this is a bug or is this a new feature which hasn't been updated?

Best wishes,
Cedric


Message has been deleted

Xingchen Xu

unread,
Apr 25, 2022, 7:34:54 PM4/25/22
to pystatsmodels
The instruction is in https://www.statsmodels.org/dev/generated/statsmodels.discrete.discrete_model.Logit.html

But the offset specification of the glm model with binomial family works.

josef...@gmail.com

unread,
Apr 25, 2022, 7:37:49 PM4/25/22
to pystatsmodels
Use GLM with family Binomial for now. It has Logit as the default special case.
and it had offset for a long time.

IIRC, the two related changes will be in 0.14. They are in master, but didn't make it into 0.13:

Most models now warn if there is an unused kwarg when creating a model instance.
Offset has been added to Logit and Probit,



--
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 on the web visit https://groups.google.com/d/msgid/pystatsmodels/93ea7a9a-ff30-4caa-8e53-8b0a4e690104n%40googlegroups.com.

Xingchen Xu

unread,
Apr 25, 2022, 8:25:22 PM4/25/22
to pystatsmodels
Thank you so much:)
Reply all
Reply to author
Forward
0 new messages