OnlineSampleStatistics

Documentation for OnlineSampleStatistics.

OnlineSampleStatistics.UnivariateStatisticMethod
UnivariateStatistic(T::Type, K::Int)

Construct an empty UnivariateStatistic with element type T, moment order K, and default weight type Int.


UnivariateStatistic(T::Type, K::Int, I::Type)

Construct an empty UnivariateStatistic with element type T, moment order K, and weight type I.

UnivariateStatistic(K::Int, x)

Construct from one sample x with moment order K and default unit weight.


UnivariateStatistic(K::Int, x, w)

Construct from one sample x with one weight w and moment order K.


UnivariateStatistic(T::Type, K::Int, I::Type, x, w)

Construct from one sample x and one weight w with explicit value type T, moment order K, and weight type I.


UnivariateStatistic(T::Type, K::Int, x)

Construct from one sample x (converted to T) with default weight type Int and unit weight.


UnivariateStatistic(T::Type, K::Int, I::Type, x, w)

Construct from one sample x and one weight w with element type T, moment order K, and weight type I.


UnivariateStatistic(T::Type, K::Int, x::AbstractArray)

Construct from an array of samples converted to T.


UnivariateStatistic(K::Int, x::AbstractArray)

Construct from an array of samples with moment order K, inferring value type from x (integer arrays are promoted to Float64).


UnivariateStatistic(K::Int, x::AbstractArray, w::AbstractArray)

Construct from arrays of samples and weights with moment order K.


UnivariateStatistic(T::Type, K::Int, I::Type, x::AbstractArray, w::AbstractArray)

Construct from arrays of samples and weights.


UnivariateStatistic(K::Int)

Construct an empty UnivariateStatistic of type Float64 and order K.

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::IndependentStatistic, B::IndependentStatistic)

Merge the statistics from independent statistic B into A, updating A in-place.

This operation combines the sample statistics from B into A by fitting A with the data represented by B. After merging, A will contain aggregated statistics from both sources.

Arguments

  • A::IndependentStatistic: The target statistic object to be updated (modified in-place)
  • B::IndependentStatistic: The source statistic object to merge into A

Returns

  • A::IndependentStatistic: The updated statistic object
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.mergeMethod
merge(A::IndependentStatistic, B::IndependentStatistic)

Merge two independent statistics by combining their data.

Creates a copy of statistic A and fits it with the data from statistic B, returning a new merged statistic C.

Arguments

  • A::IndependentStatistic: The first independent statistic
  • B::IndependentStatistic: The second independent statistic to merge into A

Returns

  • C::IndependentStatistic: A new statistic that is the result of merging A and B

See Also

  • merge!: In-place version of merge
source
Base.showMethod
show(io::IO, A::UnivariateStatistic)

Pretty-print a UnivariateStatistic object in a readable format with statistics summary.

Displays:

  • Number of observations (n)
  • Order (number of moments tracked)
  • Mean and variance (if available)
  • Skewness and kurtosis (if K ≥ 3 or K ≥ 4)
source
Base.summaryMethod
summary(A::IndependentStatistic)

Return a compact one-line summary of the statistic.

source
Base.summaryMethod
    summary(A::UnivariateStatistic)

Return a compact one-line summary of the statistic.

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; corrected=true)

Compute the sample standard deviation of a A, from its variance (corrected by default).

source
Statistics.stdMethod
 std(A::IndependentStatistic; corrected=true)

Compute the sample standard deviation of a A, from its variance (corrected by default).

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::IndependentStatistic{T,N,K}, B::IndependentStatistic)

Merge the accumulated statistics in B into A in-place. A must have compatible element type and size, and its number of moments K must be less than or equal to the one of B.

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
Base.readMethod
read(IndependentStatistic, fitsfile::FitsFile, stat_group_id::String; readkwds...)

Read an IndependentStatistic identified by stat_group_id from fitsfile. Extra keyword arguments are forwarded to AstroFITS when reading the weights HDU.

source
Base.readMethod
read(IndependentStatistic, fitsfile::FitsFile; ext=1, readkwds...)

Read an IndependentStatistic from fitsfile by taking the group ID from HDU ext. Throws ArgumentError if ext is not a stat HDU or misses STAT-GROUP-ID.

source
Base.writeMethod
write(file::FitsFile, hdr::AstroFITS.OptionalHeader,
      stat::IndependentStatistic, stat_group_id::String)

Write stat to file using stat_group_id. Throws ArgumentError if stat_group_id is already used by another statistic in the same FITS file.

source
Base.writeMethod
write(file::FitsFile, hdr::AstroFITS.OptionalHeader, stat::IndependentStatistic)

Write stat to file using a freshly generated unique group ID.

source
OnlineSampleStatistics.find_stat_hdusMethod
find_stat_hdus(fitsfile::FitsFile, stat_group_id::String)

Find all HDUs belonging to stat_group_id and return (moments_hdus, weights_hdu, T, N, K, W). Throws ArgumentError if required HDUs or metadata are missing/inconsistent.

source