gen.piece.poly {changepoints}R Documentation

Generate univariate data from piecewise polynomials of degree at most r.

Description

Generate univariate data from piecewise polynomials (currently, only the linear, quadratic functions and cubic functions are considered).

Usage

gen.piece.poly(init_coef_vec, cpt_vec, kappa_mat, n, sigma)

Arguments

init_coef_vec

A (r+1)-dim numeric vector of coefficients for the first segment.

cpt_vec

A K-dim integer vector of change points.

kappa_mat

A (r+1)xK numeric matrix where the i-th column represents the jump sizes for coefficients associated with the i-th change point.

n

An integer scalar of sample size.

sigma

A numeric scalar of standard deviation of error terms.

Value

A vector of data generated from piecewise polynomials.

Author(s)

Haotian Xu

References

Yu and Chatterjee (2020) <arXiv:2007.09910>.

Examples

r = 2
init_coef_vec = c(-2, 2, 9)
cpt_true = c(100, 200)
n = 300
sigma = 1
kappa_mat = cbind(c(3, 9, -27), c(-3, 9, -27))
plot.ts(gen.piece.poly(init_coef_vec, cpt_true, kappa_mat, n, sigma), ylab = "y")

[Package changepoints version 1.1.0 Index]