bonferroni 调整后的 p 值 - 如何在不像 OR 和 CI 那样取幂的情况下绑定它?
benferroni adjusted p-value - how to bind it without exponentiating just like OR and CI?
我正在尝试将我的 benferroni 调整后的 p 值调整到我的 OR 和 CI 的绑定列表中并面临两个问题:
- 当我从逻辑回归中提取 p 值时,我也得到了截距,但是无论如何我都会继续进行转换。我不想在提取 p 值时截距,我该怎么做?
我试过这个:
#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))
- 如您所见,我的 pvalue 也取幂,我不希望这种情况发生。我想保持我的 benferroni 调整 pvalue 完好无损,但想将它添加到 OR 和 CI.
旁边
这是一个假数据集:
structure(list(diabetes_type_one = structure(c(1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L), .Label = c("No",
"Yes"), class = "factor"), chills = structure(c(1L, 1L, 1L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L), .Label = c("No",
"Yes"), class = "factor")), row.names = c(NA, -50L), class = c("tbl_df",
"tbl", "data.frame"))
你能帮忙吗?
第 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-value 和 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
我正在尝试将我的 benferroni 调整后的 p 值调整到我的 OR 和 CI 的绑定列表中并面临两个问题:
- 当我从逻辑回归中提取 p 值时,我也得到了截距,但是无论如何我都会继续进行转换。我不想在提取 p 值时截距,我该怎么做?
我试过这个:
#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))
- 如您所见,我的 pvalue 也取幂,我不希望这种情况发生。我想保持我的 benferroni 调整 pvalue 完好无损,但想将它添加到 OR 和 CI. 旁边
这是一个假数据集:
structure(list(diabetes_type_one = structure(c(1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L), .Label = c("No",
"Yes"), class = "factor"), chills = structure(c(1L, 1L, 1L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L), .Label = c("No",
"Yes"), class = "factor")), row.names = c(NA, -50L), class = c("tbl_df",
"tbl", "data.frame"))
你能帮忙吗?
第 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-value 和 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