logp: Calculate a base-2 logarithm of a probability value,...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/r-utility-logp.R

Description

This function calculates a base-2 logarithm of a probability value, returning a finite value for probability 0. It is used in examples presented in the book Cichosz, P. (2015): Data Mining Algorithms: Explained Using R. See Appendix B or http://www.wiley.com/go/data_mining_algorithms for more details.

Usage

1
logp(p)

Arguments

p

a non-negative value or vector of values

Details

To avoid infinite results and the associated numerical problems for zero arguments, a finite result corresponding to the least possible positive argument is used.

Value

If p>0 then log2(p) and .Machine$double.min.exp otherwise.

Author(s)

Pawel Cichosz <p.cichosz@elka.pw.edu.pl>

See Also

plogp

Examples

1
2
3
logp(0)
logp(1)
logp(0.5)

42n4/dmr.util documentation built on May 20, 2019, 2:02 p.m.