SimulateFakeMixedFrequencyData(nweeks,
xdim,
number.nonzero = xdim,
start.date = as.Date("2009-01-03"),
sigma.obs = 1.0,
sigma.slope = .5,
sigma.level = .5,
beta.sd = 10)
xdim
.zoo
time series containing the
monthly values to be modeled.zoo
time series containing the
weekly observations that aggregate to coarse.target
.zoo
matrix corresponding to
fine.target
containing the set of predictors variables to use
in bsts.mixed
prediction.fine.target
.fine.target
.sigma.slope
used to
simulate fine.target
.sigma.level
use to
simulate fine.target
.fine.target
, including regression effects.fine.target
, and the
weekly partial aggregates of coarse.target
.nweeks
to get the trend component. Next a nweeks
by xdim
matrix of predictor variables is
simulated as IID normal(0, 1) deviates, and a xdim
-vector of
regression coefficients is simulated as IID normal(0, beta.sd
).
The product of the predictor matrix and regression coefficients is
added to the output of the local linear trend model to get
fine.target
.
Finally, fine.target
is aggregated to the month level to get
coarse.target
.
Durbin and Koopman (2001), "Time series analysis by state space methods", Oxford University Press.
bsts.mixed
,
AddLocalLinearTrend
,fake.data <- SimulateFakeMixedFrequencyData(nweeks = 100, xdim = 10)
plot(fake.data$coarse.target)
Run the code above in your browser using DataLab