plot.landmark {Landmarking} | R Documentation |
Create a calibration plot
Description
Creates a calibration plot for the landmark model fitted by fit_LME_landmark_model
or fit_LOCF_landmark_model
.
This function plots the observed frequencies of the event of interest against the predicted probabilities of the event of interest.
Usage
## S3 method for class 'landmark'
plot(x, x_L, n, x_lims, y_lims, ...)
Arguments
x |
Object inheriting the class |
x_L |
Numeric specifying the landmark time. This indicates which landmark model in |
n |
Numeric specifying the number of bins to use. |
x_lims |
Vector of length 2 specifying the limits of the x axes |
y_lims |
Vector of length 2 specifying the limits of the y axes |
... |
Arguments passed to |
Details
This function bins the predicted probabilities of the event of interest into n
bins. The event of interest is the event with
event_status=1
when fitting the landmark model. For each of the n
sets of individuals, the Aalen-Johansen estimator is fit to that set
and used to calculate the risk of an event at the horizon time. The predictions (from the landmark model) and the observed frequencies
(from the Aalen-Johansen estimator) are plotted against each other. For a perfect prediction model, the points will be plotted along the y=x line.
Value
Calibration plot showing the value of predicted probabilities against observed frequencies, with a y=x
line.
Examples
library(Landmarking)
data(data_repeat_outcomes)
data_model_landmark_LOCF <-
fit_LOCF_landmark(
data_long = data_repeat_outcomes,
x_L = c(60, 61),
x_hor = c(65, 66),
covariates =
c("ethnicity", "smoking", "diabetes", "sbp_stnd", "tchdl_stnd"),
covariates_time =
c(rep("response_time_sbp_stnd", 4), "response_time_tchdl_stnd"),
k = 10,
individual_id = "id",
event_time = "event_time",
event_status = "event_status",
survival_submodel = "cause_specific"
)
plot(x=data_model_landmark_LOCF,x_L=60,n=5)
plot(x=data_model_landmark_LOCF,x_L=61,n=5)