Description Usage Arguments Details Value Author(s)
p.round performs stochastic or probabilistic rounding of non-integer values.
1 |
x |
Required Default = none |
q |
Optional Default = none |
The input "x" is a vector of values to be rounded. Each value of x is rounded independently, either up or down. The fractional value of x is used to determine weights for rounding in each direction. For example, if x=4.3, then it is rounded up to 5 with probability 0.3, else rounded down to 4 (with probability 0.7). The p.round function always returns integer values, and does not introduce bias. In the above example, if the argument were 4.3 a large number of times, then the returned values (all either 4 or 5) would average 4.3 with a small residual error which approaches zero as "n" gets large.
A vector of the same length as the input "x", containing all integer values.
Kristin Isaacs, Graham Glen
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.