Skip to content

Cleanup fit method arguments#7

Closed
nalimilan wants to merge 1 commit into
gragusa:JuliaStats-masterfrom
JuliaStats:nl/args
Closed

Cleanup fit method arguments#7
nalimilan wants to merge 1 commit into
gragusa:JuliaStats-masterfrom
JuliaStats:nl/args

Conversation

@nalimilan

Copy link
Copy Markdown

List all arguments for all fit methods (lm, glm, fit(LinearModel, ...) and fit(GeneralizedLinearModel, ...) so that users get more friendly errors about the function they called when they make mistakes. This matters especially given the large number of arguments which makes an error likely. This requires some refactoring, notably using nothing as a default value instead of vector in the matrix method to match the formula method.

Also improve docs: describe keyword arguments in all docstrings instead of referring to fit, avoid repeating them in signature.

In the process I found a bug where weights were ignored by negbin. New tested values match R up to three decimals (this is tested more thoroughly via glm tests).

[This PR is against https://github.com/JuliaStats/pull/487 waiting for it to be merged as otherwise it would involve lots of conflicts.]

List all arguments for all fit methods (`lm`, `glm`, `fit(LinearModel, ...)`
and `fit(GeneralizedLinearModel, ...)` so that users get more friendly errors
about the function they called when they make mistakes. This matters especially
given the large number of arguments which makes an error likely. This requires
some refactoring, notably using `nothing` as a default value instead of vector
in the matrix method to match the formula method.

Also improve docs: describe keyword arguments in all docstrings instead of referring
to `fit`, avoid repeating them in signature.

In the process I found a bug where weights were ignored by `negbin`. New tested
values match R up to three decimals (this is tested more thoroughly via `glm` tests).
@nalimilan nalimilan closed this Dec 22, 2025
@nalimilan

Copy link
Copy Markdown
Author

I though this would open a PR in JuliaStats/GLM.jl...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant