如何制作混合模型的森林情节
如何为混合模型共同制作的森林图及其相应的置信区间。 但是,我尝试了此代码
Model = lme (fixed = score~ Age+Sex+yearsofeducation+walkspeed,
random = ~1|ID,
data=DB,
na.action = na.omit, method = "ML",
)
plot_summs (model)
,但我希望以下降的方式订购森林地块。 感谢您的帮助。
How to make a forest plots for mixed models co-effiecents and their corresponding confidence interval.
I tried this code
Model = lme (fixed = score~ Age+Sex+yearsofeducation+walkspeed,
random = ~1|ID,
data=DB,
na.action = na.omit, method = "ML",
)
plot_summs (model)
However, I want the OR in the forest plots to be ordered in a descending fashion.
Thanks for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将其称为“系数情节”,而不是“森林情节”。 您比较许多不同研究中相同效应的估计值时,荟萃分析中使用了森林图。
)
(当 对您的(我不清楚为什么要提到或(=赔率比?),这些通常来自逻辑回归...?)
系数图:dotwhisker,
您可以获得您想要的 直接从
dotwhisker
软件包中,但它不会对效果进行排序(据我所知,或者不容易):系数图:tidyverse
我通常自己进行处理,因为我更喜欢提高灵活性。
唯一剩下的/可能性的棘手问题是,如果您具有相似幅度的正和负系数,该怎么办。如果您想按绝对值进行排序,那么
尽管这有点丑陋。
如果您喜欢Tidyverse,则可以替换
forcats :: fct_reorder
作为重新排序
。I would call this a "coefficient plot", not a "forest plot". (A forest plot is used in meta-analyses, when you are comparing the magnitude of estimates of the same effect from many different studies.)
example setup
This is a slightly silly example, but should be close enough to yours (not clear to me why you're mentioning OR (= odds ratios?), these are typically from a logistic regression ... ?)
coefficient plots: dotwhisker
You could get approximately what you want directly from the
dotwhisker
package, but it won't sort effects (or not easily, as far as I know):coefficient plots: tidyverse
I usually do the processing myself, as I prefer increased flexibility.
The only remaining/possibility tricky question here is what to do if you have positive and negative coefficients of similar magnitude. If you want to sort by absolute value then
although this gets a bit ugly.
If you like the tidyverse you can substitute
forcats::fct_reorder
forreorder
.我只是为Ben Bolker的出色答案添加了一个选项:使用
models ummummary
软件包。 (免责声明:我是作者。)使用该软件包,您可以使用
modelplot()
函数来创建森林图,而coef_map
参数to重命名和重新排序系数。如果您要估计logit模型并想要优势比,则可以使用endentiate
参数。您在
coef_map
向量中插入系数的顺序将它们从底部到顶部分类。例如:I’m just adding one more option to Ben Bolker’s excellent answer: using the
modelsummary
package. (Disclaimer: I am the author.)With that package, you can use the
modelplot()
function to create a forest plot, and thecoef_map
argument to rename and reorder coefficients. If you are estimating a logit model and want the odds ratios, you can use theexponentiate
argument.The order in which you insert coefficients in the
coef_map
vector sorts them in the plot, from bottom to top. For example: