stPredict: Compute forecasts based on posterior samples

Description Usage Arguments Examples

View source: R/stPredict.R

Description

Predict response at new timepoints by drawing samples of the response from the posterior predictive distribution. Since this requires sampling teleconnection effects, this method can return estimates of the teleconnection effects as a by-product.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
stPredict(
  stFit,
  stData,
  stDataNew,
  burn = 1,
  prob = 0.95,
  ncores = 1,
  conf = 0.95,
  tLabs = stDataNew$tLabs,
  X = stData$X,
  Y = stData$Y,
  Z = stData$Z,
  Xnew = stDataNew$X,
  Znew = stDataNew$Z,
  coords.s = stData$coords.s,
  coords.r = stData$coords.r,
  returnAlphas = T,
  cat.probs = c(1/3, 2/3),
  returnFullAlphas = F
)

Arguments

stFit

Object with class 'stFit' containing posterior parameter samples needed to composition sample the teleconnection effects and generate posterior predictions. The data needed from stFit need only be manually entered if not using a stData object.

stData

Object with class 'stData' containing data needed to fit this model. The data need only be manually entered if not using a stData object.

stDataNew

object of class stData that includes information needed for making forecasts. If response data is included, this function will automatically run stEval using the empirical climatology as the reference forecast

burn

number of posterior samples to burn before drawing composition samples

prob

confidence level for approximate confidence intervals of teleconnection effects (only needed if returnAlphas==TRUE)

ncores

Since the teleconnection effects and posterior predictions can be sampled in parallel, this parameter lets users specify the number of cores to use to draw teleconnection and prediction samples

conf

Parameter specifying the HPD level to compute for posterior predictive samples

tLabs

Forecast timepoint labels

X

[ns, p, nt] array of design matrices with local covariates

Y

[ns, nt] matrix with response data

Z

[nr, nt] matrix with remote covariates

Xnew

[ns, p, nt0] array of design matrices with local covariates at forecast timepoints

Znew

[nr, nt0] matrix with remote covariates at forecast timepoints

coords.s

matrix with coordinates where responses were observed (lon, lat)

coords.r

matrix with coordinates where remote covariates were observed (lon, lat)

returnAlphas

TRUE to return the teleconnection effects sampled at knot locations. Note that only basic summary information about the teleconnection effects will be returned.

cat.probs

vector of probabilities for also returning categorical predictions from the posterior prediction samples; NULL otherwise

returnFullAlphas

TRUE to return the teleconnection effects. Note that only basic summary information about the teleconnection effects will be returned.

Examples

1
2
3
4
5
6
7
8
set.seed(2018)
  
data("coprecip")
data("coprecip.fit")

coprecip.predict = stPredict(stFit = coprecip.fit, stData = coprecip, 
                             stDataNew = coprecip, burn = 90, 
                             returnFullAlphas = FALSE)

jmhewitt/telefit documentation built on Feb. 9, 2020, 7:15 p.m.