plot_eta: Plot the time series data and the changepoints

Description Usage Arguments Details

Description

Create a plot, with time series data x shown in points, linear trends under the selected changepoint model in blue lines, estimated changepoints in verticle dashed blue lines, and fitted value (including seasonal means and linear trends) in a purple line. Optional residual plots can also be plotted.

Usage

1
2
3
plot_eta(x, dates, varname = NULL, current = NULL, A = NULL,
  scale_trend_design = NULL, eta = NULL, seasonal_cycles = NULL,
  mean_and_trend = NULL, plot_res = FALSE, yw_phi = NULL, ...)

Arguments

x

The time series data, a numeric vector of length n.

dates

The dates records are observed, a POSIXlt vector. It should have the mon component for months, and the year component for years. See also strptime.

varname

The name of the variable x, a character.

current

A list object representing a changepoint model. It contains the following components: eta, xi, inference (output of the fit_eta function), change_eta, and change_xi.

A

The design matrix for the nuisance coefficients in the linear model. It is usually the matrix of seasonal indicators, or the design matrix for harmonic regression with a column of all 1 for intercept.

scale_trend_design

The factor multiplied to the design matrix of trend. Default is 1/50.

eta

A multiple changepoint configuration, i.e., model. It is a 0/1 indicator vector of length n, with the first p elemenets always being 0.

seasonal_cycles

Estimated seasonal means, a numeric vector of length n.

mean_and_trend

Estimated piecewise linear fits, a numeric vector of length n.

plot_res

Logical, whether residual plots will be added after the main plots. If TRUE, then the following four plots will be added: scatterplot and acf plot of the linear model residuals, and scatterplot and acf plot fo the white noise estimates.

yw_phi

Yule walker estimator of AR coefficients, a vector of length p; must be non-NULL if plot_res == TRUE and is.null(current).

...

Other arguments for the plot function.

Details

Two sets of inputs can be used:

  1. Either current, A, scale_trend_design,

  2. Or eta, seasonal_cycles, mean_and_trend.

When used, every inputs in that set must but non-NULL, while all inputs in the other set must be NULL.


yingboli/BayesMDL documentation built on May 29, 2019, 12:18 p.m.