可以使用Flextable显示merMod对象,但不包括GOF统计数据和显著性星号。

huangapple go评论75阅读模式
英文:

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)

这是输出结果:

可以使用Flextable显示merMod对象,但不包括GOF统计数据和显著性星号。

我希望它看起来像这样:

可以使用Flextable显示merMod对象,但不包括GOF统计数据和显著性星号。

英文:

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 &lt;- defData(varname = &quot;b&quot;, formula = 0, variance = 1)
d2 &lt;- defDataAdd(varname = &quot;x&quot;, formula = &quot;3 + b&quot;, variance = 5)

set.seed(1234)

dd &lt;- genData(20, d1, id = &quot;cluster&quot;)
dd &lt;- genCluster(dd, &quot;cluster&quot;, 50, &quot;id&quot;)
dd &lt;- addColumns(d2, dd)

lmerfit &lt;- lmer(x~1 + (1|cluster), data = dd)

as_flextable(lmerfit)

And here is the output:

可以使用Flextable显示merMod对象,但不包括GOF统计数据和显著性星号。

I would like it to look something like this:

可以使用Flextable显示merMod对象,但不包括GOF统计数据和显著性星号。

答案1

得分: 1

你可以使用 delete_part()options(show.signif.stars = FALSE)

options(show.signif.stars = FALSE)
as_flextable(lmerfit) |&gt; delete_part(part = &quot;footer&quot;)
英文:

You can use delete_part() and options(show.signif.stars = FALSE)

options(show.signif.stars = FALSE)
as_flextable(lmerfit) |&gt; delete_part(part = &quot;footer&quot;)

huangapple
  • 本文由 发表于 2023年7月3日 22:58:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605920.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定