0

私の記事では、いくつかの異なる ROC 分析を分析しています。したがって、サンプルサイズが適切かどうかを調査しています。ROC 分析の可能なサンプル サイズのすべての組み合わせで構成されるデータ フレームを作成しました。

str(auc)
'data.frame':   93 obs. of  2 variables:
 $ cases   : int  10 11 12 13 14 15 16 17 18 19 ...
     $ controls: int  102 101 100 99 98 97 96 95 94 93 ...

私の目的は、ライン プロットのケース/コントロール (つまり、カッパ) と最適な AUC を作成することです。

したがって、power.roc.test を使用して 3 番目の変数を作成し、最適な AUC を計算したいと思います。

上記の問題に遭遇しましたが、どこに問題がありますか?

auc$auc<-power.roc.test(sig.level=.05,power=.8,ncases=auc$cases,ncontrols=auc$controls)$auc
Error in value[[3L]](cond) : AUC could not be solved:
Error in uniroot(power.roc.test.optimize.auc.function, interval = c(0.5, : invalid function value in 'zeroin'
In addition: Warning messages:
1: In if (is.na(f.lower)) stop("f.lower = f(lower) is NA") :
  the condition has length > 1 and only the first element will be used
2: In if (is.na(f.upper)) stop("f.upper = f(upper) is NA") :
  the condition has length > 1 and only the first element will be used
3: In if (f.lower * f.upper > 0) stop("f() values at end points not of opposite sign") :
  the condition has length > 1 and only the first element will be used
4

1 に答える 1

0

pROCパッケージを使用していると思います。ここではエラー メッセージは特に役に立ちませんが、基本的には と を含むスカラー値を渡す必要がありncasesますncontrols

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

それをいくつかの適用ループでラップできます:

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

次に、これを必要に応じてプロットできます。

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

ここでの AUC は「最適な AUC」ではなく、AUC の有意性を検定するための特定のサンプル サイズで、特定の有意水準で特定の検出力を期待できる AUC であることに注意してください (H0: AUC = 0.5)。 . pROCとにかく、このテストを実行できないことに注意してください。

于 2014-03-01T18:35:43.913 に答える