analyze_selectivity: Quantify sample selectivity with reduced/cleaned data

View source: R/analyze_selectivity.R

analyze_selectivityR Documentation

Quantify sample selectivity with reduced/cleaned data

Description

This function performs sensitivity analysis by computing the effect size Cohen's d per column to quantify sample selectivity of a reduced/cleaned (i.e., selective) analysis sample (e.g., after excluding observations) compared to its total base sample.

Usage

analyze_selectivity(.base_sample, .analysis_sample, .cols)

Arguments

.base_sample

A data frame. Should contain the data of the total base sample.

.analysis_sample

A data frame. Should contain the data of the reduced/cleaned analysis sample (e.g., after excluding observations). The number of observations in the analysis sample should be smaller than in the total base sample.

.cols

<data-masked> The names or column numbers of the numeric variables to compute Cohen's d for. Both .base_sample and .analysis_sample must contain the columns specified.

Details

Cohen's d is calculated with ( M(reduced) - M(total) ) / SD(total).

Value

A tibble with 6 columns:

  • variable The column the sensitivity anlysis was performed for

  • mean_tbs Mean in the total base sample

  • sd_tbs Standard deviation in the total base sample

  • mean_as Mean in the reduced/cleaned analysis sample

  • sd_as Standard deviation in the reduced/cleaned analysis sample

  • d Cohen's d quantifying the sample selectivity

Examples

## Not run: 
analyze_selectivity(.base_sample = studach,
.analysis_sample = studach_reduced, .cols = gender:read)

## End(Not run)

sophiestallasch/multides documentation built on Oct. 20, 2024, 5:14 a.m.