Learn R Programming

evgam (version 0.1.1)

predict.evgam: Predictions from a fitted evgam object

Description

Predictions from a fitted evgam object

Usage

# S3 method for evgam
predict(
  object,
  newdata = NULL,
  type = "link",
  probs = NULL,
  se.fit = FALSE,
  marginal = TRUE,
  ...
)

# S3 method for evgam fitted(object, ...)

Arguments

object

a fitted evgam object

newdata

a data frame

type

a character string giving the type of prediction sought; see Details. Defaults to "link"

probs

a scalar or vector of probabilities for quantiles to be estimated if type == "quantile"; defaults to 0.5

se.fit

a logical: should estimated standard errors be returned? Defaults to FALSE

marginal

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

...

unused

Value

A data frame or list of predictions, or a plot if type == "qqplot"

Details

There are five options for type: 1) "link" distribution parameters transformed to their model fitting scale; 2) "response" as 1), but on their original scale; 3) "lpmatrix" a list of design matrices; 4) "quantile" estimates of distribution quantile(s); and 5) "qqplot" a quantile-quantile plot.

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")
predict(m_gev, COprcp_meta)
predict(m_gev, COprcp_meta, type="response")
predict(m_gev, COprcp_meta, probs=.99)
COprcp_qq1 <- subset(COprcp_gev, name == "BOULDER")
predict(m_gev, COprcp_qq1, type="qqplot")
COprcp_qq2 <- subset(COprcp_gev, name %in% c("BOULDER", "FT COLLINS"))
predict(m_gev, COprcp_qq2, type="qqplot")
fitted(m_gev)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab