英文:
Can I display merMod object with Flextable without GOF statistics and significance stars?
问题
我有一个来自lmer
模型的估算结果,我想要使用flextable
包来输出。有没有办法自定义输出表格,使得不包括显著性星号?我还希望输出时不包括拟合优度统计信息。这是否可行?
这里是一些模拟代码:
library(simstudy)
library(lme4)
library(flextable)
d1 <- defData(varname = "b", formula = 0, variance = 1)
d2 <- defDataAdd(varname = "x", formula = "3 + b", variance = 5)
set.seed(1234)
dd <- genData(20, d1, id = "cluster")
dd <- genCluster(dd, "cluster", 50, "id")
dd <- addColumns(d2, dd)
lmerfit <- lmer(x~1 + (1|cluster), data = dd)
as_flextable(lmerfit)
这是输出结果:
我希望它看起来像这样:
英文:
I have estimates from an lmer
model that I want to output with the flextable
package. Is there any way to customize the output table so that the significance stars are not included? I would also like to output without the goodness-of-fit statistics? Is this possible.
Here is some simulation code:
library(simstudy)
library(lme4)
library(flextable)
d1 <- defData(varname = "b", formula = 0, variance = 1)
d2 <- defDataAdd(varname = "x", formula = "3 + b", variance = 5)
set.seed(1234)
dd <- genData(20, d1, id = "cluster")
dd <- genCluster(dd, "cluster", 50, "id")
dd <- addColumns(d2, dd)
lmerfit <- lmer(x~1 + (1|cluster), data = dd)
as_flextable(lmerfit)
And here is the output:
I would like it to look something like this:
答案1
得分: 1
你可以使用 delete_part()
和 options(show.signif.stars = FALSE)
。
options(show.signif.stars = FALSE)
as_flextable(lmerfit) |> delete_part(part = "footer")
英文:
You can use delete_part()
and options(show.signif.stars = FALSE)
options(show.signif.stars = FALSE)
as_flextable(lmerfit) |> delete_part(part = "footer")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论