pairwise_t_test_mi: Pairwise t-tests() on multiply-imputed data (accepts survey...

View source: R/stat_tests.R

pairwise_t_test_miR Documentation

Pairwise t-tests() on multiply-imputed data (accepts survey weights)

Description

This runs pairwise t-tests (based on lm(), therefore assuming equal variances) on multiple imputations, with the ability to take into account survey weights.

Usage

pairwise_t_test_mi(
  mi_list,
  dv,
  groups,
  weights = NULL,
  p.adjust.method = p.adjust.methods
)

Arguments

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 (each distinct value will be treated as a level)

weights

The variable containing survey weights, must be in mi_list

p.adjust.method

The method to adjust p-values for multiple comparison (see stats::p.adjust())

Value

A tibble containing the results of the t-tests with one test per row

Examples

#Create list with imputed data
library(mice)
library(dplyr)
imp <- mice(nhanes2)
imp_list <- complete(imp, action="long") %>%
   group_split(.imp)

#Specify dependent variable and grouping factor
pairwise_t_test_mi(imp_list, bmi, age)


LukasWallrich/timesaveR documentation built on Nov. 29, 2024, 4:47 a.m.