View source: R/samps_to_scens.R
samps_to_scens | R Documentation |
This function produces a list of multivariate scenario forecasts in the marginal domain from the spatial/temporal/spatiotemporal gaussian covariance matrices and marginal distributions
samps_to_scens(
copulatype,
no_samps,
marginals,
sigma_kf,
mean_kf,
control,
mcmapply_cores = 1L,
mvnfast_cores = 1L,
chunk_dir = NULL,
...
)
copulatype |
As |
no_samps |
Number of scenarios to sample |
marginals |
a named list of marginal distributions,
e.g. if class is |
sigma_kf |
a named list of the covariance matrices with elements corresponding to cross-validation folds. |
mean_kf |
a named list of the mean vectors with elements corresponding to cross-validation folds. |
control |
a named list of with nested control parameters
(named according to |
mcmapply_cores |
Defaults to 1. Warning, only change if not using
Windows OS — see the |
mvnfast_cores |
defaults to 1. See |
chunk_dir |
a character string containing a directory for storing temporary chunked
datasets per fold. Useful for very high dimensional distributions or many samples.
Defaults to |
... |
extra arguments to |
This is a sampling function for the Gaussian copula with marginals
specified by MultiQR
or PPD
objects and user-specified covariance
matrix.
A list
of data.table
objects containing multivariate forecasts.
For spatio-temporal scenarios, each site must have the same number of inputs to the governing covariance matrix.
For multiple locations the ordering of the lists
of the margins & control, and the structure of the covariance
matrices is very important: if the columns/rows in each covariance
matrix are ordered loc1_h1, loc1_h2,..., loc2_h1, loc2_h_2,...,
loc_3_h1, loc_3_h2,...
i.e. location_leadtime — then the list of
the marginals should be in the same order loc1, loc2, loc3,....
Ensure cross-validation fold names in the control list do not change within any issue time — i.e. make sure the issue times are unique to each fold.
Ciaran Gilbert, ciaran.gilbert@strath.ac.uk
## Not run:
# for parametric type marginals with a Generalized Beta type 2 family
scens <- samps_to_scens(copulatype = "temporal",no_samps = 100,marginals = list(loc_1 = param_margins),sigma_kf = cvm,mean_kf = mean_vec,
control=list(loc_1 = list(kfold = loc_1data$kfold, issue_ind = loc_1data$issue_time, horiz_ind = loc_1data$lead_time,
q_fun = gamlss.dist::qGB2)))
## End(Not run)
## Not run:
# for MQR type marginals
scens <- samps_to_scens(copulatype = "temporal",no_samps = 100,marginals = list(loc_1 = mqr_gbm_1),sigma_kf = cvm,mean_kf = mean_vec,
control=list(loc_1 = list(kfold = loc_1data$kfold, issue_ind = loc_1data$issue_time, horiz_ind = loc_1data$lead_time,
PIT_method = "linear",CDFtails= list(method = "interpolate", L=0,U=1))))
## End(Not run)
## Not run:
# for spatio-temporal scenarios with MQR type marginals
scens <- samps_to_scens(copulatype = "temporal", no_samps = 100,marginals = list(loc_1 = mqr_gbm,loc_2 = mqr_gbm_2),sigma_kf = cvm_2,mean_kf = mean_vec_2,
control=list(loc_1 = list(kfold = loc_1data$kfold, issue_ind = loc_1data$issue_time, horiz_ind = loc_1data$lead_time,
PIT_method = "linear",CDFtails= list(method = "interpolate", L=0,U=1)),
loc_2 = list(kfold = loc_2data$kfold, issue_ind = loc_2data$issue_time, horiz_ind = loc_2data$lead_time,
PIT_method = "linear", CDFtails = list(method = "interpolate", L=0, U=1))))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.