Skip to content

Commit fc785a2

Browse files
author
Max Moldovan
committed
refactor(api)!: rename ASReml residual argument rcov -> residual (ASReml 4)
ASReml-R renamed the residual-structure argument from rcov (ASReml 3) to residual (ASReml 4). flexyBayes now follows the ASReml 4 name across the whole surface: the residual argument on flexybayes()/fb(), fb_from_asreml(), and the engine pins; the IR field rcov_terms -> residual_terms; the codegen and INLA emit helpers; the refusal identifiers; the print label; docs; README; vignettes. BREAKING CHANGE: rcov is defunct. Supplying it raises a guiding lifecycle::deprecate_stop() pointing to residual. The residual grammar is unchanged. Version bumped to 0.9.0; NEWS breaking-change entry; regression test test-residual-arg-rename.R pins the tripwire across every entry. Implements co-author Emi Tanaka: adopt the ASReml v4 input convention.
1 parent 0c65598 commit fc785a2

81 files changed

Lines changed: 503 additions & 375 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

API_STABILITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ engine:
3131

3232
| Export | Stage | Notes |
3333
|---|---|---|
34-
| `flexybayes()` | experimental | The asreml-style entry (`fixed`, `random`, `rcov`); also accepts brms-style and greta-style grammar via `syntax = "auto"`. `backend = c("auto", "greta", "inla", "brms", "gretaR")`, default `"auto"`. `"auto"` never routes to Stan/brms. `prior` accepts an `fb_prior()` object. |
34+
| `flexybayes()` | experimental | The asreml-style entry (`fixed`, `random`, `residual`); also accepts brms-style and greta-style grammar via `syntax = "auto"`. `backend = c("auto", "greta", "inla", "brms", "gretaR")`, default `"auto"`. `"auto"` never routes to Stan/brms. `prior` accepts an `fb_prior()` object. |
3535
| `fb()` | experimental | Literal alias for `flexybayes()`; documented but not promoted. |
3636

3737
**Engine pins** fix one engine and therefore take **no** `backend` argument —

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: flexyBayes
22
Title: Flexible Bayesian Mixed Models with ASReml and 'brms'-Style Syntax
3-
Version: 0.8.3
3+
Version: 0.9.0
44
Authors@R: c(
55
person("Max", "Moldovan", email = "max.moldovan@adelaide.edu.au",
66
role = c("aut", "cre"),
@@ -16,7 +16,7 @@ Description: Specify mixed models using familiar ASReml or brms-style formula
1616
syntax and estimate them via greta, INLA, or brms (Stan). Returns results
1717
in formats compatible with the standard R modelling ecosystem including
1818
'summary()', 'emmeans', 'marginaleffects', and 'effectsize'. The package
19-
translates ASReml-style formulas (fixed, random, rcov) to backend-specific
19+
translates ASReml-style formulas (fixed, random, residual) to backend-specific
2020
code (greta, INLA, or brms) using an indexing approach that scales to large
2121
agricultural datasets, and supports cross-engine posterior triangulation
2222
as a robustness signal. Supports Gaussian, binomial, Poisson, negative

NEWS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# flexyBayes 0.9.0
2+
3+
## Breaking changes
4+
5+
* **The residual-structure argument `rcov` is renamed to `residual`, matching
6+
ASReml 4.** ASReml-R renamed this argument from `rcov` (ASReml 3) to
7+
`residual` (ASReml 4); flexyBayes now follows the ASReml 4 name across every
8+
entry point (`flexybayes()` / `fb()`, `fb_from_asreml()`, and the engine pins
9+
`fb_greta()` / `fb_inla()` / `fb_brms()`). Supplying the old `rcov =` argument
10+
now raises a guiding error pointing to `residual =`; update calls such as
11+
`rcov = ~ at(env):units` to `residual = ~ at(env):units`. The residual grammar
12+
itself is unchanged. The print method now labels the residual structure
13+
`Residual` rather than `Rcov`, and the two associated refusal identifiers are
14+
renamed to match (`rcov_type_unsupported_for_aggregation` ->
15+
`residual_type_unsupported_for_aggregation`, `rcov_term_type_inla` ->
16+
`residual_term_type_inla`).
17+
118
# flexyBayes 0.8.3
219

320
A documentation-honesty and ergonomics release on the 0.8.x line. There are no

R/canonical_names.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ register_canonical_mapper <- function(backend, mapper) {
220220
intercept = pi$fixed$intercept %||% TRUE,
221221
fixed_terms = pi$fixed$terms %||% list(),
222222
random_terms = pi$random %||% list(),
223-
rcov_terms = pi$rcov %||% list()
223+
residual_terms = pi$residual %||% list()
224224
)
225225
}
226226

R/codegen.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -869,22 +869,22 @@
869869
ctx
870870
}
871871

