View source: R/project_model.R
project_model | R Documentation |
project_model
simulates random effects forward in time, for use to
generate a predictive interval without actually re-fitting the model.
This is useful e.g., to generate end-of-century projections.
project_model(
x,
n_proj,
n_samples = 1,
new_covariate_data = NULL,
historical_uncertainty = "both",
seed = 123456,
working_dir = paste0(getwd(), "/"),
what = NULL
)
x |
Output from |
n_proj |
Number of time-steps to include in projection |
n_samples |
Number of samples to include. If |
new_covariate_data |
New covariates to include for future intervals |
historical_uncertainty |
Whether to incorporate uncertainty about fitted interval
|
The function specifically simulates new values for random effects occurring during forecasted years. This includes some combination of intercepts beta1/beta2 and spatio-temporal terms epsilon1/epsilon2 depending on which are treated as random during estimation. It does *not* generate new values of covariates or random-effects that are not indexed by time omega1/omega2
Note that the model may behave poorly when historical_uncertainty="both"
and the estimation model includes an AR1 process for any component.
Given this combination of features, some samples may have a 'rho' value >1
or <1, which will result in exponential growth for any such sampled value.
This behavior could be improved in future code updates by using tmbstan
instead of the normal approximation to generate parametric uncertainty
during the historical period.
Similarly, estimating a RW process for epsilon will result in an exponential increase in forecasted total abundance over time. This occurs because the variance across locations of epsilon increases progressively during the forecast period, such that the index is again dominated by the forecasted density at a few sites.
All obj$report()
output for a single simulation of historical period
as well as n_proj
forecast intervals
## Not run:
# Run model
fit = fit_model( ... )
# Add projection
project_model( x = fit,
n_proj = 80,
new_covariate_data = NULL,
historical_uncertainty = "both",
seed = NULL )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.