irf: Impulse response function

View source: R/tf.R

irfR Documentation

Impulse response function

Description

Computes and plots the impulse response function (IRF) or step response function (SRF) of a transfer function.

Usage

irf(tf, lag.max = 10, cum = FALSE, plot = TRUE)

Arguments

tf

An object of class "tf".

lag.max

Integer. Maximum number of lags to compute (default 10).

cum

Logical. If TRUE computes step response function (cumulative), if FALSE computes impulse response function (default FALSE).

plot

Logical. If TRUE creates a plot, if FALSE returns values only (default TRUE).

Value

If plot = FALSE, a named numeric vector with IRF/SRF values. If plot = TRUE, creates a plot and returns nothing (invisibly).

Examples

# Create transfer function
x <- rep(0, 100); x[50] <- 1
tfx <- tf(x, w0 = 0.8, ar = "(1 - 0.5B)")

# Plot impulse response function
irf(tfx, lag.max = 15)

# Get step response values without plot
srf_values <- irf(tfx, lag.max = 10, cum = TRUE, plot = FALSE)


tfarima documentation built on Nov. 5, 2025, 7:43 p.m.