plot_observation.eventDensity {Coxmos} | R Documentation |
plot_observation.eventDensity
Description
Visualizes the event density for a given observation's data using the Coxmos model.
Usage
plot_observation.eventDensity(
observation,
model,
time = NULL,
type = "lp",
size = 3,
color = "red"
)
Arguments
observation |
Numeric matrix or data.frame. New explanatory variables (raw data) for one observation. Qualitative variables must be transform into binary variables. |
model |
Coxmos model. |
time |
Numeric. Time point where the AUC will be evaluated (default: NULL). |
type |
Character. Prediction type: "lp", "risk", "expected" or "survival" (default: "lp"). |
size |
Numeric. Point size (default: 3). |
color |
String. R Color. |
Details
The plot_observation.eventDensity
function provides a graphical representation of the event
density for a specific observation's data, based on the Coxmos model. The function computes the density
of events and non-events and plots them, highlighting the predicted value for the given observation's
data. The density is determined using density estimation, and the predicted value is obtained from
the Coxmos model. The function allows customization of the plot aesthetics, such as point size and
color. The resulting plot provides a visual comparison of the observation's predicted event density
against the overall event density distribution, aiding in the interpretation of the observation's risk
profile.
Value
A ggplot object representing a density of the predicted event values based on the provided Coxmos model.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
Examples
data("X_proteomic")
data("Y_proteomic")
set.seed(123)
index_train <- caret::createDataPartition(Y_proteomic$event, p = .5, list = FALSE, times = 1)
X_train <- X_proteomic[index_train,1:50]
Y_train <- Y_proteomic[index_train,]
X_test <- X_proteomic[-index_train,1:50]
Y_test <- Y_proteomic[-index_train,]
coxEN.model <- coxEN(X_train, Y_train, x.center = TRUE, x.scale = TRUE)
observation = X_test[1,,drop=FALSE]
plot_observation.eventDensity(observation = observation, model = coxEN.model, time = NULL)