Skip to contents

Standardized mean difference calculated via smd::smd() with na.rm = TRUE. Additionally, this function add a confidence interval to the SMD when std.error=TRUE, which the original smd::smd() does not include.

Usage

ard_smd_smd(data, by, variables, std.error = TRUE, conf.level = 0.95, ...)

Arguments

data

(data.frame/survey.design)
a data frame or object of class 'survey.design' (typically created with survey::svydesign()).

by

(tidy-select)
column name to compare by.

variables

(tidy-select)
column names to be compared. Independent tests will be computed for each variable.

std.error

(scalar logical)
Logical indicator for computing standard errors using smd::compute_smd_var(). Default is TRUE.

conf.level

(scalar numeric)
confidence level for confidence interval. Default is 0.95.

...

arguments passed to smd::smd()

Value

ARD data frame

Examples

ard_smd_smd(cards::ADSL, by = SEX, variables = AGE)
#> {cards} data frame: 6 x 9
#>   group1 variable context stat_name stat_label      stat
#> 1    SEX      AGE smd_smd  estimate  Standard…     0.157
#> 2    SEX      AGE smd_smd std.error  Standard…     0.127
#> 3    SEX      AGE smd_smd  conf.low   conf.low    -0.091
#> 4    SEX      AGE smd_smd conf.high  conf.high     0.405
#> 5    SEX      AGE smd_smd    method     method Standard…
#> 6    SEX      AGE smd_smd      gref  Integer …         1
#>  3 more variables: fmt_fn, warning, error
ard_smd_smd(cards::ADSL, by = SEX, variables = AGEGR1)
#> {cards} data frame: 6 x 9
#>   group1 variable context stat_name stat_label      stat
#> 1    SEX   AGEGR1 smd_smd  estimate  Standard…     0.103
#> 2    SEX   AGEGR1 smd_smd std.error  Standard…     0.127
#> 3    SEX   AGEGR1 smd_smd  conf.low   conf.low    -0.145
#> 4    SEX   AGEGR1 smd_smd conf.high  conf.high     0.351
#> 5    SEX   AGEGR1 smd_smd    method     method Standard…
#> 6    SEX   AGEGR1 smd_smd      gref  Integer …         1
#>  3 more variables: fmt_fn, warning, error