Skip to content

Glm c log - #8153

Closed
gmcmacran wants to merge 8 commits into
statsmodels:mainfrom
gmcmacran:glmCLog
Closed

gmcmacran wants to merge 8 commits into
statsmodels:mainfrom
gmcmacran:glmCLog

Conversation

@gmcmacran

Copy link
Copy Markdown
Contributor
  • closes #xxxx
  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.
Details

Please don't merge this pull request. I am making it to check style of code and execute tests. This branch will be rebased after tests and code style passes.

This code adds the log complement link the binomial family for the generalized linear model.

@pep8speaks

pep8speaks commented Feb 25, 2022 •

Copy link
Copy Markdown

Hello @gmcmacran! 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-02-25 21:08:00 UTC

@josef-pkt

Copy link
Copy Markdown
Member

I never looked at this one

I found this article, it has a minus in front in the link function, so that linear predictor has to be positive
g(p) = - log(1 - p)

Piegorsch, Walter W. 1992. “Complementary Log Regression for Generalized Linear Models.” The American Statistician 46 (2): 94–99. https://doi.org/10.2307/2684172.

Do you have a specific reference that you used?

@josef-pkt

Copy link
Copy Markdown
Member

skimming part of the article
CLog corresponds to right censored 0, 1, poisson with linear link
cloglog corresponds to censored poisson with log link

@gmcmacran

gmcmacran commented Feb 25, 2022 •

Copy link
Copy Markdown
Contributor Author

I never looked at this one

I found this article, it has a minus in front in the link function, so that linear predictor has to be positive g(p) = - log(1 - p)

Piegorsch, Walter W. 1992. “Complementary Log Regression for Generalized Linear Models.” The American Statistician 46 (2): 94–99. https://doi.org/10.2307/2684172.

Do you have a specific reference that you used?

It is out of Generalized Linear Models and Extensions 3rd edition by James W. Hardin and Joseph M. Hilbe. Section 11.6.4 talks about the log complement. The formulas come out of tables in the appendix. This book defines the link as ln(1 -u) = XB.

This stata documentation shows the link as I have it here. See page 7 of https://www.stata.com/manuals/rglm.pdf.

SPSS shows the formula without the minus sign as well . https://www.ibm.com/docs/en/spss-statistics/28.0.0?topic=SSLVMB_28.0.0/statistics_mainhelp_ddita/spss/advanced/idh_idd_genlin_typeofmodel.html near the bottom in the link functions section.

Comment thread docs/source/glm.rst Outdated
CDFLink
CLogLog
LogLog
CLog

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.

LogC

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for finding this. It is fixed now.

@josef-pkt

Copy link
Copy Markdown
Member

cauchy now uses different random numbers because you inserted logc before cauchy in the loop
It might be better to set the seed inside the loop to make the random numbers independent of sequence

@josef-pkt

Copy link
Copy Markdown
Member

LogC is a bit weird because it reverses the direction larger beta increases prob(0) and reduces mu.

We might want to add a CLog version in additionally to the LogC version with the usual monotonicity, negative in front as in the article I found.

I don't have the Hardin Hilbe GLM book and never looked at it.

@gmcmacran gmcmacran mentioned this pull request Feb 25, 2022
4 tasks
@gmcmacran

Copy link
Copy Markdown
Contributor Author

Rebased in #8155.

Closing this pull request.

@gmcmacran gmcmacran closed this Feb 25, 2022
@bashtage bashtage added the rejected Used for PRs with changes that are not acceptable label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected Used for PRs with changes that are not acceptable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants