postprocess: Post-process of a psd object

View source: R/postprocess.R

postprocessR Documentation

Post-process of a psd object

Description

This function allows to discard a specified number of samples as burn-in period and apply thinning factor to a psd object.

Usage

postprocess(x, burnin, thin = 1)

Arguments

x

a psd object

burnin

number of initial iterations to be discarded

thin

thinning number (post-processing)

Value

A list with S3 class ‘psd’ containing the following updated components:

psd.median,psd.mean

psd estimates: (pointwise) posterior median and mean

psd.p05,psd.p95

90% pointwise credibility interval

psd.u05,psd.u95

90% uniform credibility interval

fpsd.sample

posterior power spectral density estimates

tau,phi,delta,V

posterior traces of model parameters

ll.trace

trace of log likelihood

DIC

deviance information criterion

count

acceptance probabilities for the weigths

See Also

plot.psd

Examples

## Not run: 

set.seed(1)

# Generate AR(1) data with rho = 0.9
n = 128;
data = arima.sim(n, model = list(ar = 0.9));
data = data - mean(data);

# Run MCMC (may take some time)
mcmc = gibbs_pspline(data, 5000, 0);
mcmc = postprocess(mcmc, burnin = 500, thin = 10);

require(beyondWhittle)  # For psd_arma() function
freq = 2 * pi / n * (1:(n / 2 + 1) - 1)[-c(1, n / 2 + 1)]  # Remove first and last frequency
psd.true = psd_arma(freq, ar = 0.9, ma = numeric(0), sigma2 = 1)  # True PSD
plot(mcmc)  # Plot log PSD (see documentation of plot.psd)
lines(freq, log(psd.true), col = 2, lty = 3, lwd = 2)  # Overlay true PSD


## End(Not run)

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