简体   繁体   中英

How do you conduct a power analysis for logistic regression in R?

我熟悉G * Power作为功率分析的工具,但还没有在互联网上找到一个资源来描述如何为R中的逻辑回归计算功效分析.pwr包没有将逻辑回归列为选项。

You will very likely need to "roll your own".

  • Specify your hypothesized relationship between predictors and outcome.
  • Specify what values of your predictors you are likely to observe in your study. Will they be correlated?
  • Specify the effect size you would like to detect, eg, odds ratios corresponding to two specific settings of your predictors.
  • Specify a power level, eg, beta=0.80.
  • For different sample sizes n:
    • Simulate predictors as specified
    • Simulate outcomes
    • Run your analysis
    • Record whether you detect a statistically significant effect
    • Do these steps many times, on the order of 1000 or more times. Count how often you did detect an effect. If you detected an effect more than (eg) 80% of the time, you are overpowered - reduce n and start over. If you detected an effect less than 80%, you are underpowered - increase n and start over. Rinse & repeat until you have a good n.

And then think some more about whether all your assumptions really make sense. Vary them a bit. Is the resulting value of n sensitive to your assumptions?

Yes, this will be quite a bit of work. But it will be worth it. On the one hand, it will keep you from running an over- or underpowered study. On the other hand, as I wrote, this will force you to think deeply about your assumptions, and this is the path to enlightenment. (Which is a painful path to travel. Sorry.)

If you don't get any better answers specifically helping you to do this in R, you may want to look to CrossValidated for more help. Good luck!

这个有关Crossvalidated的问题和答案讨论了逻辑回归的能力,包括R代码以及其他讨论和链接以获取更多信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM