generate_sample {EcoEnsemble} | R Documentation |
Generate samples from a fitted ensemble model.
Description
Methods to generates samples of the latent variables from a fitted ensemble model.
Usage
generate_sample(fit, num_samples = 1)
get_transformed_data(fit)
get_parameters(ex.fit, x = 1)
get_mle(x = 1, ex.fit, transformed_data, time)
gen_sample(x = 1, ex.fit, transformed_data, time)
get_transformed_data_dri(fit)
Arguments
fit |
An |
num_samples |
A |
ex.fit |
A |
x |
A |
transformed_data |
A |
time |
A |
Details
The samples are created using the methods described in Strickland et. al. (2009) and Durbin and Koopman (2002).
Value
generate_sample
gives a list
of length 2, the first element being the MLE of latent variables and the second element being a set of samples of the latent variables.
If
fit
is a sampling of the ensemble model parameters, then:-
mle
is atime
\times (3M + 2) \times
num_samples
array
, whereM
is the number of simulators andnum_samples
is the number of samples from the ensemble model, giving the MLE of the latent variables for each available sample from the ensemble model. -
sample
is atime
\times (3M + 2) \times
num_samples
array
, giving a sample of the latent variables for each available sample of the ensemble model.
-
If
fit
is a point estimate of the ensemble model parameters, then:-
mle
is atime
\times (3M + 2) \times
1array
giving the MLE of the latent variables for the point estimate of the ensemble model. -
sample
is atime
\times (3M + 2) \times
num_samples
array
, givingnum_samples
samples of the latent variables for the single point estimate of the ensemble model.
-
get_transformed_data
gives a list
of transformed input data.
get_parameters
gives a list
of ensemble parameters from the requested sample.
get_mle
If fit
is a sampling of the ensemble model parameters, then this is a time
\times (3M + 2) \times
num_samples
array
. If fit
is a point estimate of the ensemble model parameters, then this is a time
\times (3M + 2) \times
1 array
giving the MLE of the latent variables for the point estimate of the ensemble model.
gen_sample
If fit
is a sampling of the ensemble model parameters, then this is a time
\times (3M + 2) \times
num_samples
array
, giving a sample of the latent variables for each available sample of the ensemble model. If fit
is a point estimate of the ensemble model parameters, then this is a time
\times (3M + 2) \times
num_samples
array
.
References
J. Durbin, S. J. Koopman (2002) A simple and efficient simulation smoother for state space time series analysis Biometrika, Volume 89, Issue 3, August 2002, Pages 603–616,
Chris M.Strickland, Ian. W.Turner, Robert Denhamb, Kerrie L.Mengersena. Efficient Bayesian estimation of multivariate state space models Computational Statistics & Data Analysis Volume 53, Issue 12, 1 October 2009, Pages 4116-4125
Examples
fit <- fit_ensemble_model(observations = list(SSB_obs, Sigma_obs),
simulators = list(list(SSB_ewe, Sigma_ewe, "EwE"),
list(SSB_fs, Sigma_fs, "FishSUMS"),
list(SSB_lm, Sigma_lm, "LeMans"),
list(SSB_miz, Sigma_miz, "Mizer")),
priors = EnsemblePrior(4,
ind_st_params = IndSTPrior(parametrisation_form = "lkj",
var_params= list(1,1), cor_params = 10, AR_params = c(2, 2))),
full_sample = FALSE) #Only optimise in this case
samples <- generate_sample(fit, num_samples = 2000)