simulate.fake.mixed.frequency.data | R Documentation |
Simulate a fake data set that can be used to test mixed frequency code.
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)
nweeks |
The number of weeks of data to simulate. |
xdim |
The dimension of the predictor variables to be simulated. |
number.nonzero |
The number nonzero coefficients. Must be
less than or equal to |
start.date |
The date of the first simulated week. |
sigma.obs |
The residual standard deviation for the fine time scale model. |
sigma.slope |
The standard deviation of the slope component of the local linear trend model for the fine time scale data. |
sigma.level |
The standard deviation of the level component fo the local linear trend model for the fine time scale data. |
beta.sd |
The standard deviation of the regression coefficients to be simulated. |
The simulation begins by simulating a local linear trend model for
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
.
Returns a list with the following components
coarse.target |
A |
fine.target |
A |
predictors |
A |
true.beta |
The vector of "true" regression coefficients used to
simulate |
true.sigma.obs |
The residual standard deviation that was used to
simulate |
true.sigma.slope |
The value of |
true.sigma.level |
The value of |
true.trend |
The combined contribution of the simulated latent
state on |
true.state |
A matrix containin the fine-scale state of the model
being simulated. Columns represent time (weeks). Rows correspond
to regression (a constant 1), the local linear trend level, the
local linear trend slope, the values of |
Steven L. Scott steve.the.bayesian@gmail.com
Harvey (1990), "Forecasting, structural time series, and the Kalman filter", Cambridge University Press.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.