These functions implement linear transformations, output distribution of which has desired center and spread. These functions are useful for creating distributions with some input center and spread value based on present distribution, which is a common task during hypothesis testing.

form_recenter(f, to, method = "mean")

form_respread(f, to, method = "sd", center_method = "mean")



A pdqr-function.


A desired value of summary.


Method of computing center for form_recenter() and spread for form_respread(). Values should be one of possible method values from summ_center() and summ_spread() respectively.


Method of computing center for form_respread() in order to preserve it in output.


A pdqr-function describing distribution with desired center or spread.


form_recenter(f, to, method) is basically a f - summ_center(f, method) + to: it moves distribution without affecting its shape so that output distribution has center at to.

form_respread(f, to, method, center_method) is a following linear transformation: coef * (f - center) + center, where center is summ_center(f, center_method) and coef is computed so as to guarantee output distribution to have spread equal to to. In other words, this linear transformation stretches distribution around its center until the result has spread equal to to (center remains the same as in input f).


my_beta <- as_d(dbeta, shape1 = 1, shape2 = 3) my_beta2 <- form_recenter(my_beta, to = 2) summ_center(my_beta2)
#> [1] 2
my_beta3 <- form_respread(my_beta2, to = 10, method = "range") summ_spread(my_beta3, method = "range")
#> [1] 10
# Center remains unchainged summ_center(my_beta3)
#> [1] 2