This base::print() method is a utility to display value and revisability of an "mi" object obtained with mutualinfo().
Usage
# S3 method for class 'mi'
print(x, digits = TRUE, edigits = 2, unit = NULL, ...)Arguments
- x
Object of class "mi", obtained with
mutualinfo().- digits
positive integer or
NULLorTRUE(default): minimal number of significant digits, seebase::print.default(). If value isTRUE, then the significant digits for element$valueis determined from is respective$MCaccuracy(seemutualinfo()), according to the rules of the Guide to the expression of Uncertainty in Measurement, keeping as many digits as given in parameteredigits; whereas$quantileselements usesedigitssignificant digits.- edigits
positive integer, default 2: number of significant digits for element
$valueand$quantiles, ifdigits = TRUE.- unit
Either
NULL, or one of 'Sh' for shannon (default), 'Hart' for hartley, 'nat' for natural unit, or a positive real indicating the base of the logarithms to be used; see analogous argument inmutualinfo(). IfNULL(default), the same unit as in the objectxis used. Unit conversion is internally performed if this unit is different from that of the objectx.- ...
Other parameters to be passed to
base::print().
Value
Its x argument, invisibly; see base::print().
See also
mutualinfo() to calculate mutual information.
hist.mi() to plot the revisability of the mutual information.
Examples
# \donttest{
### WARNING: the following example, if run, might even take a minute or more.
## Load the example `K`nowledge object calculated from the "penguins" dataset;
## variates: 'species' and 'bill_len'
K <- Kexample
## Calculate the mutual information between variates 'species' and 'bill_len'
MI <- mutualinfo(Y1names = 'species', Y2names = 'bill_len', K = K)
## display the value and revisability of the mutual information
print(MI)
#> value/Sh Q5.5% Q25% Q75% Q94.5%
#> 0.747 0.33 0.62 0.93 1.1
## convert to hartleys (base-10 logarithms):
print(MI, unit = 'Hart')
#> value/Hart Q5.5% Q25% Q75% Q94.5%
#> 0.2250 0.099 0.19 0.28 0.32
# }