Description Usage Arguments Details Value Examples
lagData creates two matrix variables: one with the lagged covariates, and a second with the indices used in the smooth term from mgcv.
1 |
lagData |
data.frame or tibble containing the predictor variables to be created as lags. Must be sorted by Location, year, month. |
response |
data.frame or tibble with the response and one-per-case covariates |
unit |
character string variable name in lagData by which to lag |
startUnit |
integer where to start the lagging |
nUnits |
integer how many rows to lag backwards |
measure |
character string name of column in lagData to convert to matrices |
Assumes that lagData have already been aggregated to the appropriate resolution.
lagData should have nrows(response)*nUnits - startUnit
*not true.
returns a dataframe or tibble with as many rows as response, and two new matrix columns
1 2 3 | test <- lagData(env_data, response_data, unit = "month", 6, 24, "envVar")
dim(test$envVar_6_24)
test$lag_6_24[1:5,1:5]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.