简体   繁体   English

你如何对R中的逻辑回归进行功效分析?

[英]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. 指定功率级别,例如,beta = 0.80。
  • For different sample sizes n: 对于不同的样本大小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. 多次执行这些步骤,大约1000次或更多次。 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. 如果您在80%的时间内检测到效果超过(例如),则会被制服 - 减少n并重新开始。 If you detected an effect less than 80%, you are underpowered - increase n and start over. 如果您检测到效果低于80%,则表示您动力不足 - 增加n并重新开始。 Rinse & repeat until you have a good n. 冲洗并重复,直到你有一个好的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. 如果您没有得到任何更好的答案,特别是在R中帮助您执行此操作,您可能需要查看CrossValidated以获得更多帮助。 Good luck! 祝好运!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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