benferroni调整后的p值-如何像OR和CI一样将其绑定而不求幂?

问题描述

我正在尝试将本菲罗尼调整后的p值应用于OR和CI的混合列表,并面临两个问题:

  1. 当我从逻辑回归中提取p值时,我也会得到截距,但是无论如何我都会进行转换。提取p值时我不想截距,该怎么办?

我已经尝试过了:

[
  {
    $set: {
      "Seasons": {
        $concatArrays: [
          "$Seasons",[
            "$Last_season_2","$Last_season"
          ]
        ]
      }
    }
  },{
    $project: {
      "Name": 1,"avgGoals": {
        $divide: [
          {
            $reduce: {
              input: "$Seasons",initialValue: 0,in: {
                $sum: [
                  "$$this.goals","$$value"
                ]
              }
            }
          },{
            $size: "$Seasons"
          }
        ]
      }
    }
  }
]
  1. 当您观察时,我的p值也取幂,所以我不希望这种情况发生。我想保持benferroni调整后的pvalue的幂不变,但要将其与OR和CI一起添加

这是一个伪数据集:

#get logistic regression
d_ch <- glm(diabetes_type_one ~ chills,data = test,family = binomial) 
# extract the p-values for adjusting 
d_ch_pval <- summary(d_ch)$coefficients[,4]
#apply benferroni 
d_ch_padj <- p.adjust(d_ch_pval,method = "bonferroni")

#I am attaching to the list ordinal ratio and confidence intervals 
exp(cbind(OR = coef(d_ch),confint(d_ch),pvalues = d_ch_padj)) 

请您帮忙吗?

解决方法

第1部分:

如果要从模型中删除截距,请执行以下操作:

glm(diabetes_type_one ~ chills - 1,data = test,family = binomial)

如果要从d_ch_pval中删除拦截(模型包括拦截),请执行以下操作:

d_ch_pval[-1] # Intercept is always the first row in the summary if the model includes intercept

第2部分:

您正在对p值和CI求幂。而是这样做:

df <- exp(cbind(OR = coef(d_ch),confint(d_ch))) # exp(other columns)
df <- cbind(df,data.frame(pvalues = d_ch_padj)) # cbind p-values after exp of other columns
df