From 0b78b0ad85e7883ed33483265fc59d488fcaf49b Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Mon, 8 Apr 2024 10:47:24 -0500 Subject: [PATCH 1/9] Setup dependabot for GHA (#761) * Setup dependabot for GHA * oops --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..700707ced --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" From 95a367df0349df9b0e885f6c0da909823e1a629e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:26:42 -0500 Subject: [PATCH 2/9] Bump julia-actions/setup-julia from 1 to 2 (#762) Bumps [julia-actions/setup-julia](https://github.com/julia-actions/setup-julia) from 1 to 2. - [Release notes](https://github.com/julia-actions/setup-julia/releases) - [Commits](https://github.com/julia-actions/setup-julia/compare/v1...v2) --- updated-dependencies: - dependency-name: julia-actions/setup-julia dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/current.yml | 2 +- .github/workflows/documenter.yml | 2 +- .github/workflows/minimum.yml | 2 +- .github/workflows/nightly.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6e73ae482..667c2fe92 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: "1" - uses: julia-actions/cache@v1 diff --git a/.github/workflows/current.yml b/.github/workflows/current.yml index 955275841..0e8a34743 100644 --- a/.github/workflows/current.yml +++ b/.github/workflows/current.yml @@ -27,7 +27,7 @@ jobs: - macOS-14 # apple silicon! steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - uses: julia-actions/cache@v1 diff --git a/.github/workflows/documenter.yml b/.github/workflows/documenter.yml index a09104383..81a8ccd6a 100644 --- a/.github/workflows/documenter.yml +++ b/.github/workflows/documenter.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: 1.8 - uses: julia-actions/cache@v1 diff --git a/.github/workflows/minimum.yml b/.github/workflows/minimum.yml index 528e2c4cd..80be46af9 100644 --- a/.github/workflows/minimum.yml +++ b/.github/workflows/minimum.yml @@ -25,7 +25,7 @@ jobs: os: [ubuntu-22.04, macos-11, windows-2019] steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - uses: julia-actions/cache@v1 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 563a6b81e..26e85fc56 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -25,7 +25,7 @@ jobs: os: [ubuntu-latest] steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - uses: julia-actions/cache@v1 From de39654257089412a17255c5c4977c08e6e5a1a8 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Tue, 23 Apr 2024 14:06:37 +0000 Subject: [PATCH 3/9] use `@everywhere ` in distributed bootstrap example (#764) --- docs/src/bootstrap.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/src/bootstrap.md b/docs/src/bootstrap.md index 185241601..dbe51e620 100644 --- a/docs/src/bootstrap.md +++ b/docs/src/bootstrap.md @@ -163,13 +163,20 @@ For computers with many processors (as opposed to a single processor with severa ```@example Main using Distributed -using ProgressMeter # you already have 1 proc by default, so add the number of additional cores with `addprocs` # you need at least as many RNGs as cores you want to use in parallel # but you shouldn't use all of your cores because nested within this # is the multithreading of the linear algebra +# addprocs(1) @info "Currently using $(nprocs()) processors total and $(nworkers()) for work" +# Load the necessary packages on all workers +# For clusters, you will also need to make sure that the Julia +# environment (Project.toml) is set up and activated on each worker. +@everywhere begin + using ProgressMeter + using MixedModels +end # copy everything to workers @showprogress for w in workers() remotecall_fetch(() -> coefnames(m2), w) From d2504262012dfe2c9160f678b774f20eeb9149d3 Mon Sep 17 00:00:00 2001 From: Douglas Bates Date: Sun, 28 Apr 2024 07:45:24 -0500 Subject: [PATCH 4/9] Update for ExplicitImports check (#765) --- src/MixedModels.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MixedModels.jl b/src/MixedModels.jl index b3c43c4d4..d03de81cd 100644 --- a/src/MixedModels.jl +++ b/src/MixedModels.jl @@ -6,7 +6,7 @@ using BSplineKit: BSplineKit, BSplineOrder, Natural, Derivative, SplineInterpola using BSplineKit: interpolate using DataAPI: DataAPI, levels, refpool, refarray, refvalue using Distributions: Distributions, Bernoulli, Binomial, Chisq, Distribution, Gamma -using Distributions: InverseGaussian, Normal, Poisson, ccdf, estimate +using Distributions: InverseGaussian, Normal, Poisson, ccdf using GLM: GLM, GeneralizedLinearModel, IdentityLink, InverseLink, LinearModel using GLM: Link, LogLink, LogitLink, ProbitLink, SqrtLink using GLM: canonicallink, glm, linkinv, dispersion, dispersion_parameter @@ -16,10 +16,10 @@ using LinearAlgebra: Diagonal, Hermitian, HermOrSym, I, LAPACK, LowerTriangular using LinearAlgebra: PosDefException, SVD, SymTridiagonal, Symmetric using LinearAlgebra: UpperTriangular, cond, diag, diagind, dot, eigen, isdiag using LinearAlgebra: ldiv!, lmul!, logdet, mul!, norm, normalize, normalize!, qr -using LinearAlgebra: rank, rdiv!, rmul!, svd, tr, tril! +using LinearAlgebra: rank, rdiv!, rmul!, svd, tril! using Markdown: Markdown using MixedModelsDatasets: dataset, datasets -using NLopt: NLopt, Opt, ftol_abs, ftol_rel, initial_step, maxtime, xtol_abs, xtol_rel +using NLopt: NLopt, Opt, ftol_abs, ftol_rel, initial_step, xtol_abs, xtol_rel using PooledArrays: PooledArrays, PooledArray using PrecompileTools: PrecompileTools, @setup_workload, @compile_workload using ProgressMeter: ProgressMeter, Progress, ProgressUnknown, finish!, next! @@ -40,7 +40,7 @@ using StatsModels: HelmertCoding, HypothesisCoding, InteractionTerm, InterceptTe using StatsModels: MatrixTerm, SeqDiffCoding, TableRegressionModel, Term using StatsModels: apply_schema, drop_term, formula, modelcols, term, @formula using StructTypes: StructTypes -using Tables: Tables, columntable, rows +using Tables: Tables, columntable using TypedTables: TypedTables, DictTable, FlexTable, Table export @formula, From c4beee91ed3b13b41b90aa7e913796337a16ac09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 02:29:22 +0000 Subject: [PATCH 5/9] Bump julia-actions/cache from 1 to 2 (#766) Bumps [julia-actions/cache](https://github.com/julia-actions/cache) from 1 to 2. - [Release notes](https://github.com/julia-actions/cache/releases) - [Commits](https://github.com/julia-actions/cache/compare/v1...v2) --- updated-dependencies: - dependency-name: julia-actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/current.yml | 2 +- .github/workflows/documenter.yml | 2 +- .github/workflows/minimum.yml | 2 +- .github/workflows/nightly.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 667c2fe92..655738c3f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -24,7 +24,7 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: "1" - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - name: Benchmark run run: | diff --git a/.github/workflows/current.yml b/.github/workflows/current.yml index 0e8a34743..7e2172e36 100644 --- a/.github/workflows/current.yml +++ b/.github/workflows/current.yml @@ -30,7 +30,7 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 with: cache-compiled: "true" - uses: julia-actions/julia-buildpkg@v1 diff --git a/.github/workflows/documenter.yml b/.github/workflows/documenter.yml index 81a8ccd6a..483fc4b8f 100644 --- a/.github/workflows/documenter.yml +++ b/.github/workflows/documenter.yml @@ -25,7 +25,7 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: 1.8 - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 with: cache-compiled: "true" - uses: julia-actions/julia-buildpkg@latest diff --git a/.github/workflows/minimum.yml b/.github/workflows/minimum.yml index 80be46af9..f7e37a65f 100644 --- a/.github/workflows/minimum.yml +++ b/.github/workflows/minimum.yml @@ -28,7 +28,7 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 with: cache-compiled: "true" - uses: julia-actions/julia-buildpkg@v1 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 26e85fc56..1f667ca2b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -28,7 +28,7 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 with: cache-compiled: true - uses: julia-actions/julia-runtest@v1 From 84a61c28f470e16910b70ad0485c874dcc01b572 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 15 May 2024 21:00:24 +0000 Subject: [PATCH 6/9] delegate as many GLMM properties as possible to internal LMM (#767) * delegate as many GLMM properties as possible to internal LMM * NEWS and version bump --- NEWS.md | 5 +++++ Project.toml | 2 +- src/generalizedlinearmixedmodel.jl | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index cc2f91e03..acf1b91cc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +MixedModels v4.24.0 Release Notes +============================== +* Properties for `GeneralizedLinearMixedModel` now default to delegation to the internal weighted `LinearMixedModel` when that property is not explicitly handled by `GeneralizedLinearMixedModel`. Previously, properties were delegated on an explicit basis, which meant that they had to be added manually as use cases were discovered. The downside to the new approach is that it is now possible to access properties whose definition in the LMM case doesn't match the GLMM definition when the GLMM definition hasn't been explicitly been implemented. [#767] + MixedModels v4.23.1 Release Notes ============================== * Fix for `simulate!` when only the estimable coefficients for a rank-deficient model are provided. [#756] @@ -516,3 +520,4 @@ Package dependencies [#748]: https://github.com/JuliaStats/MixedModels.jl/issues/748 [#755]: https://github.com/JuliaStats/MixedModels.jl/issues/755 [#756]: https://github.com/JuliaStats/MixedModels.jl/issues/756 +[#767]: https://github.com/JuliaStats/MixedModels.jl/issues/767 diff --git a/Project.toml b/Project.toml index 7020d82ac..225f9aa54 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MixedModels" uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316" author = ["Phillip Alday ", "Douglas Bates ", "Jose Bayoan Santiago Calderon "] -version = "4.23.1" +version = "4.24.0" [deps] Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45" diff --git a/src/generalizedlinearmixedmodel.jl b/src/generalizedlinearmixedmodel.jl index e33429b81..f9f6ad5dc 100644 --- a/src/generalizedlinearmixedmodel.jl +++ b/src/generalizedlinearmixedmodel.jl @@ -489,12 +489,12 @@ function Base.getproperty(m::GeneralizedLinearMixedModel, s::Symbol) σs(m) elseif s == :σρs σρs(m) - elseif s ∈ (:A, :L, :optsum, :reterms, :Xymat, :feterm, :formula, :parmap) - getfield(m.LMM, s) - elseif s ∈ (:dims, :λ, :lowerbd, :corr, :PCA, :rePCA, :X) - getproperty(m.LMM, s) elseif s == :y m.resp.y + elseif !hasfield(GeneralizedLinearMixedModel, s) && s ∈ propertynames(m.LMM, true) + # automatically delegate as much as possible to the internal local linear approximation + # NB: the !hasfield call has to be first since we're calling getproperty() with m.LMM... + getproperty(m.LMM, s) else getfield(m, s) end From 35492585aabb6619e2efa32e621e01855ba480ca Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Thu, 30 May 2024 14:17:43 +0000 Subject: [PATCH 7/9] import and re-export `lrtest` (#769) --- Project.toml | 2 +- src/MixedModels.jl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 225f9aa54..6d31df627 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MixedModels" uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316" author = ["Phillip Alday ", "Douglas Bates ", "Jose Bayoan Santiago Calderon "] -version = "4.24.0" +version = "4.24.1" [deps] Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45" diff --git a/src/MixedModels.jl b/src/MixedModels.jl index d03de81cd..735b18581 100644 --- a/src/MixedModels.jl +++ b/src/MixedModels.jl @@ -38,7 +38,7 @@ using StatsModels: StatsModels, AbstractContrasts, AbstractTerm, CategoricalTerm using StatsModels: ConstantTerm, DummyCoding, EffectsCoding, FormulaTerm, FunctionTerm using StatsModels: HelmertCoding, HypothesisCoding, InteractionTerm, InterceptTerm using StatsModels: MatrixTerm, SeqDiffCoding, TableRegressionModel, Term -using StatsModels: apply_schema, drop_term, formula, modelcols, term, @formula +using StatsModels: apply_schema, drop_term, formula, lrtest, modelcols, term, @formula using StructTypes: StructTypes using Tables: Tables, columntable using TypedTables: TypedTables, DictTable, FlexTable, Table @@ -114,6 +114,7 @@ export @formula, logdet, loglikelihood, lowerbd, + lrtest, meanresponse, modelmatrix, model_response, From 39dd384602d0b498fa579c6db72d8b3e5add1a3b Mon Sep 17 00:00:00 2001 From: Douglas Bates Date: Thu, 20 Jun 2024 17:44:15 -0500 Subject: [PATCH 8/9] Force return type on pwrss and logdet (#771) --- src/linalg/logdet.jl | 4 ++-- src/linearmixedmodel.jl | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/linalg/logdet.jl b/src/linalg/logdet.jl index e4e084a72..97d637cb5 100644 --- a/src/linalg/logdet.jl +++ b/src/linalg/logdet.jl @@ -25,11 +25,11 @@ lower Cholesky factor. """ function LinearAlgebra.logdet(m::LinearMixedModel{T}) where {T} L = m.L - @inbounds s = sum(j -> LD(L[kp1choose2(j)]), axes(m.reterms, 1)) + @inbounds s = sum(j -> LD(L[kp1choose2(j)]), axes(m.reterms, 1))::T if m.optsum.REML lastL = last(L) s += LD(lastL) # this includes the log of sqrtpwrss s -= log(last(lastL)) # so we need to subtract it from the sum end - return s + s # multiply by 2 b/c the desired det is of the symmetric mat, not the factor + return (s + s)::T # multiply by 2 b/c the desired det is of the symmetric mat, not the factor end diff --git a/src/linearmixedmodel.jl b/src/linearmixedmodel.jl index cc95b1a1a..8ec16f171 100644 --- a/src/linearmixedmodel.jl +++ b/src/linearmixedmodel.jl @@ -50,7 +50,7 @@ function LinearMixedModel( end const _MISSING_RE_ERROR = ArgumentError( - "Formula contains no random effects; this isn't a mixed model. Perhaps you want to use GLM.jl?", + "Formula contains no random effects; this isn't a mixed model. Perhaps you want to use GLM.jl?" ) function LinearMixedModel( @@ -62,7 +62,7 @@ function LinearMixedModel( fvars ⊆ tvars || throw( ArgumentError( - "The following formula variables are not present in the table: $(setdiff(fvars, tvars))", + "The following formula variables are not present in the table: $(setdiff(fvars, tvars))" ), ) @@ -226,7 +226,7 @@ end function _offseterr() return throw( ArgumentError( - "Offsets are not supported in linear models. You can simply shift the response by the offset.", + "Offsets are not supported in linear models. You can simply shift the response by the offset." ), ) end @@ -372,7 +372,7 @@ function StatsBase.confint(m::MixedModel{T}; level=0.95) where {T} return DictTable(; coef=coefnames(m), lower=β .- cutoff .* std, - upper=β .+ cutoff .* std + upper=β .+ cutoff .* std, ) end @@ -895,7 +895,7 @@ end The penalized, weighted residual sum-of-squares. """ -pwrss(m::LinearMixedModel) = abs2(last(last(m.L))) +pwrss(m::LinearMixedModel{T}) where {T} = abs2(last(last(m.L)))::T """ ranef!(v::Vector{Matrix{T}}, m::MixedModel{T}, β, uscale::Bool) where {T} From ce5b604075d2d1e30ed9860918cbb760ab4220a4 Mon Sep 17 00:00:00 2001 From: Douglas Bates Date: Sat, 22 Jun 2024 10:47:33 -0500 Subject: [PATCH 9/9] use ::Matrix{T} instead of ::T to aid type inference (#773) * use ::Matrix{T} instead of ::T * update NEWS.md * JuliaFormatter run (mostly adding trailing commas). --- NEWS.md | 5 +++++ src/generalizedlinearmixedmodel.jl | 4 ++-- src/likelihoodratiotest.jl | 2 +- src/linalg/logdet.jl | 4 ++-- src/linalg/rankUpdate.jl | 2 +- src/linearmixedmodel.jl | 2 +- src/mixedmodel.jl | 4 ++-- src/predict.jl | 2 +- src/profile/thetapr.jl | 2 +- src/randomeffectsterm.jl | 2 +- src/remat.jl | 4 ++-- src/simulate.jl | 2 +- src/utilities.jl | 2 +- 13 files changed, 21 insertions(+), 16 deletions(-) diff --git a/NEWS.md b/NEWS.md index acf1b91cc..ece040c1a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +MixedModels v4.24.1 Release Notes +============================== +Add type notations in `pwrss(::LinearMixedModel)` and `logdet(::LinearMixedModel)` to enhance type inference. [#773] + MixedModels v4.24.0 Release Notes ============================== * Properties for `GeneralizedLinearMixedModel` now default to delegation to the internal weighted `LinearMixedModel` when that property is not explicitly handled by `GeneralizedLinearMixedModel`. Previously, properties were delegated on an explicit basis, which meant that they had to be added manually as use cases were discovered. The downside to the new approach is that it is now possible to access properties whose definition in the LMM case doesn't match the GLMM definition when the GLMM definition hasn't been explicitly been implemented. [#767] @@ -521,3 +525,4 @@ Package dependencies [#755]: https://github.com/JuliaStats/MixedModels.jl/issues/755 [#756]: https://github.com/JuliaStats/MixedModels.jl/issues/756 [#767]: https://github.com/JuliaStats/MixedModels.jl/issues/767 +[#773]: https://github.com/JuliaStats/MixedModels.jl/issues/773 diff --git a/src/generalizedlinearmixedmodel.jl b/src/generalizedlinearmixedmodel.jl index f9f6ad5dc..3e2125499 100644 --- a/src/generalizedlinearmixedmodel.jl +++ b/src/generalizedlinearmixedmodel.jl @@ -351,7 +351,7 @@ function GeneralizedLinearMixedModel( tbl, d::Distribution, l::Type; - kwargs... + kwargs..., ) throw(ArgumentError("Expected a Link instance (`$l()`), got a type (`$l`).")) end @@ -376,7 +376,7 @@ function GeneralizedLinearMixedModel( tbl::Tables.ColumnTable, d::Normal, l::IdentityLink; - kwargs... + kwargs..., ) return throw( ArgumentError("use LinearMixedModel for Normal distribution with IdentityLink") diff --git a/src/likelihoodratiotest.jl b/src/likelihoodratiotest.jl index 335cbaa3f..4e2bf7287 100644 --- a/src/likelihoodratiotest.jl +++ b/src/likelihoodratiotest.jl @@ -219,7 +219,7 @@ function _iscomparable(m::LinearMixedModel...) if any(getproperty.(getproperty.(m, :optsum), :REML)) isconstant(coefnames.(m)) || throw( ArgumentError( - "Likelihood-ratio tests for REML-fitted models are only valid when the fixed-effects specifications are identical", + "Likelihood-ratio tests for REML-fitted models are only valid when the fixed-effects specifications are identical" ), ) end diff --git a/src/linalg/logdet.jl b/src/linalg/logdet.jl index 97d637cb5..5f2c5a564 100644 --- a/src/linalg/logdet.jl +++ b/src/linalg/logdet.jl @@ -25,9 +25,9 @@ lower Cholesky factor. """ function LinearAlgebra.logdet(m::LinearMixedModel{T}) where {T} L = m.L - @inbounds s = sum(j -> LD(L[kp1choose2(j)]), axes(m.reterms, 1))::T + @inbounds s = sum(j -> LD(L[kp1choose2(j)])::T, axes(m.reterms, 1)) if m.optsum.REML - lastL = last(L) + lastL = last(L)::Matrix{T} s += LD(lastL) # this includes the log of sqrtpwrss s -= log(last(lastL)) # so we need to subtract it from the sum end diff --git a/src/linalg/rankUpdate.jl b/src/linalg/rankUpdate.jl index e6f1aacd6..705f87d53 100644 --- a/src/linalg/rankUpdate.jl +++ b/src/linalg/rankUpdate.jl @@ -12,7 +12,7 @@ function rankUpdate! end function rankUpdate!(C::AbstractMatrix, a::AbstractArray, α, β) return error( - "We haven't implemented a method for $(typeof(C)), $(typeof(a)). Please file an issue on GitHub.", + "We haven't implemented a method for $(typeof(C)), $(typeof(a)). Please file an issue on GitHub." ) end diff --git a/src/linearmixedmodel.jl b/src/linearmixedmodel.jl index 8ec16f171..875b54c92 100644 --- a/src/linearmixedmodel.jl +++ b/src/linearmixedmodel.jl @@ -895,7 +895,7 @@ end The penalized, weighted residual sum-of-squares. """ -pwrss(m::LinearMixedModel{T}) where {T} = abs2(last(last(m.L)))::T +pwrss(m::LinearMixedModel{T}) where {T} = abs2(last(last(m.L)::Matrix{T})) """ ranef!(v::Vector{Matrix{T}}, m::MixedModel{T}, β, uscale::Bool) where {T} diff --git a/src/mixedmodel.jl b/src/mixedmodel.jl index f57b4c669..3b145f959 100644 --- a/src/mixedmodel.jl +++ b/src/mixedmodel.jl @@ -80,7 +80,7 @@ function StatsAPI.fit( tbl, d::Type, args...; - kwargs... + kwargs..., ) throw(ArgumentError("Expected a Distribution instance (`$d()`), got a type (`$d`).")) end @@ -91,7 +91,7 @@ function StatsAPI.fit( tbl, d::Distribution, l::Type; - kwargs... + kwargs..., ) throw(ArgumentError("Expected a Link instance (`$l()`), got a type (`$l`).")) end diff --git a/src/predict.jl b/src/predict.jl index 5a2246ac6..1cf1c144f 100644 --- a/src/predict.jl +++ b/src/predict.jl @@ -115,7 +115,7 @@ function _predict(m::MixedModel{T}, newdata, β; new_re_levels) where {T} any(any(ismissing, Tables.getcolumn(newdata, col)) for col in respvars) throw( ArgumentError( - "Response column must be initialized to a non-missing numeric value.", + "Response column must be initialized to a non-missing numeric value." ), ) end diff --git a/src/profile/thetapr.jl b/src/profile/thetapr.jl index 62f9473b2..aeb6ebf15 100644 --- a/src/profile/thetapr.jl +++ b/src/profile/thetapr.jl @@ -10,7 +10,7 @@ function optsumj(os::OptSummary, j::Integer) return OptSummary( deleteat!(copy(os.final), j), deleteat!(copy(os.lowerbd), j), - os.optimizer + os.optimizer, ) end diff --git a/src/randomeffectsterm.jl b/src/randomeffectsterm.jl index 432f9af9a..95beee5e7 100644 --- a/src/randomeffectsterm.jl +++ b/src/randomeffectsterm.jl @@ -174,7 +174,7 @@ function StatsModels.apply_schema( if !(typeof(first) <: CategoricalTerm) throw( ArgumentError( - "nesting terms requires categorical grouping term, got $first. Manually specify $first as `CategoricalTerm` in hints/contrasts", + "nesting terms requires categorical grouping term, got $first. Manually specify $first as `CategoricalTerm` in hints/contrasts" ), ) end diff --git a/src/remat.jl b/src/remat.jl index 74d92ff88..ee40c53e6 100644 --- a/src/remat.jl +++ b/src/remat.jl @@ -586,7 +586,7 @@ end function copyscaleinflate!( Ljj::UniformBlockDiagonal{T}, Ajj::UniformBlockDiagonal{T}, - Λj::ReMat{T,S} + Λj::ReMat{T,S}, ) where {T,S} λ = Λj.λ dind = diagind(S, S) @@ -604,7 +604,7 @@ end function copyscaleinflate!( Ljj::Matrix{T}, Ajj::UniformBlockDiagonal{T}, - Λj::ReMat{T,S} + Λj::ReMat{T,S}, ) where {T,S} copyto!(Ljj, Ajj) n = LinearAlgebra.checksquare(Ljj) diff --git a/src/simulate.jl b/src/simulate.jl index 1b4159e1e..9fbeb4ec9 100644 --- a/src/simulate.jl +++ b/src/simulate.jl @@ -236,7 +236,7 @@ function _simulate!( ismissing(σ) || throw( ArgumentError( - "You must not specify a dispersion parameter for model families without a dispersion parameter", + "You must not specify a dispersion parameter for model families without a dispersion parameter" ), ) diff --git a/src/utilities.jl b/src/utilities.jl index 5394a1fe3..413413b7c 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -136,7 +136,7 @@ function replicate( ) use_threads && Base.depwarn( "use_threads is deprecated and will be removed in a future release", - :replicate + :replicate, ) if !isnothing(hide_progress) Base.depwarn(