Standardize a numeric vector using quantiles
standardize_quantile.RdA convenience function to standardize a numeric vector using quantiles. Defaults to centering on the median and scaling on the interquartile range. $$\frac{x - \text{median}(x)}{\text{quantile}(x, 0.75) - \text{quantile}(x, 0.25)}$$
Examples
#----------------------------------------------------------------------------
# standardize_quantile() examples
#----------------------------------------------------------------------------
library(bkstat)
x <- rnorm(100, mean = 30, sd = 20)
standardize_quantile(x)
#> [1] 0.448618491 0.183573984 -1.063691965 -0.787956024 -1.036671326
#> [6] 1.289943651 -0.277940015 -0.068024957 -0.046939546 -0.074627631
#> [11] -0.577207364 -0.001830774 0.461018663 0.095744245 1.421679876
#> [16] 1.026151717 0.121370161 -0.525375903 -0.228910460 -1.005580002
#> [21] 0.898624813 0.298835423 -0.620936369 0.324742714 -0.247377308
#> [26] 0.202559002 -0.622114215 0.457296849 0.935418232 0.095556808
#> [31] -1.182260120 -1.470524406 1.048335453 -0.129200842 -0.508372110
#> [36] 1.082827079 -0.197549790 0.343986634 0.534295457 0.439385495
#> [41] -0.106130362 -0.389691284 -1.781363910 -0.421707969 0.385602417
#> [46] -0.834371664 1.166872018 0.239357527 0.741235165 -0.453188913
#> [51] -0.658043394 -0.495129364 0.209223063 -0.633476535 -1.975903929
#> [56] 0.223160024 -0.684340530 0.127080676 -0.105055291 1.002754431
#> [61] 0.787171574 1.297980676 -0.104629866 0.494178171 -0.893224310
#> [66] 0.083440023 -0.389633254 -0.396996062 0.715204715 -1.459641675
#> [71] 0.161841728 1.729517646 0.304225940 -0.269006030 -1.082063656
#> [76] -0.848195544 -0.491714752 0.548976283 1.095140335 0.198405735
#> [81] 0.944969916 1.022796414 0.580484696 0.899611994 1.285224245
#> [86] -1.613659120 0.001830774 -1.880233754 0.153354318 -0.546638131
#> [91] -0.098289347 -0.943403930 -0.503410465 0.048940604 1.143103934
#> [96] 0.346822691 -1.815910265 -0.297430910 -1.282304865 1.092199281