residuals.qpm_filtration: One-step-ahead prediction errors and fitted values

View source: R/generics.R

residuals.qpm_filtrationR Documentation

One-step-ahead prediction errors and fitted values

Description

residuals() returns the filter's one-step-ahead prediction errors for the observed series (type = "innovation"), the same divided by their standard deviations ("standardized", which is what the outlier flags use), or the smoothed structural shocks ("shock"). fitted() returns the one-step-ahead predictions of the observables, so that observed = fitted + innovation.

Usage

## S3 method for class 'qpm_filtration'
residuals(object, type = c("innovation", "standardized", "shock"), ...)

## S3 method for class 'qpm_filtration'
fitted(object, ...)

Arguments

object

A qpm_filtration.

type

Which residuals to return.

...

Unused.

Value

A data frame with a period column and one column per series.

Examples

sol <- qpm_solve(qpm_template("bkl"))
obs <- simulate(sol, nsim = 40, seed = 1, burn = 20)
fit <- qpm_filter(sol, obs[, c("period", "pi", "i", "q")])
head(residuals(fit, "standardized"))
head(fitted(fit))

qpmR documentation built on Sept. 29, 2026, 5:10 p.m.