View source: R/corrected.wauc.R
corrected.wauc | R Documentation |
Optimism correction of the AUC of logistic regression models with complex survey data based on replicate weights methods.
corrected.wauc(
data = NULL,
formula,
tag.event = NULL,
tag.nonevent = NULL,
weights.var = NULL,
strata.var = NULL,
cluster.var = NULL,
design = NULL,
method = c("dCV", "JKn", "RB"),
dCV.method = c("average", "pooling"),
RB.method = c("subbootstrap", "bootstrap"),
k = 10,
R = 1,
B = 200
)
data |
A data frame which, at least, must incorporate information on the columns
|
formula |
Formula of the model for which the AUC needs to be corrected.
The models are fitted by means of |
tag.event |
A character string indicating the label used to indicate the event of interest in |
tag.nonevent |
A character string indicating the label used for non-event in |
weights.var |
A character string indicating the name of the column with sampling weights.
It could be |
strata.var |
A character string indicating the name of the column with strata identifiers.
It could be |
cluster.var |
A character string indicating the name of the column with cluster identifiers.
It could be |
design |
An object of class |
method |
A character string indicating the method to be applied to define replicate weights and correct the AUC.
Choose between: |
dCV.method |
Only applies for the |
RB.method |
Only applies for the |
k |
A numeric value indicating the number of folds to be defined.
Default is |
R |
A numeric value indicating the number of times the sample is partitioned. Default is |
B |
A numeric value indicating the number of bootstrap resamples. Default is |
See Iparragirre and Barrio (2024) for more information on the AUC correction methods and their performance.
The output object of this function is a list of 5 elements containing the following information:
corrected.AUCw
: the corrected estimate of the weighted AUC.
correction.method
: the selected correction method.
formula
: formula of the model that has been fitted.
tags
: a list containing two elements with the following information:
tag.event
: a character string indicating the event of interest.
tag.nonevent
: a character string indicating the non-event.
call
: an object saving the information about the way in which the function has been run.
Iparragirre, A., Barrio, I. (2024). Optimism Correction of the AUC with Complex Survey Data. In: Einbeck, J., Maeng, H., Ogundimu, E., Perrakis, K. (eds) Developments in Statistical Modelling. IWSM 2024. Contributions to Statistics. Springer, Cham. https://doi.org/10.1007/978-3-031-65723-8_7
data(example_variables_wroc)
mydesign <- survey::svydesign(ids = ~cluster, strata = ~strata,
weights = ~weights, nest = TRUE,
data = example_variables_wroc)
m <- survey::svyglm(y ~ x1 + x2 + x3 + x4 + x5 + x6, design = mydesign,
family = quasibinomial())
phat <- predict(m, newdata = example_variables_wroc, type = "response")
myaucw <- wauc(response.var = example_variables_wroc$y, phat.var = phat,
weights.var = example_variables_wroc$weights)
# Correction of the AUCw:
set.seed(1)
res <- corrected.wauc(data = example_variables_wroc,
formula = y ~ x1 + x2 + x3 + x4 + x5 + x6,
tag.event = 1, tag.nonevent = 0,
weights.var = "weights", strata.var = "strata", cluster.var = "cluster",
method = "dCV", dCV.method = "pooling", k = 10, R = 20)
# Or equivalently:
set.seed(1)
res <- corrected.wauc(design = mydesign,
formula = y ~ x1 + x2 + x3 + x4 + x5 + x6,
tag.event = 1, tag.nonevent = 0,
method = "dCV", dCV.method = "pooling", k = 10, R = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.