Variance from covariance
Statistics.var Method
Statistics.var(ce::AbstractCovarianceEstimator, X::MatNum; dims::Int = 1, kwargs...)Compute the variance vector from the diagonal of the covariance matrix.
This method extracts the diagonal of the covariance matrix returned by Statistics.cov(ce, X; dims = dims, kwargs...) and reshapes it into a row or column vector depending on dims.
Arguments
ce: Covariance estimator.X: Data matrix of asset returns (observations × assets).dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the covariance estimator.
Returns
var::Matrix{<:Number}: Variance vector, shaped as(1, N)ifdims == 1or(N, 1)ifdims == 2.
Related
sourceStatistics.std Method
Statistics.std(ce::AbstractCovarianceEstimator, X::MatNum; dims::Int = 1, kwargs...)Compute the standard deviation vector from the diagonal of the covariance matrix.
This method extracts the diagonal of the covariance matrix returned by Statistics.cov(ce, X; dims = dims, kwargs...), takes the element-wise square root, and reshapes it into a row or column vector depending on dims.
Arguments
ce: Covariance estimator.X: Data matrix of asset returns (observations × assets).dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the covariance estimator.
Returns
sd::Matrix{<:Number}: Standard deviation vector, shaped as(1, N)ifdims == 1or(N, 1)ifdims == 2.
Related
source