Skip to contents

Considering a new dataset (across the same patches), computes forecasts based on the SDM passed as sdm.

Consider a linear predictor having linear and square terms associated with a variable \(x\). Assume this variable was centered before being included in the linear predictor. This functions returns the value of \(x\) (on its original scale) such that the linear predictor is maximized (or minimized).

Usage

predict_sdm(sdm, new_data, seed = 1, cores = 1)

Arguments

sdm

A list object containing the output of a fit_sdm call.

new_data

a data.frame with the dataset at which we wish to obtain predictions.

seed

a seed used for the forecasts. Forecasts are obtained through Monte Carlo samples from the posterior predictive distribution. Therefore, a seed is needed to ensure the results' reproducibility.

cores

number of threads used for the forecast. If four chains were used in the drm, then four (or less) threads are recommended.

Value

an object of class "CmdStanGQ" containing samples for the posterior predictive distribution for forecasting.

Details

The current version of the code assumes the data where forecasts are needed is ordered by "patch" and "site" and, in addition, its patches MUST be the same as the ones used to obtain the parameters' estimates from the the sdm object.

Author

lcgodoy