Learn R Programming

evgam (version 0.1.1)

simulate.evgam: Simulations from a fitted evgam object

Description

Simulations from a fitted evgam object

Usage

# S3 method for evgam
simulate(
  object,
  nsim = 1000,
  seed = NULL,
  newdata = NULL,
  type = "link",
  probs = NULL,
  threshold = 0,
  marginal = TRUE,
  ...
)

Arguments

object

a fitted evgam object

nsim

an integer giving the number of simulations

seed

an integer giving the seed for simulations

newdata

a data frame

type

a character string, as in predict.evgam; defaults to "quantile"

probs

a scalar or vector of probabilities for quantiles; defaults to NULL

threshold

a scalar, vector or matrix, which is added to each simulation if family == "gpd"; defaults to 0

marginal

a logical: should simulations integrate out smoothing parameter uncertainty? Defaults to TRUE

...

arguments to be passed to predict.evgam

Value

Simulations of parameters or quantiles

See Also

predict.evgam

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
library(evgam)
data(COprcp)
COprcp$year <- format(COprcp$date, "%Y")
COprcp_gev <- aggregate(prcp ~ year + meta_row, COprcp, max)
COprcp_gev <- cbind(COprcp_gev, COprcp_meta[COprcp_gev$meta_row,])
fmla_gev <- list(prcp ~ s(lon, lat, k=30) + s(elev, bs="cr"), ~ s(lon, lat, k=20), ~ 1)
m_gev <- evgam(fmla_gev, data=COprcp_gev, family="gev")
simulate(m_gev)
simulate(m_gev, probs=c(.95, .99))

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab