Skip to content

Commit

Permalink
Support for bootstrapping models with a mixture of correlation struct…
Browse files Browse the repository at this point in the history
…ures (#577)

* Loosen type constraint on MixedModelsBootstrap.λ

Changing the type constraint on λ fixes problems when bootstrapping models
with a mixture of zerocorr (Diagonal) and non zerocorr (LowerTriangular)
RE representations. We also remove the type constraint on the parent, i.e.
 internal  storage within LowerTriangular|Diagonal so that we can better
support more types in the future. As a pleasant side effect, this makes
the type parameterization easier.

* Patch bump + NEWS
  • Loading branch information
palday authored Nov 3, 2021
1 parent b16c9d1 commit 9f27f2b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 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.4.1 Release Notes
========================
* Fix type parameterization in MixedModelsBootstrap to support models with a mixture of correlation structures (i.e. `zerocorr` in some but not all RE terms) [#577]

MixedModels v4.4.0 Release Notes
========================
* Add a constructor for the abstract type `MixedModel` that delegates to `LinearMixedModel` or `GeneralizedLinearMixedModel`. [#572]
Expand Down Expand Up @@ -306,3 +310,4 @@ Package dependencies
[#570]: https://github.com/JuliaStats/MixedModels.jl/issues/570
[#572]: https://github.com/JuliaStats/MixedModels.jl/issues/572
[#573]: https://github.com/JuliaStats/MixedModels.jl/issues/573
[#577]: https://github.com/JuliaStats/MixedModels.jl/issues/577
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.4.0"
version = "4.4.1"

[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ and correlations of the random-effects terms.
"""
struct MixedModelBootstrap{T<:AbstractFloat} <: MixedModelFitCollection{T}
fits::Vector
λ::Vector{<:Union{LowerTriangular{T,Matrix{T}},Diagonal{T,Vector{T}}}}
λ::Vector{Union{LowerTriangular{T},Diagonal{T}}}
inds::Vector{Vector{Int}}
lowerbd::Vector{T}
fcnames::NamedTuple
Expand Down
8 changes: 8 additions & 0 deletions test/bootstrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ end
@test typeof(pbzc) == MixedModelBootstrap{Float16}
end

@testset "zerocorr + not zerocorr" begin
form_zc_not = @formula(rt_trunc ~ 1 + spkr * prec * load +
(1 + spkr + prec + load | subj) +
zerocorr(1 + spkr + prec + load | item))
fmzcnot = fit(MixedModel, form_zc_not, dataset(:kb07))
pbzcnot = parametricbootstrap(MersenneTwister(42), 2, fmzcnot, Float16)
end

@testset "Bernoulli simulate! and GLMM boostrap" begin
contra = dataset(:contra)
# need a model with fast=false to test that we only
Expand Down

2 comments on commit 9f27f2b

@palday
Copy link
Member Author

@palday palday commented on 9f27f2b Nov 3, 2021

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/48063

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.4.1 -m "<description of version>" 9f27f2b971d777c93711a684b6290e8ed1200365
git push origin v4.4.1

Please sign in to comment.