ts_data {exams.forge} | R Documentation |
Time Series
Description
Creates an univariate time series based on a linear or an exponential trend, an additive or multiplicative seasonal adjustment and with white noise.
Usage
ts_data(
end,
trend = TRUE,
trend.coeff = c(1, 1),
season = TRUE,
season.coeff = NULL,
error = TRUE,
error.coeff = NULL,
digits = NA
)
dts(
end,
trend = TRUE,
trend.coeff = c(1, 1),
season = TRUE,
season.coeff = NULL,
error = TRUE,
error.coeff = NULL,
digits = NA
)
Arguments
end |
integer: length of time series |
trend |
logical: if |
trend.coeff |
numeric: coefficients for a linear model (default: |
season |
logical: if |
season.coeff |
numeric: coefficients for the adjustment (default: |
error |
logical: if |
error.coeff |
numeric: standard deviation(s) for white noise error (default: |
digits |
integer: number of digits to round the time series (default: |
Value
A ts_data object with the following list of elements:
-
t
the time points -
s
the season for the time points -
xt
the time series values
Examples
# Time series from linear trend
ts <- ts_data(12, trend.coeff= c(sample(0:10, 1), sample(1+(1:10)/20, 1)))
ts
# Time series from exponential trend
ts <- ts_data(12, trend.coeff= c(sample(0:10, 1), sample(1+(1:10)/20, 1)), trend=FALSE)
ts
# Time series from linear trend and additive seasonal adjustment (quartely data)
ts <- ts_data(12, trend.coeff=c(sample(0:10, 1), sample(1+(1:10)/20, 1)),
season.coeff=sample((-20:20)/20, 4))
ts
# Time series from linear trend and additive seasonal adjustment (half-yearly data)
ts <- ts_data(12, trend.coeff=c(sample(0:10, 1), sample(1+(1:10)/20, 1)),
season.coeff=sample((-20:20)/20, 2))
ts
# Time series from linear trend and mutliplicative seasonal adjustment (quartely data)
ts <- ts_data(12, trend.coeff=c(sample(0:10, 1), sample(1+(1:10)/20, 1)),
season.coeff=sample((-20:20)/20, 4), season=FALSE)
ts