influ2 calculates and visualises how explanatory variables, random effects,
and spatial fields influence standardised fisheries CPUE indices.
The package uses one model-neutral S3 interface:
diagnostic <- influ(model, focus = "year")
diagnostic
summary(diagnostic)
plot(diagnostic, type = "influence")
plot(diagnostic, type = "cdi", term = "vessel")Initial adapters are available for:
stats::glm();mgcv::gam();brms::brm();glmmTMB::glmmTMB();sdmTMB::sdmTMB(); andtinyVAST::tinyVAST().
The result is a compact influ_diag object with consistent tables and plots
across backends. brms posterior coefficients are projected directly into
focus-by-term diagnostics, avoiding observation-by-draw-by-term arrays.
# Full posterior calculation, compact stored summaries.
diagnostic <- influ(brms_fit, focus = "year", retain = "summary")
# Retain only draws of the derived diagnostics.
diagnostic <- influ(
brms_fit,
focus = "year",
retain = "derived_draws"
)
# Fast posterior-mean preview.
preview <- influ(brms_fit, focus = "year", uncertainty = "none")Supported base families in the first implementation are Gaussian, binomial, Poisson, negative binomial, lognormal, Gamma, and Tweedie. Hurdle/delta and zero-inflated components are kept explicit.
Year-effect indices from influ() require an unambiguous focus effect. Offset/exposure
diagnostics currently support single-component log-link ratios and
identity-link contrasts, not combined or nonlinear-probability outputs.
Lognormal support follows each backend's parameterisation; see the main
vignette for the supported location, scale, and link combinations.
For an assessment-ready expected-response table, use cpue_index() with an
explicit common reference profile or population. Both "standardised" and
"standardized" are accepted. GLM, GAM, glmmTMB, complete brms, sdmTMB, and
univariate tinyVAST fits are supported for response standardisation.
integrate_index() separately calculates area-weighted totals for these same
six backends, whether or not the fitted model includes spatial effects.
index <- cpue_index(model, year = "year", reference_data = reference_profile)
as.data.frame(index) # Year, Mean, Median, SD, CV, Qlower, Qupper, and metadata.
plot_index(index)
geo_mean(c(1, 4, 16))
total <- integrate_index(model, reference_data = prediction_grid,
area = "area_km2", year = "year",
area_units = "km^2", response_units = "kg/km^2", units = "kg")
plot_index(total)These response indices are distinct from the year-effect contrasts used in the step plots. See the CPUE indices article for reference choices, compact uncertainty, and comparison examples. Area integration requires a stated domain and compatible response/area units; integrating CPUE does not automatically turn it into absolute biomass.
Residual overviews also adapt to the response: Bernoulli encounter models use fixed-bin probability calibration, while positive and combined catch responses retain the observed-versus-simulated CDF. No model is refitted by these calls.
checks <- influ_residuals(model, year = "year")
plot(checks) # Automatic fourth panel.
plot(checks, type = "distribution") # Explicit original CDF.See Residual diagnostics for predictive-envelope interpretation and grouped checks that can reveal missing structure even when pooled encounter calibration looks good.
pak::pak("quantifish/influ2")See vignette("influ2") for the framework, memory strategy, and model
examples. The separate vignette("bentley-validation") documents and plots
the frozen agreement check against the original Bentley implementation.
