Skip to content

Conversation

ajinkya-k
Copy link
Contributor

@ajinkya-k ajinkya-k commented Mar 16, 2025

closes #809

Did behavior change? Did you add need features? If so, please update NEWS.md

  • after opening this PR, add a reference and run docs/NEWS-update.jl to update the cross-references.
  • add entry in NEWS.md

Should we release your changes right away? If so, bump the version:

  • figure out new minor version no
  • actually bump minor version

@ajinkya-k
Copy link
Contributor Author

ajinkya-k commented Mar 16, 2025

EDIT: i figured it out

issue ~can someone help me with this warning: ~ ```julia-repl ┌ MixedModels │ WARNING: Method definition lmm(StatsModels.FormulaTerm{L, R} where R where L, Any) in module MixedModels at /home/runner/work/MixedModels.jl/MixedModels.jl/src/linearmixedmodel.jl:230 overwritten at /home/runner/work/MixedModels.jl/MixedModels.jl/src/linearmixedmodel.jl:231. │ ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation. └ ```

but the same doesn't seem to happen with StatsAPI.fit(LinearMixedModel, ) see lines 194-218 of src/linearmixedmodel.jl`

@palday
Copy link
Member

palday commented Mar 16, 2025

MixedModels.jl had something like this in the past, but we dropped that interface. Maybe @dmbates can comment more on the why.

To actually add it, you can simply do:

lmm(args...; kwargs...) = fit(LinearMixedModel, args...; kwargs...)
glmm(args...; kwargs...) = fit(GeneralizedLinearMixedModel, args...; kwargs...)

Copy link

codecov bot commented Mar 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.33%. Comparing base (bcd3e9f) to head (e7b814a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #810   +/-   ##
=======================================
  Coverage   97.33%   97.33%           
=======================================
  Files          36       36           
  Lines        3488     3490    +2     
=======================================
+ Hits         3395     3397    +2     
  Misses         93       93           
Flag Coverage Δ
current 96.99% <100.00%> (+<0.01%) ⬆️
minimum 97.33% <100.00%> (+<0.01%) ⬆️
nightly 96.91% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@dmbates dmbates left a comment

Choose a reason for hiding this comment

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

I think there should be a test involving more optional arguments, such as REML=true to lmm just to ensure that everything is getting passed on properly.

Were you going to modify the documentation to include this function?

@ajinkya-k
Copy link
Contributor Author

Okay i will add the tests. I wanted some comments on what to write in the docstring

@ajinkya-k
Copy link
Contributor Author

@dmbates Added a test for REML = true. It only makes sure the returned model isa LinearMixedModel . would it be worth it to test maybe the fixed effects or deviance too?

@ajinkya-k
Copy link
Contributor Author

image

The lines with the yellow side bar are not being rendered in the api docs at all. Am I doing something wrong with the formatting?

@palday
Copy link
Member

palday commented Mar 17, 2025

image The lines with the yellow side bar are not being rendered in the api docs at all. Am I doing something wrong with the formatting?

you need to explicitly add them in docs/src/api.md.

@palday
Copy link
Member

palday commented Mar 17, 2025

[ ] figure out new version no

You're adding a feature in a post 1.0 release without breaking anything, so it's a minor (major.minor.patch) version bump according to SemVer.

@ajinkya-k
Copy link
Contributor Author

ajinkya-k commented Mar 17, 2025

@palday I did add lmm in docs/src/api.md like this:
image

@ajinkya-k
Copy link
Contributor Author

[ ] figure out new version no

You're adding a feature in a post 1.0 release without breaking anything, so it's a minor (major.minor.patch) version bump according to SemVer.

right, I meant figure out the new minor version no.

@palday
Copy link
Member

palday commented Mar 17, 2025

@palday I did add lmm in docs/src/api.md like this: image

you haven't committed and pushed that change yet 😉

@ajinkya-k
Copy link
Contributor Author

@palday I meant on local, lol. I was rendering the docs locally and running LiveServer. I just did a clean build of the documentation and it worked

@ajinkya-k ajinkya-k changed the title RFC: add lmm as a wrapper for fit(LinearMixedModel, ...). fixed #809 RFC: add lmm and glmm as convenience wrappers for fit fixed #809 Mar 17, 2025
@ajinkya-k
Copy link
Contributor Author

Okay! I think this is good to go!

@ajinkya-k ajinkya-k marked this pull request as ready for review March 17, 2025 16:52
@ajinkya-k
Copy link
Contributor Author

The reference

[`fit`](@ref)

gives an error because there is no doc-string for fit. That error went away if I use fit! instead but fit! does not document some keywords such as wts. Should i add a docstring to fit?

@ajinkya-k ajinkya-k changed the title RFC: add lmm and glmm as convenience wrappers for fit fixed #809 added lmm and glmm as convenience wrappers for fit fixed #809 Mar 17, 2025
@ajinkya-k ajinkya-k changed the title added lmm and glmm as convenience wrappers for fit fixed #809 added lmm and glmm as convenience wrappers for fit fixes #809 Mar 17, 2025
@palday palday changed the title added lmm and glmm as convenience wrappers for fit fixes #809 added lmm and glmm as convenience wrappers for fit Mar 18, 2025
@palday
Copy link
Member

palday commented Mar 18, 2025

The reference

[`fit`](@ref)

gives an error because there is no doc-string for fit. That error went away if I use fit! instead but fit! does not document some keywords such as wts. Should i add a docstring to fit?

I'll push a change shortly that adds a secondary link to the type constructor and that should cover everything.

@ajinkya-k
Copy link
Contributor Author

ajinkya-k commented Mar 18, 2025

I don't think we need to display the output in the Quick Start section but I couldn't hide it so I left it as is. Is it possible to hide output without using a ; in an example block?

@palday
Copy link
Member

palday commented Mar 18, 2025

If you don't want to display output, do you even want the code executed? If you're not executing the code, then a normal triple-backtick codeblock would work.

That said, I don't think there's harm in showing the output.

@ajinkya-k
Copy link
Contributor Author

Let's keep the output

@palday palday merged commit 7b37191 into JuliaStats:main Mar 18, 2025
11 checks passed
@ajinkya-k ajinkya-k deleted the ahk/lmm-wrapper branch March 18, 2025 22:37
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.

Add lmm (or something similar) as a convenience fitting function

3 participants