Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ jobs:
uses: julia-actions/julia-processcoverage@v1
- name: Coverage Upload
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: JuliaMixedModels/MixedModelsExtras.jl
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ LinearAlgebra = "1"
MixedModels = "4, 5"
MixedModelsDatasets = "0.1"
RDatasets = "0.7.7, 0.8"
Suppressor = "0.2.8"
StableRNGs = "1"
Statistics = "1"
StatsBase = "0.33, 0.34"
Expand All @@ -36,7 +37,8 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
MixedModelsDatasets = "7e9fb7ac-9f67-43bf-b2c8-96ba0796cbb6"
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Aqua", "DataFrames", "Distributions", "MixedModelsDatasets", "RDatasets", "StableRNGs"]
test = ["Test", "Aqua", "DataFrames", "Distributions", "MixedModelsDatasets", "RDatasets", "Suppressor", "StableRNGs"]
13 changes: 8 additions & 5 deletions test/icc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
model = fit(MixedModel, @formula(reaction ~ 1 + (1 | subj)), dataset(:sleepstudy);
progress)
@test icc(model, :subj) == icc(model, [:subj]) == icc(model)
@test icc(model, :subj) ≈ 0.37918288
@test icc(model, :subj) ≈ 0.37918288 rtol = 1e-6

formula = @formula(rt_trunc ~ 1 + spkr * prec * load +
(1 + spkr | subj) +
Expand All @@ -25,8 +25,9 @@ end

@testset "Binomial" begin
cbpp = dataset(:cbpp)
model = fit(MixedModel, @formula((incid / hsz) ~ 1 + (1 | herd)),
cbpp, Binomial(); wts=float(cbpp.hsz), progress)
# suppress depwarn on wts vs weights
model = @suppress fit(MixedModel, @formula((incid / hsz) ~ 1 + (1 | herd)),
cbpp, Binomial(); wts=float(cbpp.hsz), progress)
@test icc(model, :herd) == icc(model, [:herd]) == icc(model)
@test icc(model, :herd) ≈ 0.1668 atol = 0.0005
end
Expand All @@ -36,8 +37,10 @@ end
modelbern = fit(MixedModel, @formula(use ~ 1 + (1 | urban & dist)),
contra, Bernoulli(); fast=true, progress)
# force treating as a Binomial model
modelbin = fit(MixedModel, @formula(use ~ 1 + (1 | urban & dist)),
contra, Binomial(); fast=true, wts=ones(length(contra.dist)), progress)
# suppress depwarn on wts vs weights
modelbin = @suppress fit(MixedModel, @formula(use ~ 1 + (1 | urban & dist)),
contra, Binomial(); fast=true, wts=ones(length(contra.dist)),
progress)
# Bernoullis are a special case of binomial, so make sure they give the same answer
@test icc(modelbern, Symbol("urban & dist")) ≈ icc(modelbin, Symbol("urban & dist"))

Expand Down
1 change: 1 addition & 0 deletions test/set_up_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using GLM
using LinearAlgebra
using MixedModels
using MixedModelsExtras
using Suppressor
using StableRNGs
using Statistics
using StatsBase
Expand Down
4 changes: 2 additions & 2 deletions test/shrinkage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

@testset "_ranef error path" begin
@test_throws PosDefException _ranef(m1, 1e12 .* m1.optsum.initial)
@suppress @test_throws PosDefException _ranef(m1, 1e12 .* m1.optsum.initial)
end
end

Expand All @@ -41,6 +41,6 @@ end
@formula(ticks ~ 1 + year + height + (1 | index) + (1 | brood) +
(1 | location)),
grouseticks, Poisson(); fast=true, progress)
@test_throws ArgumentError _ranef(model, NaN .* model.optsum.initial)
@suppress @test_throws ArgumentError _ranef(model, NaN .* model.optsum.initial)
end
end
Loading