Learn R Programming

tfarima (version 0.4.1)

irf: 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)

Value

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

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).

Examples

Run this code
# 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)

Run the code above in your browser using DataLab