OnlineSampleStatistics

Documentation for OnlineSampleStatistics.

OnlineSampleStatistics.UnivariateStatisticMethod
UnivariateStatistic(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.

source
OnlineSampleStatistics.UnivariateStatisticMethod
UnivariateStatistic(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. xwill be converted to type T is needed.

source
OnlineSampleStatistics.UnivariateStatisticMethod
UnivariateStatistic(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.

source
Base.copyMethod
copy(A::UnivariateStatistic)

Copy (deepcopy) the UnivariateStatistic A to a new object.

source
Base.empty!Method
empty!(A::UnivariateStatistic)

Reset the UnivariateStatistic `A` to its initial state.
source
Base.merge!Method
merge!(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])
source
Base.zeroMethod
zero(::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`.
source
OnlineSampleStatistics.get_momentsMethod
get_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.

source
OnlineSampleStatistics.get_rawmomentsMethod
get_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.

source
OnlineSampleStatistics.get_rawmomentsMethod
get_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.

source
Statistics.stdMethod
std(A::UnivariateStatistic)

Compute the uncorrected sample standard deviation of a A.

source
Statistics.varMethod
var(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.

source
StatsAPI.fit!Method
fit!(A::UnivariateStatistic{T}, y::T2) where {T, T2}

Pushes a new samples y into the UnivariateStatistic A.

Throws

  • ArgumentError: If the type of elements in y is not compatible with the type T of A.
source
StatsAPI.nobsMethod
nobs(A::UnivariateStatistic)

Return the number of samples or the sum of weights in a A.

source
StatsAPI.weightsMethod
weights(x::AbstractArray{UnivariateStatistic})

Retrieves the weights from an array of UnivariateStatistic objects.

source