Skip to content

Commit

Permalink
fix flipped lower and upper in profile CI (#785)
Browse files Browse the repository at this point in the history
* fix flipped lower and upper in profile CI

* news link

* thinko

* julia 1.8 compat

* remove debug lines
  • Loading branch information
palday authored Oct 1, 2024
1 parent bb96c2d commit 3340bfb
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
MixedModels v4.26.1 Release Notes
==============================
- lower and upper edges of profile confidence intervals for REML-fitted models are no longer flipped [#785]

MixedModels v4.26.0 Release Notes
==============================
- `issingular` now accepts comparison tolerances through the keyword arguments `atol` and `rtol`. [#783]
Expand Down Expand Up @@ -564,3 +568,4 @@ Package dependencies
[#776]: https://github.com/JuliaStats/MixedModels.jl/issues/776
[#778]: https://github.com/JuliaStats/MixedModels.jl/issues/778
[#783]: https://github.com/JuliaStats/MixedModels.jl/issues/783
[#785]: https://github.com/JuliaStats/MixedModels.jl/issues/785
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MixedModels"
uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316"
author = ["Phillip Alday <[email protected]>", "Douglas Bates <[email protected]>", "Jose Bayoan Santiago Calderon <[email protected]>"]
version = "4.26.0"
version = "4.26.1"

[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Expand Down
15 changes: 13 additions & 2 deletions src/profile/profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,23 @@ function StatsAPI.confint(pr::MixedModelProfile; level::Real=0.95)
cutoff = sqrt(quantile(Chisq(1), level))
rev = pr.rev
syms = sort!(collect(filter(k -> !startswith(string(k), 'θ'), keys(rev))))
return DictTable(;
dt = DictTable(;
par=syms,
estimate=[rev[s](false) for s in syms],
estimate=[rev[s](0) for s in syms],
lower=[rev[s](-cutoff) for s in syms],
upper=[rev[s](cutoff) for s in syms],
)

# XXX for reasons I don't understand, the reverse spline for REML-models
# is flipped for the fixed effects, even though the table of interpolation
# points isn't.
for i in keys(dt.lower)
if dt.lower[i] > dt.upper[i]
dt.lower[i], dt.upper[i] = dt.upper[i], dt.lower[i]
end
end

return dt
end

function Base.show(io::IO, mime::MIME"text/plain", pr::MixedModelProfile)
Expand Down
6 changes: 6 additions & 0 deletions test/pls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,12 @@ end
[265.130, 13.576, 28.858, 37.718, 8.753];
atol=1.e-3)
@test first(only(filter(r -> r.p == && iszero(r.ζ), pr.tbl)).σ) == last(models(:sleepstudy)).σ

@testset "REML" begin
m = refit!(deepcopy(last(models(:sleepstudy))); progress=false, REML=true)
ci = @suppress confint(profile(m))
@test all(splat(<), zip(ci.lower, ci.upper))
end
end
@testset "confint" begin
ci = confint(last(models(:sleepstudy)))
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ using Test
import InteractiveUtils: versioninfo
import LinearAlgebra: BLAS

using Base: splat # necessary for Julia 1.8 compat

# there seem to be processor-specific issues and knowing this is helpful
@info sprint(versioninfo)
@info BLAS.get_config()
Expand Down

2 comments on commit 3340bfb

@palday
Copy link
Member Author

@palday palday commented on 3340bfb Oct 1, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/116363

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.26.1 -m "<description of version>" 3340bfb254189ff9e8b9c3089633955134db7527
git push origin v4.26.1

Please sign in to comment.