尝试使用 Bonferroni 方法进行假设检验

Trying to use the Bonferroni method to hypothesis test

我正在尝试使用 bonferroni 方法进行假设检验,尽管我收到一条错误消息说我无法将 SD 合并在一起,有人知道这个问题以及如何解决代码吗?

使用的代码:

with(final_data, pairwise.t.test, Concentration_of_PM2.5, Life_expectancy,
 p.adjust.method = 'bonferroni')

错误信息;

function (x, g, p.adjust.method = p.adjust.methods, pool.sd = !paired, 
paired = FALSE, alternative = c("two.sided", "less", "greater"), 
...) 
{
     if (paired && pool.sd) 
        stop("pooling of SD is incompatible with paired tests")

数据集片段;

head(final_data, 10)
           Country             Continent Life_Expectancy Adult_Mortality Concentration_of_PM2.5       GDP GDP_Level
1          Afghanistan Eastern Mediterranean        62.68935       245.22490                  55.14  1896.993  Very Low
2              Albania                Europe        76.37373        96.40514                  18.07 11868.179    Medium
3              Algeria                Africa        76.36365        95.02545                  35.18 15036.364    Medium
4               Angola                Africa        62.63262       237.96940                  38.29  6756.935       Low
5  Antigua and Barbuda              Americas        74.99754       119.86570                  21.03 23670.302      High
6            Argentina              Americas        76.94621       111.42880                  12.58 20130.408      High
7              Armenia                Europe        74.83788       116.43580                  33.84  8808.573       Low
8            Australia       Western Pacific        82.90018        60.72528                   7.14 47305.880 Very High
9              Austria                Europe        81.87031        61.88845                  12.15 51809.514 Very High
10          Azerbaijan                Europe        73.07719       117.64890                  20.99 17417.087      High

PM2.5 会降低贫困地区(低 GDP)的预期寿命,如果这两个连续缩放变量之间的相关性为负且显着 (p-value < 0.05):

library(tidyverse)

final_data %>%
  filter(GDP_Level %in% c("Very Low", "Low")) %>%
  cor.test(~ Concentration_of_PM2.5 + Life_Expectancy,
     data = ., method = "pearson")

这会寻找这两个变量之间的线性关系。如果 non-linear 但应该研究单调的关系,请改用 method = "spearman

然而,这只是对一种假设的一种检验,因此不需要 Bonferroni。