Description Usage Arguments Details Value Examples
Create a function that will perform sample splitting. Initialise it once
by calling split_templ
and then re-use where applicable.
1 2 | split_templ(Nburn = 0, Npre = 0, Nest = 0, Ntrain = 0, Neval = 0,
Noos = 0)
|
Nburn |
An integer scalar. The number of burn-in observations in a simulation context. These are observations that are non-existent if the data are actual observation and not synthetically created for simulation purposes. |
Npre |
An integer scalar. The number of pre-sample observations for lags etc. |
Nest |
An integer scalar. The number of observations available for estimation. |
Ntrain |
An integer scalar. The number of observations for training, e.g. hyperparameters, forecasts. |
Neval |
An integer scalar. The number of observations for model evaluation. |
Noos |
An integer scalar. The number of true out-of-sample observations for simulation purposes. Can be used for evaluating the final outcome (model choice etc.). |
The function split_templ
is a template for creating another function. This
other function will accept a (K x N)
matrix holding N
observations of K
variables and will slice the columns of that matrix according to the numbers
passed to split_templ
.
A list with six elements. Each of which is a numeric matrix
corresponding to one of the six arguments passed to split_templ
. Every
matrix has K
rows and as many columns as specified in split_templ
. If
an argument of split_sample
is zero (the default), then the matrix will
have zero columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | p <- 2
N <- 25
Npre <- 2
Nest <- N
Noos <- 5
Nsim <- Npre + Nest + Noos
Y <- matrix(1:Nsim, 1, Nsim)
split_sample <- split_templ(Npre = Npre, Nest = Nest, Noos = Noos)
spl <- split_sample(Y)
spl$est
## Not run:
split_sample_wrong <- split_templ(Npre = Npre, Nest = Nest)
split_sample_wrong(Y)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.