OnlineSampleStatistics
Documentation for OnlineSampleStatistics.
OnlineSampleStatistics.UnivariateStatistic
OnlineSampleStatistics.UnivariateStatistic
OnlineSampleStatistics.UnivariateStatistic
OnlineSampleStatistics.UnivariateStatistic
OnlineSampleStatistics.UnivariateStatistic
OnlineSampleStatistics.UnivariateStatistic
Base.copy
Base.empty!
Base.merge!
Base.zero
OnlineSampleStatistics.get_moments
OnlineSampleStatistics.get_moments
OnlineSampleStatistics.get_rawmoments
OnlineSampleStatistics.get_rawmoments
OnlineSampleStatistics.nonnegative
OnlineSampleStatistics.order
Statistics.mean
Statistics.std
Statistics.var
StatsAPI.fit!
StatsAPI.nobs
StatsAPI.weights
StatsAPI.weights
OnlineSampleStatistics.UnivariateStatistic
— MethodUnivariateStatistic(T::Type, TW::Type, K::Int)
Constructs an empty UnivariateStatistic
object of type T
with K
moments and weights of type TW
.
OnlineSampleStatistics.UnivariateStatistic
— MethodInner constructor rawmoments can be given as a vector or a NTuple
OnlineSampleStatistics.UnivariateStatistic
— MethodUnivariateStatistic(x::AbstractArray{T}, w::AbstractArray, K::Int) where {T<:Number}
Constructs a UnivariateStatistic
object of type T
with K
moments from a vector of samples x
and a vector of weights w
.
OnlineSampleStatistics.UnivariateStatistic
— MethodUnivariateStatistic(K::Int, x::AbstractArray{T}) where {T<:Number}
Constructs a UnivariateStatistic object storing the first K
moments from the vector of samples x
.
OnlineSampleStatistics.UnivariateStatistic
— MethodUnivariateStatistic(x::T,K::Int) where {T<:Number}
Constructs a UnivariateStatistic
object of type T
with K
moments from a single sample x
. The first moment (the mean) is then x
and the remaining moments are zeros of type T
. The weight counts the number of sample set to 1
.
UnivariateStatistic(K::Int, T::Type)
Constructs an empty UnivariateStatistic
object of type T
with K
moments.
UnivariateStatistic(K::Int)
Constructs an empty UnivariateStatistic
object of type Float64 with K
moments.
UnivariateStatistic(::Type{T}, x, K::Int) where {T}
Constructs a UnivariateStatistic
object of type T
with a single sample x
. x
will be converted to type T
is needed.
OnlineSampleStatistics.UnivariateStatistic
— MethodUnivariateStatistic(x::T, weight::Number, K::Int) where {T<:Number}
Constructs a UnivariateStatistic
object with K
moments of type T
from a single sample x
and a weight weight
. The first moment (the mean) is then x
and the remaining moments are zeros of type T
.
Base.copy
— Methodcopy(A::UnivariateStatistic)
Copy (deepcopy) the UnivariateStatistic A
to a new object.
Base.empty!
— Methodempty!(A::UnivariateStatistic)
Reset the UnivariateStatistic `A` to its initial state.
Base.merge!
— Methodmerge!(A::UnivariateStatistic, B::UnivariateStatistic)
Merges (inplace) the statistics from B
into A
in-place.
Example
A = UnivariateStatistic(2, [1.0, 0.5])
B = UnivariateStatistic(2, [2.0, 1.5])
merge!(A, B)
A ≈ UnivariateStatistic(2, [1.0, 0.5, 2.0, 1.5])
Base.zero
— Methodzero(::UnivariateStatistic{T}) where {T<:UnivariateStatistic}
zero(::Type{UnivariateStatistic{T,K,I,L}}) where {T,K,I,L}
return an empty UnivariateStatistic of type `T` with `K` moments and weights of type `I`.
OnlineSampleStatistics.get_moments
— Methodget_moments(x::AbstractArray{UnivariateStatistic}, k::Int)
Retrieve the k
-th moments from an array of UnivariateStatistic
objects. Returns an array where each element corresponds to the k
-th moment of the respective UnivariateStatistic
in x
.
OnlineSampleStatistics.get_moments
— Methodget_moments(A::UnivariateStatistic, k) -> Number
Compute the k-th moment of a UnivariateStatistic A
.
OnlineSampleStatistics.get_rawmoments
— Methodget_rawmoments(x::AbstractArray{UnivariateStatistic}, k::Int)
Retrieve the k
-th raw moments from an array of UnivariateStatistic
objects. Returns an array where each element corresponds to the k
-th raw moment of the respective UnivariateStatistic
in x
.
OnlineSampleStatistics.get_rawmoments
— Methodget_rawmoments(x::AbstractArray{<:UnivariateStatistic})
Retrieve the raw moments from an array of UnivariateStatistic
objects. Returns an array where each element corresponds to the raw moments of the respective UnivariateStatistic
in x
.
OnlineSampleStatistics.nonnegative
— Methodnonnegative(x)
Check if the input x
is nonnegative (greater than or equal to zero).
OnlineSampleStatistics.order
— Method" order(A::UnivariateStatistic) Return the number of moments in a A
.
Statistics.mean
— Methodmean(A::UnivariateStatistic)
Compute the sample mean of a A
Statistics.std
— Methodstd(A::UnivariateStatistic)
Compute the uncorrected sample standard deviation of a A
.
Statistics.var
— Methodvar(A::UnivariateStatistic; corrected=true)
Compute the sample variance of a A
. If corrected
is true, the variance is corrected for bias. The unbias variance estimator is only available for an integer number of sample.
StatsAPI.fit!
— Methodfit!(A::UnivariateStatistic{T}, y::T2) where {T, T2}
Pushes a new samples y
into the UnivariateStatistic A
.
Throws
ArgumentError
: If the type of elements iny
is not compatible with the typeT
ofA
.
StatsAPI.nobs
— Methodnobs(A::UnivariateStatistic)
Return the number of samples or the sum of weights in a A
.
StatsAPI.weights
— Methodweights(x::AbstractArray{UnivariateStatistic})
Retrieves the weights from an array of UnivariateStatistic
objects.
StatsAPI.weights
— Methodweights(A::UnivariateStatistic)
Return the sum of weights in a A
.