Description Usage Arguments Value See Also Examples
View source: R/simulatefluctuations.R
Simulate a time series of fluctuations based on specified underlying process. Options are AR(1), ARMA(1,1), P-splines or GPR.
1 2 | simulateFluctuations(nyears, prop.sample = 1, method, params, obs.err = T,
sigma.y = NULL, seed = 123)
|
nyears |
number of years of observation period |
prop.sample |
proportion of total years to 'observe'. Default is 1. |
method |
string to indicate type of method from which to simulate. Options are: "ar", "arma", "splines", "gp". |
params |
list of parameters needed to simulate from method specified. Each method takes different parameter arguments. See documentation for each process for more information.
|
obs.err |
whether or not to include observational error. Default is TRUE. |
sigma.y |
value of sd of observational error, if included |
seed |
value of random seed |
A data frame of observation times and y-values
GetAR
, GetARMA
, GetPSplines
, GetGP
1 2 3 4 5 6 7 8 9 | nyears <- 100
prop.sample <- 0.7
obs.err <- TRUE
sigma.y <- 0.5
seed <- 123
method <- "ar"
params <- list(rho = 0.5, sigma = 1, ystart = NULL, eps0.t = NULL)
res <- simulateFluctuations(nyears, prop.sample, method, params, obs.err, sigma.y)
ggplot(data = res, aes(x = t, y = y)) + geom_line() + geom_point() + theme_bw()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.