powered by
sim_ts() is mostly a helper function, to be used internally in this package, but you can use it here to simulate a time series.
sim_ts()
sim_ts(n, b0 = 0, bt = 0, rho = 1, white_noise = FALSE, rsd = 1)
sim_ts() returns a numeric vector of a simulated time series that would follow the user's input.
a numeric vector for the length of the series
a numeric vector for a potential drift in the series. Defaults to 0
a numeric vector for a potential trend in the series. Defaults to 0.
a numeric vector for the simple autoregressive parameter. Defaults to 1.
= logical, defaults to FALSE. If FALSE, generates a random walk. If TRUE, series is white noise.
the standard deviation for a normal distribution to be simulated. Defaults to 1.
Steven V. Miller
set.seed(8675309) # don't want new numbers in documentation every time... sim_ts(25) sim_ts(25, b0 = 1) sim_ts(25, b0 = 1, bt = .05)
Run the code above in your browser using DataLab