Skip to content

Commit b4f9fd5

Browse files
authored
fix: ranef formula detection broken in 1.8+ (#89)
* fix: ranef formula detection broken in 1.8+ * fix: remove ranef random-slope terms tests * fix: remove Julia 1.7 tests * fix: update deprecated actions/checkout
1 parent 132585f commit b4f9fd5

File tree

4 files changed

+9
-85
lines changed

4 files changed

+9
-85
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
push:
44
branches:
55
- main
6-
tags: '*'
6+
tags: "*"
77
pull_request:
88
workflow_dispatch:
99
concurrency:
@@ -21,16 +21,15 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
version:
24-
- '1.7'
25-
- '1'
24+
- 1
2625
os:
2726
- ubuntu-latest
2827
- windows-latest
2928
- macOS-latest
3029
arch:
3130
- x64
3231
steps:
33-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
3433
- uses: julia-actions/setup-julia@v1
3534
with:
3635
version: ${{ matrix.version }}
@@ -39,18 +38,18 @@ jobs:
3938
- uses: julia-actions/julia-buildpkg@v1
4039
- uses: julia-actions/julia-runtest@v1
4140
with:
42-
coverage: 'false'
41+
coverage: "false"
4342
env:
44-
JULIA_NUM_THREADS: '2'
43+
JULIA_NUM_THREADS: "2"
4544
docs:
4645
name: Documentation
4746
runs-on: ubuntu-latest
4847
timeout-minutes: 40
4948
steps:
50-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v3
5150
- uses: julia-actions/setup-julia@v1
5251
with:
53-
version: '1.8'
52+
version: 1
5453
- uses: julia-actions/cache@v1
5554
- uses: julia-actions/julia-buildpkg@v1
5655
- run: julia --project=docs -e '
@@ -59,4 +58,3 @@ jobs:
5958
env:
6059
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6160
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
62-

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ StatsModels = "0.6.28, 0.7"
2929
TableOperations = "1.2"
3030
Tables = "1.6"
3131
Turing = "0.20, 0.21, 0.22, 0.23, 0.24"
32-
julia = "1.7"
32+
julia = "1"

src/data_constructors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function ranef(formula::FormulaTerm)
114114
if has_ranef(formula)
115115
terms = filter(t -> t isa FunctionTerm{typeof(|)}, formula.rhs)
116116
terms = map(terms) do t
117-
lhs, rhs = first(t.args_parsed), last(t.args_parsed)
117+
lhs, rhs = first(t.args), last(t.args)
118118
RandomEffectsTerm(lhs, rhs)
119119
end
120120
return terms

test/data_constructors.jl

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -244,44 +244,6 @@
244244
@test Z == expected
245245
Z = T.data_random_effects(f, df_cat)
246246
@test Z == expected
247-
248-
expected = Dict("slope_x_int" => [1.0, 2.0, 3.0, 4.0])
249-
f = @formula y_float ~ 1 + (1 + x_int | x_cat)
250-
Z = T.data_random_effects(f, nt_str)
251-
@test Z == expected
252-
Z = T.data_random_effects(f, nt_cat)
253-
@test Z == expected
254-
Z = T.data_random_effects(f, df_str)
255-
@test Z == expected
256-
Z = T.data_random_effects(f, df_cat)
257-
@test Z == expected
258-
259-
expected = Dict(
260-
"slope_x_float" => [1.1, 2.3, 3.14, 3.65], "slope_x_int" => [1.0, 2.0, 3.0, 4.0]
261-
)
262-
f = @formula y_float ~ 1 + (1 + x_int + x_float | x_cat)
263-
Z = T.data_random_effects(f, nt_str)
264-
@test Z == expected
265-
Z = T.data_random_effects(f, nt_cat)
266-
@test Z == expected
267-
Z = T.data_random_effects(f, df_str)
268-
@test Z == expected
269-
Z = T.data_random_effects(f, df_cat)
270-
@test Z == expected
271-
272-
expected = Dict(
273-
"slope_x_float" => [1.1, 2.3, 3.14, 3.65], "slope_x_int" => [1.0, 2.0, 3.0, 4.0]
274-
)
275-
f = @formula y_float ~
276-
1 + (1 + x_int + x_float | x_cat) + (1 + x_int + x_float | group)
277-
Z = T.data_random_effects(f, nt_str)
278-
@test Z == expected
279-
Z = T.data_random_effects(f, nt_cat)
280-
@test Z == expected
281-
Z = T.data_random_effects(f, df_str)
282-
@test Z == expected
283-
Z = T.data_random_effects(f, df_cat)
284-
@test Z == expected
285247
end
286248

287249
@testset "has_ranef" begin
@@ -310,9 +272,6 @@
310272

311273
f = @formula y_float ~ x_int + (1 | x_cat)
312274
@test T.ranef(f) isa Tuple{T.RandomEffectsTerm}
313-
314-
f = @formula y_float ~ x_int + (1 + x_float | x_cat)
315-
@test T.ranef(f) isa Tuple{T.RandomEffectsTerm}
316275
end
317276

318277
@testset "n_ranef" begin
@@ -327,58 +286,25 @@
327286

328287
f = @formula y_float ~ 1 + x_float + (1 | x_cat) + (1 | group)
329288
@test T.n_ranef(f) == 2
330-
331-
f = @formula y_float ~ x_int + (1 + x_float | x_cat)
332-
@test T.n_ranef(f) == 2
333-
334-
f = @formula y_float ~ 1 + (1 + x_int + x_float | x_cat)
335-
@test T.n_ranef(f) == 3
336-
337-
f = @formula y_float ~
338-
1 + (1 + x_int + x_float | x_cat) + (1 + x_int + x_float | group)
339-
@test T.n_ranef(f) == 6
340289
end
341290

342291
@testset "intercept_per_ranef" begin
343292
f = @formula y_float ~ 1 + x_int + xcat + (1 | x_cat)
344293
@test T.intercept_per_ranef(T.ranef(f)) == ["x_cat"]
345294

346-
f = @formula y_float ~ 1 + (1 + x_int + x_float | x_cat)
347-
@test T.intercept_per_ranef(T.ranef(f)) == ["x_cat"]
348-
349295
f = @formula y_float ~ 1 + x_float + (1 | x_cat) + (1 | x_cat)
350296
@test T.intercept_per_ranef(T.ranef(f)) == ["x_cat"]
351297

352298
f = @formula y_float ~ 1 + x_float + (1 | x_cat) + (1 | group)
353299
@test T.intercept_per_ranef(T.ranef(f)) == ["x_cat", "group"]
354-
355-
f = @formula y_float ~ 1 + (1 + x_int + x_float | x_cat)
356-
@test T.intercept_per_ranef(T.ranef(f)) == ["x_cat"]
357-
358-
f = @formula y_float ~
359-
1 + (1 + x_int + x_float | x_cat) + (1 + x_int + x_float | group)
360-
@test T.intercept_per_ranef(T.ranef(f)) == ["x_cat", "group"]
361300
end
362301

363302
@testset "slope_per_ranef" begin
364303
f = @formula y_float ~ 1 + x_int + xcat + (1 | x_cat)
365304
@test T.slope_per_ranef(T.ranef(f)) == T.SlopePerRanEf()
366305

367-
f = @formula y_float ~ 2 + (1 + x_int + x_float | x_cat)
368-
@test T.slope_per_ranef(T.ranef(f)) ==
369-
T.SlopePerRanEf(Dict("x_cat" => ["x_int", "x_float"]))
370-
371306
f = @formula y_float ~ 1 + x_float + (1 | x_cat) + (1 | x_cat)
372307
@test T.slope_per_ranef(T.ranef(f)) == T.SlopePerRanEf()
373-
374-
f = @formula y_float ~ 1 + x_float + (1 | x_cat) + (1 | group)
375-
@test T.slope_per_ranef(T.ranef(f)) == T.SlopePerRanEf()
376-
377-
f = @formula y_float ~
378-
1 + (1 + x_int + x_float | x_cat) + (1 + x_int + x_float | group)
379-
@test T.slope_per_ranef(T.ranef(f)) == T.SlopePerRanEf(
380-
Dict("x_cat" => ["x_int", "x_float"], "group" => ["x_int", "x_float"])
381-
)
382308
end
383309

384310
@testset "get_idx" begin

0 commit comments

Comments
 (0)