plot.psd: Plot method for psd class

View source: R/internal_gibbs_s3.R

plot.psdR Documentation

Plot method for psd class

Description

This function plots the log periodogram, log posterior median PSD, and log 90% credible region PSD. The x-axis uses angular frequency and the y-axis is plotted on the log scale. The PSD at the zero frequency is removed from the plot. If the time series is even length, the PSD at the last frequency is also removed from the plot. Function taken from bsplinePsd package.

Usage

## S3 method for class 'psd'
plot(x, legend.loc = "topright", ylog = TRUE, ...)

Arguments

x

an object of class psd

legend.loc

location of legend out of "topright" (default), "topleft", "bottomright", "bottomleft". If set to NA then no legend will be produced

ylog

logical value (default is TRUE) to determine if PSD (y-axis) should be on natural log scale

...

other graphical parameters from the plot.default function

Value

plot of the estimate of the (log) PSD

References

Edwards, M. C., Meyer, R., and Christensen, N. (2018), bsplinePsd: Bayesian power spectral density estimation using B-spline priors. R package

See Also

gibbs_pspline

Examples

## Not run: 

set.seed(12345)

# Simulate AR(4) data
n = 2 ^ 7
ar.ex = c(0.9, -0.9, 0.9, -0.9)
data = arima.sim(n, model = list(ar = ar.ex))
data = data - mean(data)

# Run MCMC (may take some time)
mcmc = gibbs_pspline(data, 10000, 5000, degree = 1)

# Plot result
plot(mcmc)

# Plot result on original scale with title
plot(mcmc, ylog = FALSE, main = "Estimate of PSD using the P-spline method")

## End(Not run)

pmat747/psplinePsd documentation built on July 7, 2023, 9:06 p.m.