Skip to content

Commit 3340bfb

Browse files
authored
fix flipped lower and upper in profile CI (#785)
* fix flipped lower and upper in profile CI * news link * thinko * julia 1.8 compat * remove debug lines
1 parent bb96c2d commit 3340bfb

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
MixedModels v4.26.1 Release Notes
2+
==============================
3+
- lower and upper edges of profile confidence intervals for REML-fitted models are no longer flipped [#785]
4+
15
MixedModels v4.26.0 Release Notes
26
==============================
37
- `issingular` now accepts comparison tolerances through the keyword arguments `atol` and `rtol`. [#783]
@@ -564,3 +568,4 @@ Package dependencies
564568
[#776]: https://github.com/JuliaStats/MixedModels.jl/issues/776
565569
[#778]: https://github.com/JuliaStats/MixedModels.jl/issues/778
566570
[#783]: https://github.com/JuliaStats/MixedModels.jl/issues/783
571+
[#785]: https://github.com/JuliaStats/MixedModels.jl/issues/785

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MixedModels"
22
uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316"
33
author = ["Phillip Alday <[email protected]>", "Douglas Bates <[email protected]>", "Jose Bayoan Santiago Calderon <[email protected]>"]
4-
version = "4.26.0"
4+
version = "4.26.1"
55

66
[deps]
77
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"

src/profile/profile.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,23 @@ function StatsAPI.confint(pr::MixedModelProfile; level::Real=0.95)
7373
cutoff = sqrt(quantile(Chisq(1), level))
7474
rev = pr.rev
7575
syms = sort!(collect(filter(k -> !startswith(string(k), 'θ'), keys(rev))))
76-
return DictTable(;
76+
dt = DictTable(;
7777
par=syms,
78-
estimate=[rev[s](false) for s in syms],
78+
estimate=[rev[s](0) for s in syms],
7979
lower=[rev[s](-cutoff) for s in syms],
8080
upper=[rev[s](cutoff) for s in syms],
8181
)
82+
83+
# XXX for reasons I don't understand, the reverse spline for REML-models
84+
# is flipped for the fixed effects, even though the table of interpolation
85+
# points isn't.
86+
for i in keys(dt.lower)
87+
if dt.lower[i] > dt.upper[i]
88+
dt.lower[i], dt.upper[i] = dt.upper[i], dt.lower[i]
89+
end
90+
end
91+
92+
return dt
8293
end
8394

8495
function Base.show(io::IO, mime::MIME"text/plain", pr::MixedModelProfile)

test/pls.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,12 @@ end
662662
[265.130, 13.576, 28.858, 37.718, 8.753];
663663
atol=1.e-3)
664664
@test first(only(filter(r -> r.p == && iszero(r.ζ), pr.tbl)).σ) == last(models(:sleepstudy)).σ
665+
666+
@testset "REML" begin
667+
m = refit!(deepcopy(last(models(:sleepstudy))); progress=false, REML=true)
668+
ci = @suppress confint(profile(m))
669+
@test all(splat(<), zip(ci.lower, ci.upper))
670+
end
665671
end
666672
@testset "confint" begin
667673
ci = confint(last(models(:sleepstudy)))

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ using Test
77
import InteractiveUtils: versioninfo
88
import LinearAlgebra: BLAS
99

10+
using Base: splat # necessary for Julia 1.8 compat
11+
1012
# there seem to be processor-specific issues and knowing this is helpful
1113
@info sprint(versioninfo)
1214
@info BLAS.get_config()

0 commit comments

Comments
 (0)