wtd_cor_matrix_mi: Create a correlation matrix from multiply imputed data with...

View source: R/cor_tables.R

wtd_cor_matrix_miR Documentation

Create a correlation matrix from multiply imputed data with weights

Description

This function takes an imputationList with a vector of weights and returns a correlation matrix for all numeric variables as well as a list of descriptives that pools the results across all imputations.

Usage

wtd_cor_matrix_mi(mi_list, weights, var_names = NULL)

Arguments

mi_list

A list of dataframes of multiple imputation results

weights

A variable within mi_list that gives the survey weights

var_names

A named character vector with the names that should be displayed for variables. To facilitate post-processing, correlations with original variable names are returned in the 'tests' element.

Details

Variables starting with . are dropped, as these are likely to be .imp and .id from mice. If you want correlations for such variables, rename them.

Value

A correlation matrix list similar to the format provided by jtools::svycor() with the addition of a desc-element with means and standard deviations of the variables.

Source

Takes some code from the miceadds::micombine.cor function, but adapted to use weights and return in the format accepted by apa.cor.table.survey


LukasWallrich/rNuggets documentation built on Aug. 26, 2022, 11:03 a.m.