Skip to contents

Prepare case data and predictor variables for forecast models

Usage

prep_data(
  raw_data,
  y_var,
  lagged_vars,
  scaled_vars,
  lag_n = 3,
  graph_poly = NULL
)

Arguments

raw_data

data.frame containing the variables

y_var

name of variable to predict

lagged_vars

string vector of names of variables to lag

scaled_vars

string vector of names of variables to scale

lag_n

number of months by which to lag the lagged variables. Default = 3.

graph_poly

sf object to be used to create graph for INLA model (optional). Default = NULL.

Value

list of cleaned data, spatial graph for INLA (if not null), and scale and centering factors used in treatment