
gts
object based on a supplied time series model.
gen.gts(model, N = 1000, start = 0, end = NULL, freq = 1, unit = NULL, name = NULL)
ts.model
or gmwm
object containing one of the allowed models.interger
containing the amount of observations for the time series.numeric
that provides the time of the first observation.numeric
that provides the time of the last observation.numeric
that provides the rate of samples. Default value is 1.string
that contains the unit expression of the frequency. Default value is NULL
.string
that provides an identifier to the data. Default value is NULL
.gts
object with the following attributes:
ts.model
object (e.g. AR1(phi = .3, sigma2 =1) + WN(sigma2 = 1)) or a gmwm
object.
# Set seed for reproducibility
set.seed(1336)
n = 1000
# AR1 + WN
model = AR1(phi = .5, sigma2 = .1) + WN(sigma2=1)
x = gen.gts(model, n)
x
plot(x)
set.seed(1336)
# GM + WN
# Convert from AR1 to GM values
m = ar1_to_gm(c(.5,.1),10)
# Beta = 6.9314718, Sigma2_gm = 0.1333333
model = GM(beta = m[1], sigma2_gm = m[2]) + WN(sigma2=1)
x2 = gen.gts(model, n, freq = 10, unit = 'sec')
x2
plot(x2, to.unit = 'min')
# Same time series
all.equal(x, x2, check.attributes = FALSE)
Run the code above in your browser using DataLab