erri: Estimate the Economic Resilience and Recovery Index

View source: R/erri.R

erriR Documentation

Estimate the Economic Resilience and Recovery Index

Description

Constructs a counterfactual path from observations before a shock and measures the magnitude, persistence, and reversal of subsequent deviations.

Usage

erri(
  data,
  time,
  outcome,
  shock_time,
  unit = NULL,
  method = c("trend", "mean", "ar1"),
  scale = c("sd", "mean", "none"),
  epsilon = 0.25,
  consecutive = 2L,
  weights = NULL,
  level = 0.95
)

Arguments

data

A data frame containing regularly ordered observations.

time

Character string naming the time column.

outcome

Character string naming the numeric outcome column.

shock_time

One common shock time or a named vector of group-specific shock times.

unit

Optional character string naming the grouping column.

method

Counterfactual method: "trend", "mean", or "ar1".

scale

Gap scaling based on the pre-shock standard deviation, absolute mean, or no scaling.

epsilon

Non-negative recovery tolerance in scaled-gap units.

consecutive

Positive number of consecutive observations required to declare recovery.

weights

Named non-negative weights for resistance, loss, recovery, strength, stability, and transformation.

level

Confidence level for counterfactual prediction intervals.

Details

For outcome Y_t, counterfactual Y_t^0, and pre-shock scale s, the adverse gap is G_t=(Y_t^0-Y_t)/s. Shock depth is the largest positive gap and cumulative loss is the sum of positive post-shock gaps. Recovery occurs when the absolute gap remains within epsilon for the specified number of observations. The remaining components measure the rate of gap closure, relative post-shock instability, and positive transformation.

With multiple units, component scores use cross-unit min-max scaling. A single-unit analysis uses bounded absolute transformations. The composite ERRI is the weighted mean of component scores multiplied by 100.

Value

An object of class erri containing component estimates, scores, the composite index, trajectories, settings, and fitted models.

Examples

dat <- erri_example_data()
fit <- erri(dat, time = "year", outcome = "income",
            unit = "region", shock_time = 2020)
fit

ERRI documentation built on Sept. 28, 2026, 5:08 p.m.