BinningAnalysis.ErrorPropagator
— MethodErrorPropagator(zero_element::T...[; capacity::Int])
Creates a new ErrorPropagator
which can take (at least) capacity
many values for each input of type T
. The type and the size are inherited from the given zero_element
s, which must exclusively contain zeros.
Values can be added using push!
and append!
.
ErrorPropagator(timeseries::AbstractVector{T}...)
Creates a new ErrorPropagator
and adds all elements from each given timeseries.
BinningAnalysis.ErrorPropagator
— MethodErrorPropagator([::Type{T}; N_args, capacity::Int])
Creates an ErrorPropagator
which can handle (at least) capacity
many values for each of N_args
inputs of type T
.
The default is T = Float64
, N_args = 2
and capacity = 2^32-1 ≈ 4e9
.
BinningAnalysis.FastVariance
— TypeFastVariance <: AbstractVarianceAccumulator
The FastVariance
accumulator keeps track of ∑x
and ∑x²
where x
refers to the pushed values. It is significantly faster than the Variance
accumulator, but can become unstable for some inputs. (For example when the mean is much large than the variance of the pushed values.)
See also: AbstractVarianceAccumulator
, Variance
BinningAnalysis.IncrementBinner
— MethodIncrementBinner([::Type{T}; blocksize = 64])
IncrementBinner(zero_element::T[; blocksize = 64])
Creates an IncrementBinner
from a zero_element
numeric type T
.
Values pushed to an IncrementBinner
are averaged in stages. For the first blocksize
values pushed no averaging happens. After that 2blocksize
elements are averaged 2 at a time, then 4blocksize
element 4 at a time, etc. This means values pushed become progressively more compressed and smoothed.
BinningAnalysis.LogBinner
— MethodLogBinner(zero_element::T[; capacity::Int])
Creates a new LogBinner
which can take (at least) capacity
many values of type T
. The type and the size are inherited from the given zero_element
, which must exclusively contain zeros.
Values can be added using push!
and append!
.
LogBinner(timeseries::AbstractVector{T})
Creates a new LogBinner
and adds all elements from the given timeseries.
BinningAnalysis.LogBinner
— MethodLogBinner(B::LogBinner[; capacity::Int])
Creates a new LogBinner
from an existing LogBinner, copying the data inside. The new LogBinner may be larger or smaller than the given one.
BinningAnalysis.LogBinner
— MethodLogBinner(compressors, x_sum, x2_sum, count)
Creates a new (equivalent) LogBinner
from the fields of < v0.5 LogBinner.
BinningAnalysis.LogBinner
— MethodLogBinner([::Type{T}; capacity::Int])
Creates a LogBinner
which can handle (at least) capacity
many values of type T
.
The default is T = Float64
and capacity = 2^32-1 ≈ 4e9
.
BinningAnalysis.Variance
— TypeVariance <: AbstractVarianceAccumulator
The Variance
accumulator uses Welfords algorithm to keep track of pushed values and to compute variances and errors. It is less error prone than FastVariance
but also slower.
See also: AbstractVarianceAccumulator
, FastVariance
Base.append!
— Methodappend!(B::AbstractBinner, values::AbstractArray)
Adds an array of values to the binner.
Base.append!
— Methodappend!(ErrorPropagator, values...)
Adds multiple arrays of values to the Error Propagator by push!
ing each element.
Base.empty!
— Methodempty!(V::AbstractVarianceAccumulator)
Clear the given variance accumulator.
Base.empty!
— Methodempty!(ep::ErrorPropagator)
Clear the error propagator, i.e. reset it to its inital state.
Base.empty!
— Methodempty!(B::LogBinner)
Clear the binner, i.e. reset it to its inital state.
Base.isempty
— Methodisempty(V::AbstractVarianceAccumulator)
Returns true if the given variance accumulator is empty.
Base.push!
— Methodpush!(ep::ErrorPropagator, args...)
Pushes a set of argumentes args
into a given error propagator. Note that the number of arguments must match the initially defined N_arguments
of the error propagator.
Base.push!
— Methodpush!(B::LogBinner, value)
Pushes a new value into the Binning Analysis.
Base.push!
— Methodpush!(V::AbstractVarianceAccumulator{T}, value::T)
Pushes a new value into the variance accumulator.
BinningAnalysis.all_autocorrelation_times
— Methodall_autocorrelation_times(B::AbstractBinner)
Calculates the autocorrelation time tau for each binning level of a given binner.
BinningAnalysis.all_autocorrelations
— Methodall_autocorrelations(B::AbstractBinner)
Calculates the autocorrelation time tau for each binning level of a given binner.
BinningAnalysis.all_means
— Methodall_means(B::AbstractBinner)
Calculates the mean for each binning level of a given binner.
BinningAnalysis.all_std_errors
— Methodall_std_errors(B::AbstractBinner)
Calculates the standard error for each binning level of a given binner.
BinningAnalysis.all_taus
— Methodall_taus(B::AbstractBinner)
Calculates the autocorrelation time tau for each binning level of a given binner.
BinningAnalysis.all_varNs
— Methodall_varNs(B::AbstractBinner)
Calculates the variance/N for each binning level of a given binner.
BinningAnalysis.all_vars
— Methodall_vars(B::AbstractBinner)
Calculates the variance for each binning level of a given binner.
BinningAnalysis.autocorrelation
— Functionautocorrelation(B::AbstractBinner[, lvl])
Calculates the autocorrelation time tau for a given binner relative to an optional binning level. The default binning level is picked such that at least 32 bins exist.
BinningAnalysis.autocorrelation_time
— Functionautocorrelation_time(B::AbstractBinner[, lvl])
Calculates the autocorrelation time tau for a given binner relative to an optional binning level. The default binning level is picked such that at least 32 bins exist.
BinningAnalysis.capacity
— Methodcapacity(ep)
Capacity of the error propagator, i.e. how many values can be handled before overflowing.
BinningAnalysis.capacity
— Methodcapacity(B)
Capacity of the binner, i.e. how many values can be handled before overflowing.
BinningAnalysis.convergence
— Methodconvergence(B::LogBinner, lvl)
Computes the difference between the variance of this lvl and the last, normalized to the last lvl. If this value tends to 0, the Binning Analysis has converged.
BinningAnalysis.covmat
— Methodcovmat(B::ErrorPropagator[, lvl])
Returns the covariance matrix for a given level of the error propgator.
BinningAnalysis.has_converged
— Functionhas_converged(B::LogBinner, lvl[, threshhold = 0.05])
Returns true if the Binning Analysis has converged for a given lvl.
BinningAnalysis.means
— Functionmeans(B::ErrorPropagator[, lvl])
Calculates the mean for each argument of the error propagator at a given binning level.
BinningAnalysis.std_error
— Functionstd_error(B::ErrorPropagator, gradient[, lvl])
Gives the first-order standard error estimate of a function f
acting on the arguments of the error propagator. gradient
is either the gradient of f
(a function) or a vector ∇f(means(B))
. To get an estimate mean value of f
, mean(B, f)
can be used.
BinningAnalysis.std_error
— Functionstd_error(B::ErrorPropagator, i[, lvl])
Calculates the standard error of the mean for the i-th argument of the error propagator at a given binning level.
BinningAnalysis.std_error
— Functionstd_error(B::AbstractBinner[, lvl])
Calculates the standard error of the mean.
BinningAnalysis.std_error
— Methodstd_error(x[; method])
Estimate the standard error of the mean of the given time series.
The keyword method
can be used to choose one out of the following methods:
- Logarithmic binning:
:log
(default) - Full binning:
:full
- Jackknife resampling:
:jackknife
BinningAnalysis.std_errors
— Functionstd_errors(B::ErrorPropagator[, lvl])
Calculates the standard error of the mean for each argument of the error propagator at a given binning level.
BinningAnalysis.tau
— Functiontau(B::ErrorPropagator, i[, lvl])
Calculates the autocorrelation time tau for the i-th argument of the error propagator at a given binning level.
BinningAnalysis.tau
— Functiontau(B::LogBinner[, lvl])
Calculates the autocorrelation time tau for a given binner relative to an optional binning level. The default binning level is picked such that at least 32 bins exist.
BinningAnalysis.tau
— Methodtau(x[; method])
Estimate the autocorrelation time of the given time series.
The keyword method
can be used to choose one out of the following methods:
- Logarithmic binning:
:log
(default) - Full binning:
:full
BinningAnalysis.unbinned_tau
— Methodunbinned_tau(sample[; truncate = true, max_rel_err = 0.0, min_sample_size = 32])
Estimates the autocorrelation time τ = ∑ₖ (1 - k/N) χₖ/χ₀
from a sample using the correlation function χₖ = ⟨xᵢ xᵢ₊ₖ⟩ - ⟨xᵢ⟩⟨xᵢ₊ₖ⟩
where x are values in the sample.
Note that by default this function truncated the sum over k if v / τ < max_rel_err / (N - k)
or if the k > N - min_sample_size
. The former cuts of fluctuations around 0 and can be turned of with truncate = false
.
BinningAnalysis.varN
— FunctionvarN(B::LogBinner[, lvl])
Calculates the variance/N of a given level in the Binning Analysis.
BinningAnalysis.varN
— FunctionvarN(B::ErrorPropagator, gradient[, lvl])
Gives the first-order variance/N estimate of a function `f` acting on the
arguments of the error propagator. `gradient` is either the gradient of `f` (a
function) or a vector `∇f(means(B))`. To get an estimate mean value of `f`,
`mean(B, f)` can be used.
BinningAnalysis.varN
— FunctionvarN(B::LogBinner[, lvl])
Calculates the variance/N of a given level in the Binning Analysis.
BinningAnalysis.varN
— FunctionvarN(B::ErrorPropagator, i[, lvl])
Calculates the variance/N for the i-th argument of the error propagator at a given binning level.
BinningAnalysis.varN
— MethodvarN(V::AbstractVarianceAccumulator)
Calculates the variance/N of a given variance accumulator.
BinningAnalysis.varNs
— FunctionvarNs(B::ErrorPropagator[, lvl])
Calculates the variance/N for each argument of the error propagator at a given binning level.
BinningAnalysis.vars
— Functionvars(B::ErrorPropagator[, lvl])
Calculates the variance for each argument of the error propagator at a given binning level.
Statistics.mean
— Functionmean(B::LogBinner[, lvl])
Calculates the mean for a given level in the Binning Analysis.
Statistics.mean
— Functionmean(B, f[, lvl=1])
Returns an estimate for the mean value of f
, where f
is a function acting on the sample pushed the error porpagator. f
must be of the form f(v)
, where v = [mean_arg1, mean_arg2, ..., mean_argN]
is a vector containing the averages of each argument pushed to the error propagator.
Statistics.mean
— Functionmean(B::LogBinner[, lvl])
Calculates the mean for a given level in the Binning Analysis.
Statistics.mean
— Functionmean(B::ErrorPropagator, i[, lvl = 1])
Calculates the mean for the i-th argument of the error propagator at an optional binning level.
Statistics.mean
— Methodmean(V::AbstractVarianceAccumulator)
Calculates the mean of a given variance accumulator.
Statistics.var
— Functionvar(B::ErrorPropagator, i[, lvl])
Calculates the variance for the i-th argument of the error propagator at a given binning level.
Statistics.var
— Functionvar(B::LogBinner[, lvl])
Calculates the variance of a given level in the Binning Analysis.
Statistics.var
— Functionvar(B::LogBinner[, lvl])
Calculates the variance of a given level in the Binning Analysis.
Statistics.var
— Methodvar(V::AbstractVarianceAccumulator)
Calculates the variance of a given variance accumulator.
Statistics.var
— Methodvar(B::ErrorPropagator, gradient[, lvl])
Gives the first-order variance estimate of a function f
acting on the arguments of the error propagator. gradient
is either the gradient of f
(a function) or a vector ∇f(means(B))
. To get an estimate mean value of f
, mean(B, f)
can be used.
BinningAnalysis.Jackknife
— ModuleJackknife errors for (non-linear) functions of uncertain data, i.e. g(<a>, <b>, ...)
where <a>
, <b>
are the means of data sets a
and b
. Use jackknife_full(g, a, b, ...)
to get the jackknife estimate, bias and error or jackknife(g, a, b, ...)
to get just the estimate and error.
See: jackknife_full
, jackknife
BinningAnalysis.Jackknife.bias
— Methodbias(g::Function, a[, b, ...])
Returns the jackknife bias for a given function g(<a>, <b>, ...)
acting on the means of the samples a
, b
, etc.
BinningAnalysis.Jackknife.estimate
— Methodestimate(g::Function, a[, b, ...])
Returns the (bias corrected) jackknife estimate for a given function g(<a>, <b>, ...)
acting on the means of the samples a
, b
, etc. If leaveoneout
has already been calculated it can be supplied via the keyword argument reduced_results
.
BinningAnalysis.Jackknife.jackknife
— Methodjackknife(g::Function, a[, b, ...])
Returns the jackknife estimate and error for a given function g(<a>, <b>, ...)
acting on the means of the samples a
, b
, etc.
Example: # Assuming some sample xs is given # variance of sample xs g(x2, x) = x2 - x^2 error = jackknife(g, xs.^2, xs)
BinningAnalysis.Jackknife.jackknife_full
— Methodjackknife_full(g::Function, a[, b, ...])
Returns the jackknife estimate, bias and error for a given function g(<a>, <b>, ...)
acting on the means of the samples a
, b
, etc.
Example: # Assuming some sample xs is given # variance of sample xs g(x2, x) = x2 - x^2 estimate, bias, error = jackknife_full(g, xs.^2, xs)
BinningAnalysis.Jackknife.leaveoneout
— Methodleaveoneout(g::Function, samples::AbstractVector{<:Number}...)
Generates N sub-samples for each sample in samples
, where one value is left out and applies it mean to the function g
. The result is used for a 1-jackknife.
BinningAnalysis.Jackknife.std_error
— Methodstd_error(g::Function, a[, b, ...])
Returns the jackknife error for a given function g(<a>, <b>, ...)
acting on the means of the samples a
, b
, etc.
Statistics.var
— Methodvar(g::Function, a[, b, ...])
Returns the jackknife variance for a given function g(<a>, <b>, ...)
acting on the means of the samples a
, b
, etc.