predict_all: Obtain all possible predictions with one call

Description Usage Arguments Value

View source: R/predict.R

Description

This function creates a data.frame with one row per subject and a column named "fits". The latter column contains the 3 possible subject-level predictions: fit - training data model predictions, fitgrid - grid-based model predictions, holdout - predictions for holdouts or out-of-sample predictions. Some of these predictions might be empty, e.g. when add_holdout = FALSE, no holdout predictions are made.

Usage

1
2
3
4
predict_all(modelfit, newdata, add_holdout = TRUE, add_grid = TRUE, tgrid,
  grid_size = 150, add_checkpoint = TRUE, checkpoint = as.integer(c(1,
  hbgd::months2days(1:24))), add_MSE = TRUE,
  verbose = getOption("growthcurveSL.verbose"))

Arguments

modelfit

Model fit object returned by fit_growth.

newdata

Subject-specific data for which predictions should be obtained.

add_holdout

Optional flag, set to TRUE to add holdout (out-of-sample) predictions used for scoring the current best model fit.

add_grid

Optional flag, set to TRUE to add a grid of equally spaced predictions over some range of the time variable for the current best model fit.

tgrid

Specify the grid of time-points directly. If missing a subject-specific grid is defined based on the subject's follow-up range.

grid_size

How many time-points should be used in equally spaced grid? This argument is only used when tgrid is missing.

add_checkpoint

Set to TRUE (default) to obtain predictions for pre-specified x checkpoint (essentially the same thing as grid, but with potentially different spacings).

checkpoint

The grid of checkpoint for which to obtain predictions (daily resolution).

add_MSE

Add subject-specific MSE for growth curve prediction (NOT IMPLEMENTED).

verbose

Set to TRUE to print messages on status and information to the console.

Value

A data.frame with one row per subject. The column named "fit" contains nested subject-specific observed data and predictions. Each entry (cell) of "fit" is a list of 4 subject-specific data.frames, named "xy", "fit", "fitgrid" and "holdout", containing the training time-outcome values, the model predictions for training data, the grid of equally spaced model prediction and the holdout / out-of-sample predictions, respectively.


osofr/growthcurveSL documentation built on May 24, 2019, 4:56 p.m.