
Two side-by-side line plots of validation curves from the "precmed" object
Source: R/crossv.R
plot.precmed.RdProvides validation curves in two side-by-side plots, visualizing the estimated ATEs in a series
of nested subgroups in the training set and validation set separately, where each line represents
one scoring method specified in catecv() or catecvmean(). This should be run
only after results of catecv() or catecvmean() have been obtained.
Usage
# S3 method for class 'precmed'
plot(
x,
cv.i = NULL,
combine = "mean",
show.abc = TRUE,
valid.only = FALSE,
plot.hr = FALSE,
ylab = NULL,
legend.position = "bottom",
xlim = NULL,
title = waiver(),
theme = precmed_plot_theme(),
hazard.type = c("cumulative", "conditional"),
measure = "rmtl",
show.overall = TRUE,
layout = "set",
...
)Arguments
- x
An object of class
"precmed".- cv.i
A positive integer indicating the index of the CV iteration results to be plotted. Allowed values are: a positive integer \(<=\)
cv.nincatecv()orNULL. Ifcv.i = NULL, the results across all CV iterations are combined according tocombineand then plotted. Default isNULL.- combine
A character value indicating how to combine the estimated ATEs across all CV iterations into a validation curve for each nested subgroup, separately for the training and validation results. Allowed values are:
'mean'or'median'. Used only ifcv.i = NULL. Default is'mean'.- show.abc
A logical value indicating whether to show the ABC statistics in the validation set. Used only if
x$abc = TRUEandxlimis not limited to a smaller range (i.e.,xlim = NULLor equal to the entirex$prop.onlyhighrange). Ifcv.iis NULL, ABC statistics will be based on the combined CV iterations. Ifcv.iis an integer, ABC statistics will be based solely on that CV iteration. Default isTRUE.- valid.only
A logical value indicating whether only the validation curves in the validation set should be plotted (
TRUE). Otherwise, the validation curves in both the training and validation sets are plotted side-by-side (FALSE). Default isFALSE.- plot.hr
Deprecated; use
measureinstead. Whether to plot a hazard-based ratio for survival outcomes instead of the RMTL ratio. WhenTRUE, the default is the marginal cumulative hazard ratio.- ylab
A character value for the y-axis label to describe what the ATE is. Default is
NULL, which creates a default y-axis label based on available data.- legend.position
A character value for the legend position argument to be passed to
ggplotobject. Default is'bottom'.- xlim
A numeric value for the range of the x-axis. Default is
NULL, which means there is no range specified.- title
The text for the title
- theme
A ggplot2 theme. By default, a customized minimal theme is used; supply, for example,
ggplot2::theme_classic()to use another theme.- hazard.type
Deprecated; use
measureinstead. Select"cumulative"(default) or the supplementary"conditional"Cox HR whenplot.hr = TRUE. Older objects without cumulative hazard ratios requirehazard.type = "conditional"or refitting.- measure
For survival outcomes, a vector of
"rmtl"(default),"cumulative_hr"(cumulative hazard ratio), and"conditional_hr"(conditional Cox hazard ratio fitted throughtau0),"risk_difference"(risk under treatment 1 minus treatment 0), and"absolute_risk_reduction"(the opposite contrast), both attau0. Multiple measures appear in separate panels. The earlier names"chr","cph","cumulative_hazard_ratio", and"conditional_hazard_ratio"remain supported as aliases; dotted forms"cumulative.hr","conditional.hr","risk.difference", and"absolute.risk.reduction"are also supported.- show.overall
Whether to show the dashed overall treatment effect reference line in each set. Defaults to
TRUE.- layout
Use
"set"(default) for panels by dataset and curves by method, or"method"for panels by scoring method and training and validation curves in each panel. Overall-effect reference lines in the latter layout are dotted and colored by dataset.- ...
Other parameters
Value
A ggplot of training and validation curves, faceted by set or method.
Overall-effect reference lines are included when show.overall = TRUE.
ABC statistics appear in the legend or method headings when show.abc = TRUE.
Details
plot() takes in outputs from catecv() and generates two plots
of validation curves side-by-side, one for the training set and one for validation set.
Separate validation curves are produced for each fitted scoring method
in catecv() or catecvmean().
The validation curves (and ABC statistics, if applicable) can help compare the performance of different scoring methods in terms of discerning potential treatment heterogeneity in subgroups with internal validation. Steeper validation curves in the validation set suggest presence of treatment effect heterogeneity (and the ability of the scoring methods to capture it) while flat validation curves indicate absence of treatment effect heterogeneity (or inability of the scoring method to capture it).
References
Yadlowsky, S., Pellegrini, F., Lionetto, F., Braune, S., & Tian, L. (2020). Estimation and validation of ratio-based conditional average treatment effects using observational data. Journal of the American Statistical Association, 1-18. DOI: 10.1080/01621459.2020.1772080.
Jiang, X., Simoneau, G., Pellegrini, F., Shen, C., de Moor, C., & Tian, L. (2026). Visualization and interpretation of individualized treatment rule results. In T. P. A. Debray, T.-L. Nguyen, & R. W. Platt (Eds.), Comparative Effectiveness and Personalized Medicine Research Using Real-World Data (Chapter 20, pp. 513–536). Chapman & Hall/CRC. doi:10.1201/9781003300809-20