872-
# Generate code for residual (rcov) structure
873-
.code_rcov <- function(ctx, rcov_terms, data) {
872+
# Generate code for the residual structure
873+
.code_residual <- function(ctx, residual_terms, data) {
874874
ctx <- .add(
875875
ctx,
876876
"# -- Residual ------------------------------------------------"
877877
)
878878
pvc <- ctx$prior_vc
879879

880880
has_at_units <- any(vapply(
881-
rcov_terms,
881+
residual_terms,
882882
function(t) t$type == "at_units",
883883
logical(1)
884884
))
885885

886886
if (has_at_units) {
887-
term <- Filter(function(t) t$type == "at_units", rcov_terms)[[1]]
887+
term <- Filter(function(t) t$type == "at_units", residual_terms)[[1]]
888888
tag <- term$var
889889
ctx <- .add(
890890
ctx,
@@ -921,7 +921,7 @@
921921
}
922922

923923
# Generate code for the likelihood
924-
.code_likelihood <- function(ctx, fixed_info, rcov_terms, data, weights) {
924+
.code_likelihood <- function(ctx, fixed_info, residual_terms, data, weights) {
925925
ctx <- .add(
926926
ctx,
927927
"# -- Likelihood ----------------------------------------------"

R/dispatch.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@
488488
the_call,
489489
fixed,
490490
random,
491-
rcov,
491+
residual,
492492
family,
493493
link,
494494
data_name,
@@ -543,7 +543,7 @@
543543
the_call = the_call,
544544
fixed = fixed,
545545
random = random,
546-
rcov = rcov,
546+
residual = residual,
547547
family = family,
548548
link = link,
549549
data_name = data_name
@@ -602,7 +602,7 @@
602602
the_call = the_call,
603603
fixed = fixed,
604604
random = random,
605-
rcov = rcov,
605+
residual = residual,
606606
family = family,
607607
link = link,
608608
data_name = data_name
@@ -694,7 +694,7 @@
694694
the_call = the_call,
695695
fixed = fixed,
696696
random = random,
697-
rcov = rcov,
697+
residual = residual,
698698
family = family,
699699
link = link,
700700
data_name = data_name
@@ -866,7 +866,7 @@
866866
the_call = the_call,
867867
fixed = fixed,
868868
random = random,
869-
rcov = rcov,
869+
residual = residual,
870870
family = family,
871871
link = link,
872872
data_name = data_name
@@ -998,7 +998,7 @@
998998
the_call = the_call,
999999
fixed = fixed,
10001000
random = random,
1001-
rcov = rcov,
1001+
residual = residual,
10021002
family = family,
10031003
link = link,
10041004
data_name = data_name
@@ -1072,7 +1072,7 @@
10721072
the_call,
10731073
fixed,
10741074
random,
1075-
rcov,
1075+
residual,
10761076
family,
10771077
link,
10781078
data_name
@@ -1111,12 +1111,12 @@
11111111

11121112
# at_units on INLA: the multi-likelihood INLA stack is still
11131113
# deferred at v0.3.3 (queued for a later minor). If we'd otherwise
1114-
# route to INLA AND the rcov uses at_units, force the eff_backend
1114+
# route to INLA AND the residual uses at_units, force the eff_backend
11151115
# down to greta (which supports the heterogeneous-residual aggregated
11161116
# path) or fall through to per-row when greta isn't an option.
1117-
uses_at_units <- length(fb$rcov_terms) > 0L &&
1117+
uses_at_units <- length(fb$residual_terms) > 0L &&
11181118
any(vapply(
1119-
fb$rcov_terms,
1119+
fb$residual_terms,
11201120
function(t) identical(t$type %||% "", "at_units"),
11211121
logical(1L)
11221122
))
@@ -1181,7 +1181,7 @@
11811181
the_call = the_call,
11821182
fixed = fixed,
11831183
random = random,
1184-
rcov = rcov,
1184+
residual = residual,
11851185
family = family,
11861186
link = link,
11871187
data_name = data_name
@@ -1227,7 +1227,7 @@
12271227
the_call = the_call,
12281228
fixed = fixed,
12291229
random = random,
1230-
rcov = rcov,
1230+
residual = residual,
12311231
family = family,
12321232
link = link,
12331233
data_name = data_name

R/emit_brms.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ emit_brms <- function(
5858
the_call = NULL,
5959
fixed = NULL,
6060
random = NULL,
61-
rcov = NULL,
61+
residual = NULL,
6262
family = NULL,
6363
link = NULL,
6464
data_name = NA_character_,
@@ -250,13 +250,13 @@ emit_brms <- function(
250250
terms = fb$fixed_terms
251251
),
252252
random = fb$random_terms,
253-
rcov = fb$rcov_terms,
253+
residual = fb$residual_terms,
254254
family = list(family = fb$family, link = fb$link)
255255
),
256256
call_info = list(
257257
fixed = fixed,
258258
random = random,
259-
rcov = rcov,
259+
residual = residual,
260260
data_name = data_name,
261261
family = family,
262262
link = link,

R/emit_count_aggregated.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ emit_count_aggregated <- function(
4040
the_call = NULL,
4141
fixed = NULL,
4242
random = NULL,
43-
rcov = NULL,
43+
residual = NULL,
4444
family = NULL,
4545
link = NULL,
4646
data_name = NA_character_
@@ -99,7 +99,7 @@ emit_count_aggregated <- function(
9999
the_call = the_call,
100100
fixed = fixed,
101101
random = random,
102-
rcov = rcov,
102+
residual = residual,
103103
family = family,
104104
link = link,
105105
data_name = data_name,
@@ -446,7 +446,7 @@ emit_count_aggregated <- function(
446446
the_call,
447447
fixed,
448448
random,
449-
rcov,
449+
residual,
450450
family,
451451
link,
452452
data_name,
@@ -504,7 +504,7 @@ emit_count_aggregated <- function(
504504
terms = fb$fixed_terms
505505
),
506506
random = fb$random_terms,
507-
rcov = fb$rcov_terms,
507+
residual = fb$residual_terms,
508508
family = list(
509509
family = fb$family,
510510
link = fb$link %||% .agg_count_link(fb$family)
@@ -514,7 +514,7 @@ emit_count_aggregated <- function(
514514
call_info = list(
515515
fixed = fixed,
516516
random = random,
517-
rcov = rcov,
517+
residual = residual,
518518
data_name = data_name,
519519
family = family,
520520
link = link,

0 commit comments

Comments
 (0)