The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Pooling Levene’s test statistic

Martijn W Heymans

2022-10-02

Levene’s test

Levene’s test is used to test if the variance between groups is comparable. The test can be used to compare the variances between two groups, but also between more than two groups.

Examples

Pooling Levene’s test after the mice function

The lbp_orig as part of the miceafter package is a dataset with missing values. So we first impute them with the mice function. Than we use the mids2milist function to turn a mids object with multiply imputed datasets, as a result of using mice, into a milist object. Than we use the with function to apply repeated analyses with the levene_test function across the list of multiply imputed datasets. Finally, we pool the results by using the pool_levenetest function.


  imp_data <- mice(lbp_orig, m=5, seed=3025, printFlag = FALSE) 

  imp_list <- mids2milist(imp_data)
  
  ra <- with(data=imp_list,
   expr = levene_test(Pain ~ factor(Satisfaction)))

  res <- pool_levenetest(ra, method = "D1")
  res
#>        F_value df1     df2     P(>F)       RIV
#> [1,] 0.9733556   2 39.1486 0.3867687 0.2869869
#> attr(,"class")
#> [1] "mipool"

Pooling Levene’s test after the mice function in one Pipe

The lbp_orig as part of the miceafter package is a dataset with missing values. So we first impute them with the mice function. Than we use the mids2milist function to turn a mids object with multiply imputed datasets, as a result of using mice, into a milist object. Than we use the with function to apply repeated analyses with the levene_test function across the list of multiply imputed datasets. Finally, we pool the results by using the pool_levenetest function.


  lbp_orig %>% 
    mice(m=5, seed=3025, printFlag = FALSE) %>%
      mids2milist() %>%
        with(expr = levene_test(Pain ~ factor(Satisfaction))) %>%
          pool_levenetest(method = "D1")
#>        F_value df1     df2     P(>F)       RIV
#> [1,] 0.9733556   2 39.1486 0.3867687 0.2869869
#> attr(,"class")
#> [1] "mipool"

Pooling Levene’s test after Multiply Imputed datasets are stored in a separate dataframe

The dataset lbpmilr as part of the miceafter package is a long dataset that contains 10 multiply imputed datasets. The datasets are distinguished by the Impnr variable. First we convert the dataset into a milist object by the df2milist function. Than we use the with function to apply repeated analyses with the levene_test function across the multiply imputed datasets. Finally, we pool the results by using the pool_levenetest function. As pooling method we use D1 (D2 is also possible).


  lbpmilr %>%
    df2milist(impvar = "Impnr") %>%
      with(expr = levene_test(Pain ~ factor(Satisfaction))) %>%
        pool_levenetest(method = "D1")
#>       F_value df1      df2     P(>F)       RIV
#> [1,] 1.014884   2 73.57617 0.3674612 0.3920127
#> attr(,"class")
#> [1] "mipool"

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.