Learn R Programming

This package is designed to help the user perform dynamic prediction using a landmark model. Dynamic prediction means that risk predictions of an event are updated as more longitudinal data is collected. There is the option to use the last observation carried forward (LOCF) or linear mixed effects (LME) model in the first stage of the two-stage landmark model. This package allows the user to account for competing risks by using either the Fine Gray model or cause-specific model (or the Cox model) in the second stage of the two-stage landmark model. k-fold cross-validation can be performed using this package.

For more detailed examples and for an explanation of landmark models, see https://isobelbarrott.github.io/Landmarking/.

Installation

You can install the development version of this package from GitHub with:

install.packages("devtools")
devtools::install_github("isobelbarrott/Landmarking")

A simple example

Below is a simple example of how to use this package with the pbc2 dataset from package JM to predict the risk of death for a new patient.

This uses the LOCF method for the first stage of the landmark model and cause-specific model for the second stage.

#Load the library and dataset
library(Landmarking)
data(pbc2,package="JM")
#Change levels to make the death the event of interest (event_status=1), transplant the competing risks (event_status=2), and leave censoring (event_status=0)
levels(pbc2$status)<-c("0","2","1")
#Calculate the age of the patient at each assessment (as opposed to time since first assessment)
pbc2$years<-pbc2$years+pbc2$age
#Fit the landmark model
data_model_landmark_LOCF<-fit_LOCF_landmark(data=pbc2,
                                                  x_L=40,
                                                  x_hor=45,
                                                  covariates=c("drug","serBilir","serChol"),
                                                  covariates_time="year",
                                                  individual_id="id",
                                                  event_time="years",
                                                  event_status="status",
                                                  survival_submodel = "cause_specific",
                                                  b=50)
#Define new dataset
newdata<-rbind(data.frame(id=c(313,313,313),year=c(30,32,35),drug=c("placebo","placebo","placebo"),serBilir=c(2.4,2.7,2.6),serChol=c(220,234,234)))
#Return event prediction and LOCF values
predict(object=data_model_landmark_LOCF,x_L=40,x_hor=45,newdata=newdata)

Copy Link

Version

Install

install.packages('Landmarking')

Monthly Downloads

232

Version

1.0.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Isobel Barrott

Last Published

February 15th, 2022

Functions in Landmarking (1.0.0)

fit_LOCF_longitudinal

Find the last observation carried forward (LOCF) values for covariates in a dataset
data_repeat_outcomes

Simulated repeat measurement and time-to-event data
get_model_assessment

Compute C-index and Brier score
fit_LME_landmark

Fit a landmarking model using a linear mixed effects (LME) model for the longitudinal submodel
fit_survival_model

Fit a survival sub-model
mixoutsamp

Calculate point estimates from a linear mixed effects (LME) model for new data
plot.landmark

Create a calibration plot
fit_LOCF_landmark

Fit a landmark model using a last observation carried forward (LOCF) method for the longitudinal data
add_cv_number

Assign a k-fold cross-validation number
predict.landmark

Predict the risk of an event for a new individual using the landmark model
fit_LME_longitudinal

Fit a landmarking model using a linear mixed effects (LME) model for the longitudinal submodel
return_ids_with_LOCF

Select individuals in a dataset with a last observation carried forward (LOCF) at a landmark time