natstobits: convert nats into bits

View source: R/entropy.R

natstobitsR Documentation

convert nats into bits

Description

natstobits takes a value in nats (a double) as input and returns the value in bits (a double).

Usage

natstobits(H)

Arguments

H

double denoting a value (in nats), as returned by one of the function of the infotheo package

Details

Information-theoretic quantities can have different units depending on the base of the logarithm used in their computation. All the function of tha package use a base e, hence the unit is the nat. The value in bit is given by using the base 2, hence the conversion is done by multiplying by log2(e) = 1.442695.

Value

natstobits returns a double that is the conversion of the nats value into bits.

Author(s)

Patrick E. Meyer

Examples

  data(USArrests)
  H <- entropy(discretize(USArrests))
  natstobits(H)

infotheo documentation built on April 8, 2022, 5:08 p.m.