Description Usage Arguments Value Examples
Produces a grid of weighted mean and total weight for the preceding period of
each group-time combination. All parameters are taken as vectors that are
assumed to be associated and in the same order.
train_ppgrid will compute
~ granularity * (max(time_var) - min(time_var) - window_size) distinct
aggregations for each distinct id_var.
1 2  | train_ppgrid(id_var, time_var, response_var, wt_var = rep(1,
  length(response_var)), lag, window_size, granularity)
 | 
id_var | 
 Vector identifying the groups.  | 
time_var | 
 Numeric vector of time, there is no support for character time vectors or other datetime datatypes yet.  | 
response_var | 
 Numeric vector of responses to summarise.  | 
wt_var | 
 Optional numeric weight vector. Defaults to 1.0.  | 
lag | 
 Number of units of time to lag the variable accumulation before scoring. Useful if there is a period after data acquisition before the response is known; this parameter can mimic model implementation.  | 
window_size | 
 Number of units of time to aggregate the response and weight variables over.  | 
granularity | 
 How severely to round the input time variable. Times will be rounded to the nearest granularity. Improves runtime at nominal cost to accuracy.  | 
ppgrid object, containing a data.table containing prior period information as well as some input parameters.
1 2 3 4 5 6 7 8 9 10 11  | set.seed(1234)
ppdf <- make_longitudinal_data(1000)
ppgrid <- train_ppgrid(ppdf$id,
                       ppdf$date,
                       ppdf$resp,
                       lag = 25,
                       window_size = 25,
                       granularity = 25)
print(ppgrid)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.