simulateFluctuations: Simulate time series of fluctuations

Description Usage Arguments Value See Also Examples

View source: R/simulatefluctuations.R

Description

Simulate a time series of fluctuations based on specified underlying process. Options are AR(1), ARMA(1,1), P-splines or GPR.

Usage

1
2
simulateFluctuations(nyears, prop.sample = 1, method, params, obs.err = T,
  sigma.y = NULL, seed = 123)

Arguments

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.

  • AR: specify nyears, rho, sigma

  • ARMA: specify nyears, phi, theta, sigma.ar

  • Splines: specify x.i, degree

  • GP: specify covariance function (sqexp or matern). For sqexp specify nyears, tau, l. For matern specify nyears, tau, smoothness and range.

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

Value

A data frame of observation times and y-values

See Also

GetAR, GetARMA, GetPSplines, GetGP

Examples

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()

MJAlexander/distortr documentation built on July 17, 2020, 4:06 p.m.