View source: R/generateSinusoidal.R
dataSinusoidal | R Documentation |
This function generates a sequence of observation from a sinusoidal model with changes. This can be used as an example for model misspecification.
dataSinusoidal( n, amplitude = 1, frequency = 0.001, phase = 0, sd = 1, type = c("none", "up", "updown", "rand1"), nbSeg = 20, jumpSize = 1 )
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 |
A list containing:
y
the data sequence,
signal
the underlying signal without the noise,
changepoints
the changepoint locations
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.