TsPlotCheck: Plot the simulated time series

View source: R/datasimulation.R

TsPlotCheckR Documentation

Plot the simulated time series

Description

This is a function to plot the simulated time series with segmentation visualization by provided changepoint locations.

Usage

TsPlotCheck(
  X = NULL,
  Xat = NULL,
  Y,
  tau = NULL,
  mu = NULL,
  XLAB = NULL,
  YLAB = NULL
)

Arguments

X

The time series time index, which could be specified as years, months, days, or others. The default value is NULL and the vector from 1 to the time series length will be applied.

Xat

The values from X that will be used as the X axis tick marks.

Y

The time series data.

tau

The provided changepoint locations.

mu

The provided meam values for each time t.

XLAB

A descriptive label for X axis.

YLAB

A descriptive label for Y axis.

Value

No return value, called for side effects

Examples

Ts = 1000
betaT = c(0.5) # intercept
XMatT = matrix(1, nrow=Ts, ncol=1)
colnames(XMatT) = "intercept"
sigmaT = 1
DeltaT = c(2, -2)
Cp.prop = c(1/4, 3/4)
CpLocT = floor(Ts*Cp.prop)

myts = ts.sim(beta=betaT, XMat=XMatT, sigma=sigmaT, Delta=DeltaT, CpLoc=CpLocT, seed=1234)
TsPlotCheck(X=1:Ts, Xat=seq(from=1, to=Ts, length=10), Y=myts, tau=CpLocT)

changepointGA documentation built on April 4, 2025, 4:39 a.m.