predict.OM: Predict for OM object

Description Usage Arguments Value Examples

View source: R/predict_OM.R

Description

Does a hindcast and forecast with OM model. Optionally a previously fitted SDM can be passed in in to avoid having to refit the SDM. If sdm is not passed in, it will be fit using the model argument. Both a hindcast and a forecast will be returned. If model is "gam", then 95 be returned also.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'OM'
predict(
  object,
  model = c("gam", "brt", "mlp"),
  newdata = NULL,
  start.forecast.year = 2021,
  sdm = NULL,
  alpha = 0.6826895,
  silent = FALSE,
  ...
)

Arguments

object

OM object

model

Type of SDM. gam, brt or mlp. Only needed if sdm is not passed in.

newdata

(optional) Optional new data frame over which to do the prediction.

start.forecast.year

The years equal or less will be used for fitting and the years greater than are the forecasted years.

sdm

(optional) Previously fitted SDM model

alpha

The CIs alpha. Default is 1 sigma (alpha = 68%)

silent

No output printed.

...

Any extra parameters for the sdm fitting functions, for example k for gam_sdm

Value

Invisibly returns a data frames with the prediction. If newdata is not passed in, then the hindcast and forecast prediction is returned. The "type" column has "hindcast" and "forecast" to indicate which is which. This data frame is the same shape as object$grid except the extra column "type". The first 6 rows of the prediction are printed unless silent=TRUE. If "newdata" is passed in then the prediction for the new data only is returned. "newdata" must be a data frame with the required covariates.

Examples

1
2
3
sim <- SimulateWorld(start.year=2015, n.year=20)
fit <- mlp_sdm(sim, "temp")
pred <- predict(sim, sdm=fit)

eeholmes/WRAP documentation built on Feb. 18, 2021, 10:51 a.m.