Sigma_sample_estimator: Sample covariance matrix

View source: R/BDOPS_2020.R

Sigma_sample_estimatorR Documentation

Sample covariance matrix

Description

It computes the sample covariance of matrix S as follows:

S = \frac{1}{n-1} ∑_{j=1}^n (x_j - \bar x)(x_j - \bar x)' ,\quad \bar x = \frac{1}{n} ∑_{j=1}^n x_j ,

where x_j is the j-th column of the data matrix x.

Usage

Sigma_sample_estimator(x)

Arguments

x

a p by n matrix or a data frame of asset returns. Rows represent different assets, columns – observations.

Value

Sample covariance estimation

Examples

p<-5 # number of assets
n<-1e1 # number of realizations

x <-matrix(data = rnorm(n*p), nrow = p, ncol = n)
Sigma_sample_estimator(x)

HDShOP documentation built on Nov. 10, 2022, 5:12 p.m.