sim.pw.ar2 {wbsts} | R Documentation |
Simulation of a piecewise constant AR(2) model
Description
The function simulates a piecewise constant AR(2) model with multiple change-points
Usage
sim.pw.ar2(N, sd_u, b.slope, b.slope2, br.loc)
Arguments
N |
Length of the series |
sd_u |
A vector of the innovation standard deviation for every segment |
b.slope |
A vector of the AR(1) coefficients |
b.slope2 |
A vector of the AR(2) coefficients |
br.loc |
A vector with the location of the change-points |
Value
A simulated series
Examples
cps=c(512,754)
y=sim.pw.ar2(N =1024,sd_u = 1,b.slope=c(0.9,1.68,1.32),
b.slope2 = c(0.0,-0.81,-0.81),br.loc = cps)[[2]]
ts.plot(y)
abline(v=cps,col="red")
[Package wbsts version 2.1 Index]