getCorr: Average correlation

Description Usage Arguments Value Author(s) See Also Examples

Description

Determine the average correlation or average correlation by industry of a variance-covariance matrix.

Usage

1
getCorr(V, industry = NULL)

Arguments

V

Variance-covariance matrix.

industry

A vector specifying the industry of the stocks in their order given in the columns (and rows) of V. This argument is optional.

Value

If industry is not provided, then the average correlation in V in the matrix is returned but ignoring the diagonal. If industry is provided, then the output is a matrix with dimension k-by-k, where k is the number of unique values in industry.

Author(s)

David Diez

See Also

stockModel

Examples

1
2
3
4
5
6
7
8
#===> the covariance matrix of stock94 <===#
data(stock94)
data(stock94Info)
V <- cov(stock94)

#===> the average correlation <===#
getCorr(V)
getCorr(V, industry=stock94Info$industry)

jankcorn/stockPortfolio documentation built on May 14, 2019, 9:35 a.m.