Skip to content

FEA add Tweedie log likelihood - #8281

Closed
lorentzenchr wants to merge 2 commits into
statsmodels:mainfrom
lorentzenchr:tweedie
Closed

lorentzenchr wants to merge 2 commits into
statsmodels:mainfrom
lorentzenchr:tweedie

Conversation

@lorentzenchr

Copy link
Copy Markdown
Contributor

This PR adds the Tweedie log-likelihood for 1 < p < 2 to the Tweedie familiy class.

@pep8speaks

pep8speaks commented May 16, 2022 •

Copy link
Copy Markdown

Hello @lorentzenchr! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-05-16 10:21:19 UTC

@josef-pkt josef-pkt added this to the 0.14 milestone Nov 30, 2022
@josef-pkt josef-pkt mentioned this pull request Nov 30, 2022
16 of 20 tasks
)

if not self.eql:
if p < 1 or p > 2:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this apply to both methods? i.e. be before if not self.eql:

@josef-pkt

Copy link
Copy Markdown
Member

@lorentzenchr Thanks for the PR

I'm trying to get this into 0.14 within the next few days.
I will check whether we can reuse some of our GLM unit tests for this. (e.g. checking consistency with current partial derivatives)

idx = endog > 0
if np.any(idx):
if not np.isscalar(endog):
endog = endog[idx]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this raises a broad casting error below,
ll_obs is full nobs length
This loglike is used by default in summary and raises exception.

I guess lin 1678 should be
ll_obs[idx] += np.log(1/endog * wb)

@josef-pkt josef-pkt added superseded Used for PRs with content that is superseded by a newer PR and removed prio-high labels Dec 5, 2022
@josef-pkt josef-pkt mentioned this pull request Dec 5, 2022
@josef-pkt

Copy link
Copy Markdown
Member

merged in #8560

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-genmod superseded Used for PRs with content that is superseded by a newer PR type-enh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants