t_test_mi | R Documentation |
This runs t-test (based on lm(), therefore assuming equal variances) on multiple imputations, with the ability to take into account survey weights.
t_test_mi(mi_list, dv, groups, weights = NULL)
mi_list |
A list of dataframes, each consisting of a multiply imputed dataset |
dv |
The dependent variable for the t.test (must be in mi_list) |
groups |
The grouping variable (must have only two values, be in mi_list) |
weights |
The variable containing survey weights, must be in mi_list |
A one-row tibble containing the result of the t-test
#Create list with imputed data
library(mice)
library(dplyr)
imp <- mice(nhanes2)
imp_list <- complete(imp, action="long") %>%
dplyr::group_split(.imp)
t_test_mi(imp_list, bmi, hyp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.