merge_ppgrid: Merge a 'ppgrid' object to new data.

Description Usage Arguments Value Examples

Description

Find the just-in-time summarised response and weight for new data as informed by a ppgrid object. As train_ppgrid, merge_ppgrid expects ordered vectors.

Usage

1
merge_ppgrid(id_var, time_var, ppgrid, na_fill = FALSE)

Arguments

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.

ppgrid

ppgrid object produced by train_ppgrid.

na_fill

Boolean: whether to merge the furthest in the future values from train_ppgrid in the event that the new data's times are more advanced than the trained range.

Value

list containing the merged mean response and total weight for the input after merging with ppgrid. Ordered as input vectors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(1234)
ppdf <- make_longitudinal_data(1000)
ppdf_train <- ppdf[ppdf$date < 1150, ]
ppdf_test <- ppdf[ppdf$date >= 1150, ]
ppgrid <- train_ppgrid(ppdf_train$id,
                       ppdf_train$date,
                       ppdf_train$resp,
                       lag = 25,
                       window_size = 25,
                       granularity = 25)

merge_ppgrid(ppdf_test$id,
             ppdf_test$date,
             ppgrid)

DexGroves/ppR documentation built on May 6, 2019, 2:13 p.m.