Skip to contents

Fit an INLA model to one cv_set and get prediction intervals

Usage

fit_inla(
  cv_set,
  y_var,
  pred_vars,
  id_vars,
  reff_var = NULL,
  hyper_priors = list(prec.unstruct = c(1, 5e-04), prec.spatial = c(1, 5e-04),
    prec.timerw1 = c(1, 0.01)),
  return_model = FALSE,
  quantile_levels = c(0.01, 0.025, seq(0.05, 0.95, by = 0.05), 0.975, 0.99),
  sample_pi = FALSE,
  W_orgUnit = NULL,
  verbose = FALSE
)

Arguments

cv_set

list object containing analysis and assessment data.frames

y_var

string name of column of observed values

pred_vars

vector string of predictor variables to use in model

id_vars

names of columns used as keys/ids in data.frames

reff_var

string or formula for random effects

hyper_priors

priors for spatial and temporal random effects

return_model

whether or not to return the INLA model in addition to predictions

quantile_levels

quantile levels to use when predicted via quantile regression. Default = c(0.01,0.025, seq(0.05,0.95, by = 0.05), 0.975, 0.99)

sample_pi

whether to estimate the prediction intervals by sampling the posterior. Default (FALSE) uses a trick to put all error into an iid random effect.

W_orgUnit

graph of orgUnit to use in spatial structure. If NULL (default), will not fit a spatial structure.

verbose

whether to run the INLA model verbosely. Default = FALSE

Value

dataframe of predictions intervals