tls_bf: Build a freqTLS formula object (brms/drmTMB-style)

View source: R/formula.R

tls_bfR Documentation

Build a freqTLS formula object (brms/drmTMB-style)

Description

tls_bf() captures the per-sub-parameter formulas that define a freqTLS model and returns them, unevaluated, as a tls_formula object. It is the formula complement to the column interface of fit_tls(): instead of passing bare column names, you write one response formula plus a formula per model sub-parameter.

Usage

tls_bf(...)

Arguments

...

The response-and-axes formula first (unnamed, with a left-hand side), then sub-parameter formulas keyed by their left-hand side. See the grammar above.

Details

The first argument must be the unnamed response-and-axes formula. Its left-hand side names the survival counts, in either the brms idiom successes | trials(total) or the glm idiom cbind(successes, failures). Its right-hand side names the two thermal-load-sensitivity axes with the tagged markers ⁠time(<duration>)⁠ and ⁠temp(<temperature>)⁠ (order does not matter).

The remaining arguments are sub-parameter formulas keyed by their left-hand side, one of low, up, log_k, CTmax, or log_z. Any sub-parameter you omit defaults to ~ 1. Each of low, up, and log_k may carry its own design independently — a grouping factor (low ~ group), a continuous covariate (log_k ~ body_size), or an intercept — and need not share one factor or match the headline-parameter grouping. CTmax and log_z accept fixed-effect formulas but must produce the same model-matrix columns (for example, use ⁠CTmax ~ group, log_z ~ group⁠); their supported random- intercept groupings may differ. CTmax accepts multiple additive independent intercepts, such as CTmax ~ 1 + (1 | plant) + (1 | meas_day), when they encode distinct grouping partitions. Aliased grouping columns are rejected because only the sum of their variances is identifiable. log_z, low, and log_k accept at most one grouping factor each. All random intercepts are independent; putting the same grouping factor on two or more coordinates fits separate variances (no correlation term) and warns. Random intercepts are not supported on the upper asymptote up. Phylogenetic covariance structures (for example, gr(species, cov = tree)) are not implemented; use bayesTLS for that model.

Value

A tls_formula object: a list with the captured response formula, the named sub-parameter formulas, and the calling environment.

Parser provenance

The shape of the parser (variadic capture via substitute(), a per-entry formula walk, and random-bar detection) is adapted from drmTMB's drm_formula() / parse_drm_formula_entry() (GPL-3); see inst/COPYRIGHTS. freqTLS writes its own grammar (the time() / temp() axis markers, the five fixed sub-parameter handles, and the package's supported random-effect grammar).

See Also

fit_tls(), which accepts either a tls_formula or the column interface.

Examples

tls_bf(
  survived | trials(total) ~ time(duration) + temp(temp),
  CTmax ~ population,
  log_z ~ population
)
# cbind() response idiom, ungrouped:
tls_bf(cbind(survived, died) ~ time(duration) + temp(temp))


freqTLS documentation built on Dec. 4, 2026, 5:11 p.m.