VectorizedStatistics

Documentation for VectorizedStatistics.

VectorizedStatistics.vcorMethod
vcor(X::AbstractMatrix; dims::Int=1)

Compute the (Pearson's product-moment) correlation matrix of the matrix X, along dimension dims. As Statistics.cor, but vectorized.

source
VectorizedStatistics.vcorMethod
vcor(x::AbstractVector, y::AbstractVector)

Compute the (Pearson's product-moment) correlation between the vectors x and y. As Statistics.cor, but vectorized.

Equivalent to cov(x,y) / (std(x) * std(y)).

source
VectorizedStatistics.vcovMethod
vcov(X::AbstractMatrix; dims::Int=1, corrected::Bool=true)

Compute the covariance matrix of the matrix X, along dimension dims. As Statistics.cov, but vectorized.

If corrected is true as is the default, Bessel's correction will be applied, such that the sum is scaled by n-1 rather than n, where n = length(x).

source
VectorizedStatistics.vcovMethod
vcov(x::AbstractVector, y::AbstractVector; corrected::Bool=true)

Compute the covariance between the vectors x and y. As Statistics.cov, but vectorized.

If corrected is true as is the default, Bessel's correction will be applied, such that the sum is scaled by n-1 rather than n, where n = length(x).

source
VectorizedStatistics.vextremaMethod
vextrema(A; dims)

Find the maximum and minimum of A, optionally along the dimensions specified by dims. As Base.extrema, but vectorized.

Examples

julia> A = reshape(Vector(1:2:16), (2,2,2)) 2×2×2 Array{Int64, 3}: [:, :, 1] = 1 5 3 7

[:, :, 2] = 9 13 11 15

julia> extrema(A, dims = (1,2)) 1×1×2 Array{Tuple{Int64, Int64}, 3}: [:, :, 1] = (1, 7)

[:, :, 2] = (9, 15)

source
VectorizedStatistics.vmaximumMethod
vmaximum(A; dims)

Find the greatest value contained in A, optionally over dimensions specified by dims. As Base.maximum, but vectorized.

Examples

julia> using VectorizedStatistics

julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> vmaximum(A, dims=1)
1×2 Matrix{Int64}:
 3  4

julia>  vmaximum(A, dims=2)
 2×1 Matrix{Int64}:
 2
 4
source
VectorizedStatistics.vmeanMethod
vmean(A; dims)

Compute the mean of all elements in A, optionally over dimensions specified by dims. As Statistics.mean, but vectorized.

Examples

julia> using VectorizedStatistics

julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> vmean(A, dims=1)
1×2 Matrix{Float64}:
 2.0  3.0

julia> vmean(A, dims=2)
2×1 Matrix{Float64}:
 1.5
 3.5
source
VectorizedStatistics.vminimumMethod
vminimum(A; dims)

Find the least value contained in A, optionally over dimensions specified by dims. As Base.minimum, but vectorized

Examples

julia> using VectorizedStatistics

julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> vminimum(A, dims=1)
1×2 Matrix{Int64}:
 1  2

julia> vminimum(A, dims=2)
 2×1 Matrix{Int64}:
 1
 3
source
VectorizedStatistics.vstdMethod
vstd(A; dims=:, mean=nothing, corrected=true)

Compute the variance of all elements in A, optionally over dimensions specified by dims. As Statistics.var, but vectorized.

A precomputed mean may optionally be provided, which results in a somewhat faster calculation. If corrected is true, then Bessel's correction is applied, such that the sum is divided by n-1 rather than n.

Examples

julia> using VectorizedStatistics

julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> vstd(A, dims=1)
1×2 Matrix{Float64}:
 1.41421  1.41421

julia> vstd(A, dims=2)
2×1 Matrix{Float64}:
 0.7071067811865476
 0.7071067811865476
source
VectorizedStatistics.vsumMethod
vsum(A; dims)

Summate the values contained in A, optionally over dimensions specified by dims. As Base.sum, but vectorized.

Examples

julia> using VectorizedStatistics

julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> vsum(A, dims=1)
1×2 Matrix{Int64}:
 4  6

julia> vsum(A, dims=2)
2×1 Matrix{Int64}:
 3
 7
source
VectorizedStatistics.vvarMethod
vvar(A; dims=:, mean=nothing, corrected=true)

Compute the variance of all elements in A, optionally over dimensions specified by dims. As Statistics.var, but vectorized.

A precomputed mean may optionally be provided, which results in a somewhat faster calculation. If corrected is true, then Bessel's correction is applied, such that the sum is divided by n-1 rather than n.

Examples

julia> using VectorizedStatistics

julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> vvar(A, dims=1)
1×2 Matrix{Float64}:
 2.0  2.0

julia> vvar(A, dims=2)
2×1 Matrix{Float64}:
 0.5
 0.5
source