Learn R Programming

LSTS (version 2.1)

spectral.density: Spectral Density

Description

Returns theoretical spectral density evaluated in ARMA and ARFIMA processes.

Usage

spectral.density(ar = numeric(), ma = numeric(), d = 0, sd = 1, lambda = NULL)

Arguments

ar

(type: numeric) AR vector. If the time serie doesn't have AR term then omit it. For more details see the examples.

ma

(type: numeric) MA vector. If the time serie doesn't have MA term then omit it. For more details see the examples.

d

(type: numeric) Long-memory parameter. If d is zero, then the process is ARMA(p,q).

sd

(type: numeric) Noise scale factor, by default is 1.

lambda

(type: numeric) \(\lambda\) parameter on which the spectral density is calculated/computed. If lambda=NULL then it is considered a sequence between 0 and \(\pi\).

Value

An unnamed vector of numeric class.

Details

The spectral density of an ARFIMA(p,d,q) processes is $$f(\lambda) = \frac{\sigma^2}{2\pi} \cdot \bigg(2\, \sin(\lambda/2)\bigg)^{-2d} \cdot \frac{\bigg|\theta\bigg(\exp\bigg(-i\lambda\bigg)\bigg)\bigg|^2} {\bigg|\phi\bigg(\exp\bigg(-i\lambda\bigg)\bigg)\bigg|^2}$$ With \(-\pi \le \lambda \le \pi\) and \(-1 < d < 1/2\). \(|x|\) is the Mod of \(x\). LSTS_sd returns the values corresponding to \(f(\lambda)\). When d is zero, the spectral density corresponds to an ARMA(p,q).

References

For more information on theoretical foundations and estimation methods see brockwell2002introductionLSTS palma2007longLSTS

Examples

Run this code
# NOT RUN {
# Spectral Density AR(1)
require(ggplot2)
f <- spectral.density(ar = 0.5, lambda = malleco)
ggplot(data.frame(x = malleco, y = f)) +
  geom_line(aes(x = as.numeric(x), y = as.numeric(y))) +
  labs(x = "Frequency", y = "Spectral Density") +
  theme_minimal()
# }

Run the code above in your browser using DataLab