fixcut_bin {BioPred} | R Documentation |
Fixed Cutoff Analysis for Individual Biomarker Associated with Binary Outcome Variables
Description
This function conducts fixed cutoff analysis for individual biomarker associated with binary outcome variables.
Usage
fixcut_bin(
yvar,
xvar,
dir,
cutoffs,
data,
method = "Fisher",
yvar.display = yvar,
xvar.display = xvar,
vert.x = FALSE
)
Arguments
yvar |
Binary response variable name. 0 represents controls and 1 represents cases. |
xvar |
Biomarker name. |
dir |
Cutoff direction for the desired subgroup. Options are ">", ">=", "<", or "<=". |
cutoffs |
A vector of candidate cutoffs. |
data |
The dataset containing the variables. |
method |
Method for cutoff selection. Options are "Fisher", "Youden", "Conc.Prob", "Accuracy", or "Kappa". - "Fisher": Minimizes the Fisher test p-value. - "Youden": Maximizes the Youden index. - "Conc.Prob": Maximizes sensitivity * specificity. - "Accuracy": Maximizes accuracy. - "Kappa": Maximizes Kappa coefficient. |
yvar.display |
Display name of the response variable. |
xvar.display |
Display name of the predictor variable. |
vert.x |
Whether to display the cutoff in a 90-degree angle when plotting (saves space). |
Value
A list containing statistical summaries, selected cutoff statistics, selected cutoff value, confusion matrix, and a ggplot object for visualization.
Examples
# Load a sample dataset
data <- data.frame(
outcome = sample(c(0, 1), 100, replace = TRUE),
biomarker = rnorm(100, mean = 0, sd = 1)
)
# Perform fixed cutoff analysis using the "Fisher" method for a biomarker
fixcut_bin(
yvar = "outcome",
xvar = "biomarker",
dir = ">",
cutoffs = seq(-2, 2, by = 0.5),
data = data,
method = "Fisher",
yvar.display = "Binary Outcome",
xvar.display = "Biomarker Level",
vert.x = TRUE
)
# Perform fixed cutoff analysis using the "Youden" method
fixcut_bin(
yvar = "outcome",
xvar = "biomarker",
dir = "<",
cutoffs = seq(-2, 2, by = 0.5),
data = data,
method = "Youden",
yvar.display = "Binary Outcome",
xvar.display = "Biomarker Level",
vert.x = FALSE
)
# Perform fixed cutoff analysis using "Accuracy" method with different direction
fixcut_bin(
yvar = "outcome",
xvar = "biomarker",
dir = ">=",
cutoffs = c(-1, 0, 1),
data = data,
method = "Accuracy",
yvar.display = "Binary Outcome",
xvar.display = "Biomarker Level",
vert.x = TRUE
)