
Standardised mean difference between a selected set and a baseline
Source:R/FlexRecordLinkage.r
smd.RdWhen missing values are encoded as 0m the smd will report information on the missingness in the linked sample vs. the source.
Arguments
- data_select
Data frame to compare (e.g. the linked set vs. the original file).
- data_baseline
Data frame to compare (e.g. the linked set vs. the original file).
- var
Character, column name to compare.
- continuous
Logical; if
TRUE, compares means ofvardirectly; ifFALSE, compares the proportion at each observed level ofvar(defaultTRUE).
Examples
base <- data.frame(age = rnorm(200, 40, 10), sex = sample(c("M", "F"),
200, replace = TRUE))
select <- data.frame(age = rnorm(80, 43, 10), sex = sample(c("M", "F"), 80,
replace = TRUE, prob = c(0.6, 0.4)))
smd(select, base, "age")
#> $age
#> [1] 0.362068
#>
smd(select, base, "sex", continuous = FALSE)
#> $sex_F
#> [1] -0.3641046
#>
#> $sex_M
#> [1] 0.3641046
#>