Pairwise estimates of statistics
These estimators operate on pairs of uncertain values, which can be of any type, , such as populations, theoretical distributions, KDE distributions or fitted distributions. They compute the statistic in question by drawing independent length-n
draws of each of the two uncertain values, then computing the statistic on those draws.
Syntax
The syntax for computing the statistic f
for uncertain values x
and y
is:
f(x::AbstractUncertainValue, y::AbstractUncertainValue, args..., n::Int; kwargs...)
, which draws independent length-n
draws ofx
andy
, then estimates the statisticf
for those draws.
Methods
Covariance
Statistics.cov
— Methodcov(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int;
corrected::Bool = true)
Compute the covariance between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the covariance between those length-n
draws.
Correlation (Pearson)
Statistics.cor
— Methodcor(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute the Pearson correlation between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the Pearson correlation between those length-n
draws.
Correlation (Kendall)
StatsBase.corkendall
— Methodcorkendall(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute Kendalls's rank correlation coefficient between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing Kendalls's rank correlation coefficient between those length-n
draws.
Correlation (Spearman)
StatsBase.corspearman
— Methodcorspearman(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute Spearman's rank correlation coefficient between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the Spearman's rank correlation coefficient between those length-n
draws.
Count non-equal
StatsBase.countne
— Methodcountne(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Count the number of indices at which the elements of two independent length-n
draws of x
and for y
are not equal.
Count equal
StatsBase.counteq
— Methodcounteq(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Count the number of indices at which the elements of two independent length-n
draws of x
and for y
are equal.
Maximum absolute deviation
StatsBase.maxad
— Methodmaxad(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute the maximum absolute deviation between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the maximum absolute deviation between those length-n
draws.
Mean absolute deviation
StatsBase.meanad
— Methodmeanad(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute the mean absolute deviation between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the mean absolute deviation between those length-n
draws.
Mean squared deviation
StatsBase.msd
— Methodmsd(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute the mean squared deviation between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the mean squared deviation between those length-n
draws.
Peak signal-to-noise ratio
StatsBase.psnr
— Methodpsnr(x::AbstractUncertainValue, y::AbstractUncertainValue, maxv, n::Int)
Compute the peak signal-to-noise ratio between two uncertain values by independently drawing n
samples from x
and from y
, yielding x_draw
and y_draw
, then computing the peak signal-to-noise ratio between those length-n
draws.
The PSNR is computed as 10 * log10(maxv^2 / msd(x_draw, y_draw))
, where maxv
is the maximum possible value x
or y
can take
Root mean squared deviation
StatsBase.rmsd
— Methodrmsd(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int,
normalize = false)
Compute the root mean squared deviation between two uncertain values by independently drawing n
samples from x
and from y
, yielding x_draw
and y_draw
, then computing the the root mean squared deviation between those length-n
draws. The root mean squared deviation is computed as sqrt(msd(x_draw, y_draw))
. Optionally, x_draw
and y_draw
may be normalised.
Squared L2 distance
StatsBase.sqL2dist
— MethodsqL2dist(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute the squared L2 distance between two uncertain values by independently drawing n
samples from x
and from y
, then computing the squared L2 distance between those length-n
draws: $\sum_{i=1}^n |x_i - y_i|^2$.
Cross correlation
StatsBase.crosscor
— Methodcrosscor(x::AbstractUncertainValue, y::AbstractUncertainValue, [lags],
n::Int; demean = true)
Compute the cross correlation between two uncertain values by independently drawing n
samples from x
and n
samples from y
, x_draw
and y_draw
, then computing the cross correlation between those length-n
draws. demean
specifies whether the respective means of the x_draw
and y_draw
should be subtracted from them before computing their cross correlation.
When left unspecified, the lags
used are -min(n-1, 10*log10(n))
to min(n, 10*log10(n))
.
The output is normalized by sqrt(var(x_draw)*var(y_draw))
. See crosscov
for the unnormalized form.
Cross covariance
StatsBase.crosscov
— Methodcrosscov(x::AbstractUncertainValue, y::AbstractUncertainValue, [lags],
n::Int; demean = true)
Compute the cross covariance function (CCF) between two uncertain values by independently drawing n
samples from x
and n
samples from y
, x_draw
and y_draw
, then computing the cross correlation between those length-n
draws. demean
specifies whether the respective means of the x_draw
and y_draw
should be subtracted from them before computing their CCF.
When left unspecified, the lags
used are -min(n-1, 10*log10(n))
to min(n, 10*log10(n))
.
The output is not normalized. See crosscor
for a function with normalization.
Generalized Kullback-Leibler divergence
StatsBase.gkldiv
— Methodgkldiv(x::AbstractUncertainValue, y::AbstractUncertainValue, n::Int)
Compute the generalized Kullback-Leibler divergence between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the generalized Kullback-Leibler divergence between those length-n
draws.
Kullback-Leibler divergence
StatsBase.kldivergence
— Methodkldivergence(x::AbstractUncertainValue, y::AbstractUncertainValue, [b],
n::Int)
Compute the Kullback-Leibler divergence between two uncertain values by independently drawing n
samples from x
and n
samples from y
, then computing the Kullback-Leibler divergence between those length-n
draws. Optionally a real number b
can be specified such that the divergence is scaled by 1/log(b)
.