predLMrisk: Calculate w-year risk from a landmark time point

View source: R/predLMrisk.R

predLMriskR Documentation

Calculate w-year risk from a landmark time point

Description

Calculate w-year risk from a landmark time point

Usage

predLMrisk(
  supermodel,
  newdata,
  tLM,
  cause,
  w,
  extend = F,
  silence = F,
  complete = T
)

Arguments

supermodel

fitted landmarking supermodel

newdata

dataframe of individuals to make predictions for. Must contain the original covariates (i.e., without landmark interaction)

tLM

time points at which to predict risk of w more years. Note tLM must be one value for newdata or must have the same length as the number of rows of newdata (i.e., each datapoint is associated with one LM/prediction time point).

cause

Cause of interest if under competing risks.

w

Prediction window, i.e., predict w-year (/month/..) risk from each of the tLMs. Defaults to the w used in model fitting. If w > than that used in model fitting, results are unreliable, but can be produced by setting extend=T.

extend

Argument to allow for predictions at landmark times that are greater than those used in model fitting, or prediction windows greater than the one used in model fitting. Default is FALSE. If set to TRUE, predictions may be unreliable.

silence

Silence the warning message when extend is set to TRUE.

complete

Only make predictions for data entries with non-NA entries (i.e., non-NA predictions). Default is TRUE.

Details

See the Github for example code

Value

An object of class "LMpred" with components:

  • preds: a dataframe with columns LM and risk, each entry corresponds to one individual and prediction time point (landmark)

  • w, type, LHS: as in the fitted super model

  • data: the newdata given in input


anyafries/dynLM documentation built on July 26, 2022, 12:17 a.m.