Skip to content

Commit c13a7ca

Browse files
committed
Merge branch 'main' of github.com:JuliaStats/MixedModels.jl into pa/missable
2 parents 5b02e5b + b09fe96 commit c13a7ca

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

NEWS.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
MixedModels v5.0.3 Release Notes
1+
MixedModels v5.0.4 Release Notes
22
==============================
33
- Small update in some code related to displaying dispersion parameters in cases where inference has failed. [#865]
44

5+
MixedModels v5.0.3 Release Notes
6+
==============================
7+
- `lowerbd(::MixedModel)` returns the _canonical_ lower bounds of a model's parameters, i.e. the expected bounds after rectification in unconstrained optimization. [#864]
8+
59
MixedModels v5.0.2 Release Notes
610
==============================
711
- The default display and `confint` methods for bootstrap results from models without dispersion parameters has been fixed. [#861]
@@ -699,4 +703,5 @@ Package dependencies
699703
[#858]: https://github.com/JuliaStats/MixedModels.jl/issues/858
700704
[#860]: https://github.com/JuliaStats/MixedModels.jl/issues/860
701705
[#861]: https://github.com/JuliaStats/MixedModels.jl/issues/861
706+
[#864]: https://github.com/JuliaStats/MixedModels.jl/issues/864
702707
[#865]: https://github.com/JuliaStats/MixedModels.jl/issues/865

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]>"]
4-
version = "5.0.3"
4+
version = "5.0.4"
55

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

src/generalizedlinearmixedmodel.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,14 @@ function StatsAPI.loglikelihood(m::GeneralizedLinearMixedModel{T}) where {T}
523523
return accum - (mapreduce(u -> sum(abs2, u), +, m.u) + logdet(m)) / 2
524524
end
525525

526+
"""
527+
lowerbd(m::GeneralizedLinearMixedModel)
528+
529+
Return the vector of _canonical_ lower bounds on the parameters, `θ`.
530+
531+
Note that this method does not distinguish between constrained optimization and
532+
unconstrained optimization with post-fit canonicalization.
533+
"""
526534
lowerbd(m::GeneralizedLinearMixedModel) = lowerbd(m.LMM)
527535

528536
# Base.Fix1 doesn't forward kwargs

src/linearmixedmodel.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,16 @@ function StatsAPI.loglikelihood(m::LinearMixedModel)
787787
return -objective(m) / 2
788788
end
789789

790-
lowerbd(m::LinearMixedModel) = foldl(vcat, lowerbd(c) for c in m.reterms)
790+
"""
791+
lowerbd(m::LinearMixedModel)
792+
793+
Return the vector of _canonical_ lower bounds on the parameters, `θ`.
794+
795+
Note that this method does not distinguish between constrained optimization and
796+
unconstrained optimization with post-fit canonicalization.
797+
"""
798+
lowerbd(m::LinearMixedModel{T}) where {T} =
799+
[(pm[2] == pm[3]) ? zero(T) : T(-Inf) for pm in m.parmap]
791800

792801
function mkparmap(reterms::Vector{<:AbstractReMat{T}}) where {T}
793802
parmap = NTuple{3,Int}[]

src/mixedmodel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Equality comparisons are used b/c small non-negative θ values are replaced by 0
7171
function issingular(
7272
m::MixedModel{T}, θ=m.θ; atol::Real=0, rtol::Real=atol > 0 ? 0 : eps()
7373
) where {T}
74-
lb = [(pm[2] == pm[3]) ? zero(T) : T(-Inf) for pm in m.parmap]
74+
lb = lowerbd(m)
7575
return _issingular(lb, θ; atol, rtol)
7676
end
7777

test/pls.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ end
4343
@test length(fm1.A) == 3
4444
@test size(fm1.reterms) == (1,)
4545
@test fm1.optsum.initial == ones(1)
46+
@test lowerbd(fm1) == zeros(1)
4647
fm1.θ = ones(1)
4748
@test fm1.θ == ones(1)
4849
@test islinear(fm1)

0 commit comments

Comments
 (0)