simulate.evgam: Simulations from a fitted 'evgam' object

View source: R/generic.R

simulate.evgamR Documentation

Simulations from a fitted evgam object

Description

Simulations from a fitted evgam object

Usage

## S3 method for class 'evgam'
simulate(
  object,
  nsim = 1000,
  seed = NULL,
  newdata,
  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


data(fremantle)
fmla_gev <- list(SeaLevel ~ s(Year, k=5, bs="cr"), ~ 1, ~ 1)
m_gev <- evgam(fmla_gev, fremantle, family = "gev")
# simulations of link GEV parameters for fremantle data
simulate(m_gev, nsim=5)
# simulations for Year 1989
y1989 <- data.frame(Year = 1989)
# link GEV parameter simulations
simulate(m_gev, nsim=5, newdata = y1989)
# GEV parameter simulations
simulate(m_gev, nsim=5, newdata = y1989, type = "response")
# 10-year return level simulations
simulate(m_gev, nsim=5, newdata = y1989, type= "quantile", prob = .9)
# 10- and 100-year return level simulations
simulate(m_gev, nsim=5, newdata = y1989, type= "quantile", prob = c(.9, .99))


evgam documentation built on June 28, 2022, 5:07 p.m.

Related to simulate.evgam in evgam...