dataSinusoidal {DeCAFS} | R Documentation |
Generating data from a sinusoidal model with changes
Description
This function generates a sequence of observation from a sinusoidal model with changes. This can be used as an example for model misspecification.
Usage
dataSinusoidal(
n,
amplitude = 1,
frequency = 0.001,
phase = 0,
sd = 1,
type = c("none", "up", "updown", "rand1"),
nbSeg = 20,
jumpSize = 1
)
Arguments
n |
The length of the sequence of observations. |
amplitude |
The amplitude of the sinusoid |
frequency |
The angular frequency of the sinusoid |
phase |
where the signal starts at time t = 0 |
sd |
standard deviation of the noise added on top of the signal |
type |
Possible change scenarios for the jump structure (default: |
nbSeg |
Number of segments |
jumpSize |
Maximum magnitude of a change |
Value
A list containing:
y
the data sequence,
signal
the underlying signal without the noise,
changepoints
the changepoint locations
Examples
Y <- dataSinusoidal(
1e4,
frequency = 1 / 1e3,
amplitude = 10,
type = "updown",
jumpSize = 4,
nbSeg = 4
)
res <- DeCAFS(Y$y)
plot(res, col = "grey")
lines(Y$signal, col = "blue", lwd = 2, lty = 2)
abline(v = res$changepoints, col = 2)
abline(v = Y$changepoints, col = 4, lty = 2)
[Package DeCAFS version 3.3.3 Index]