Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix flipped lower and upper in profile CI #785

Merged
merged 6 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading