w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
problem with power.roc.test in R

I believe you are using the pROC package. The error message is not especially helpful here, but you basically need to pass scalar values, including to ncases and ncontrols.

power.roc.test(sig.level=.05,power=.8,ncases=10, ncontrols=102)

You can wrap that in some apply loop:

auc$auc<- apply(auc, 1, function(line) {
   power.roc.test(sig.level=.05, power=.8, ncases=line[["cases"]],
ncontrols=line[["controls"]])$auc
})

Then you will be able to plot this however you want:

plot(auc$cases / auc$controls, auc$auc, type = "l")

Note that the AUC here is not the "optimal AUC", but the AUC at which you can expect the given power at the given significance level with the given sample size for a test of the significance of the AUC (H0: AUC = 0.5). Note that you won't be able to perform this test with pROC anyway.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.