detect_shocks: Screen a Series for a Single Structural Shock

View source: R/shocks.R

detect_shocksR Documentation

Screen a Series for a Single Structural Shock

Description

Evaluates admissible split points using the proportional reduction in residual sum of squares from separate linear trends. This is a screening diagnostic and not a causal identification procedure.

Usage

detect_shocks(data, time, outcome, min_segment = 5L,
  direction = c("any", "down", "up"))

Arguments

data

A data frame.

time

Character string naming the ordered time column.

outcome

Character string naming the numeric outcome column.

min_segment

Minimum observations on each side of a candidate split.

direction

Whether to retain any, downward, or upward shifts.

Value

A data frame of candidate times, scores, and estimated level shifts, sorted from strongest to weakest.

Examples

dat <- subset(erri_example_data(), region == "North")
head(detect_shocks(dat, "year", "income"))

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