我进行了Logistic回归和多重比较

library(lme4)
model < glmer(y ~ Genger + Age + subject +
    (1 | ParticipantID), data = data, family = binomial(link = "logit"))

library(multcomp)
multicomp<-glht(model,mcp(Behavior="Tukey"))
summary(multicomp)

输出:

                              Estimate  Std. Error  z value Pr(>|z|)    
subject2 - subject1 ==  0 -2.19503726  0.66179761 -2.89596  < 0.001 ***

我想要显示准确的p值,而不是< 0.001***.我该怎么办?

我试过了

options(digits=10)

但yields 并没有改变.

推荐答案

您可以将其更改为:

library(lme4)
data(Orthodont,package="nlme")
model <-lmer(distance ~ Sex + age + (age|Subject), data=Orthodont)

library(multcomp)
multicomp<-glht(model, mcp(Sex = "Tukey"))
res <- summary(multicomp)

print(res)
#                   Estimate Std. Error z value Pr(>|z|) 
#Female - Male == 0  -2.1454     0.7575  -2.832  0.00462 **


coeftable <- do.call(cbind, res$test[c("coefficients", "sigma", "tstat", "pvalues")])
colnames(coeftable) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")

printCoefmat(coeftable) 

#more digits (but still some protection against showing more digits than meaningful)
printCoefmat(coeftable, digits = 10) 

#no protection
print(coeftable)

#even more digits
options(digits = 20)
print(coeftable)

但是,没有打印出确切的p值是有原因的.它很容易受到precision of floating-point numbers的影响.multcomp个开发人员正在试图保护您,使其不会被解释为无意义的数字.

R相关问答推荐

根据R中两个变量的两个条件删除带有dspirr的行

带有叠加饼图系列的Highmap

从开始时间和结束时间导出时间

R Sapply函数产生的值似乎与for循环方法略有不同

在R中使用数据集名称

计算时间段的ECDF(R)

在另存为PNG之前隐藏htmlwidget绘图元素

如何编辑gMarginal背景以匹配绘图背景?

从所有项的 struct 相同的两级列表中,将该第二级中的所有同名项绑定在一起

使用列/行匹配将两个不同维度的矩阵相加

解析R函数中的变量时出现的问题

计算数据帧中指定值之前的行数,仅基于每行之后的future 行,单位为r

如何在使用箭头R包(箭头::OPEN_DATASSET)和dplyr谓词时编写具有整齐计算的函数?

警告消息";没有非缺失的参数到min;,正在返回数据中的inf";.表分组集

手动指定从相同数据创建的叠加图的 colored颜色

层次树图的数据树

Conditional documentr::R中数据帧的summarize()

Ggplot2如何找到存储在对象中的残差和拟合值?

使用列名和r中的前缀 Select 列的CREATE函数

使用显式二元谓词子集化sfc对象时出错