simulate_step_trend | R Documentation |
Simulate data from a linear trend model
simulate_step_trend( t, change_points, means, sampling_distribution = NULL, seed = NULL, ... )
t |
numeric; vector of time points. |
change_points |
numeric; vector of change points, within |
means |
numeric; vector of means for the regimes implied by
|
sampling_distribution |
function; a random number generating function,
which takes as it's first argument the number of observations to sample.
The second argument should be the expected value. The default, if nothing
is supplied, is |
seed |
numeric; a seed for the simulation. |
... |
additional arguments that will be passed to
|
sims <- simulate_step_trend(1:100, change_points = c(25, 75), means = c(2, 8, 4)) sims library("ggplot2") ggplot(sims, aes(x = t, y = y)) + geom_point() + geom_step(aes(y = trend))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.