knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(miceafter) library(mice) library(magrittr) library(dplyr)
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.
mice
functionThe 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
mice
function in one PipeThe 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")
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")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.