gpt4 book ai didi

pROC 包 : usage of controls and cases with its context 中的 roc() 函数

转载 作者:行者123 更新时间:2023-12-05 05:15:47 30 4
gpt4 key购买 nike

谁能解释一下 controlscases 参数在 R 中 pROC 包的 roc() 函数中的含义,以及如何使用它们?如何查看数据集中可用的控件和案例的数量?

最佳答案

来自 help(roc):

controls, cases instead of response, predictor, the data can be supplied as two numeric or ordered vectors containing the predictor values for control and case observations.

通常在分类设置中使用 roc 曲线,其中您有两个标记类向量(R 中的 factor()),一个是您的预测标签,另一个是事实,同样每个 obs 都有标签。

其他时候你可以有一个控制组(比如在医学场景中),你可以给函数提供控制(一个数字向量)或案例(一个因子向量)。

对照组基本上是您不进行治疗的那部分人群。

再次来自 help 函数:

Data can be provided as response, predictor, where the predictor is the numeric (or ordered) level of the evaluated signal, and the response encodes the observation class (control or case). The level argument specifies which response level must be taken as controls (first value of level) or cases (second). It can safely be ignored when the response is encoded as 0 and 1, but it will frequently fail otherwise. By default, the first two values of levels(as.factor(response)) are taken, and the remaining levels are ignored. This means that if your response is coded “control” and “case”, the levels will be inverted.

In some cases, it is more convenient to pass the data as controls, cases, but both arguments are ignored if response, predictor was specified to non-NULL values. It is also possible to pass density data with density.controls, density.cases, which will result in a smoothed ROC curve even if smooth=FALSE, but are ignored if response, predictor or controls, cases are provided.

data(aSAH)
# With numeric controls/cases
roc(controls=aSAH$s100b[aSAH$outcome=="Good"], cases=aSAH$s100b[aSAH$outcome=="Poor"])
# With ordered controls/cases
roc(controls=aSAH$wfns[aSAH$outcome=="Good"], cases=aSAH$wfns[aSAH$outcome=="Poor"])

roc() documentation

关于pROC 包 : usage of controls and cases with its context 中的 roc() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51318668/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com