| rounding | R Documentation |
round_ran(x)
round_oric(x)
x |
( |
An integer vector.
round_ran(): Random rounding of numbers.
A number x is rounded to an integer y according to the following
rule:
y = \left\lfloor x \right\rfloor +
I\!\left(u < x - \left\lfloor x \right\rfloor\right),
where the indicator function I : \{FALSE,\, TRUE\} \to \{0,\, 1\} is
defined as
I(b) :=
\begin{cases}
0, & b \text{ is } FALSE, \\
1, & b \text{ is } TRUE,
\end{cases}
and u is a random number drawn from the \mathrm{Uniform}(0, 1)
distribution.
round_oric(): Optimal rounding under integer constraints, as proposed by
\insertCiteCont;textualstratallo.
Contstratallo
x <- c(4.5, 4.1, 4.9)
set.seed(5)
round_ran(x) # 5 4 4
set.seed(6)
round_ran(x) # 4 4 5
round_oric(x) # 4 4 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.