sim_ts: Simulate a Time Series

View source: R/sim_ts.R

sim_tsR Documentation

Simulate a Time Series

Description

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.

Usage

sim_ts(n, b0 = 0, bt = 0, rho = 1, white_noise = FALSE, rsd = 1)

Arguments

n

a numeric vector for the length of the series

b0

a numeric vector for a potential drift in the series. Defaults to 0

bt

a numeric vector for a potential trend in the series. Defaults to 0.

rho

a numeric vector for the simple autoregressive parameter. Defaults to 1.

white_noise

= logical, defaults to FALSE. If FALSE, generates a random walk. If TRUE, series is white noise.

rsd

the standard deviation for a normal distribution to be simulated. Defaults to 1.

Value

sim_ts() returns a numeric vector of a simulated time series that would follow the user's input.

Author(s)

Steven V. Miller

Examples


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)


sTSD documentation built on April 3, 2025, 7:37 p.m.