fmCov: Covariance Matrix for assets' returns from fitted factor...

View source: R/fmCov.R

fmCovR Documentation

Covariance Matrix for assets' returns from fitted factor model.

Description

Computes the covariance matrix for assets' returns based on a fitted factor model. This is a generic function with methods for classes tsfm, sfm and ffm.

Usage

fmCov(object, ...)

## S3 method for class 'tsfm'
fmCov(object, factor.cov, use = "pairwise.complete.obs", ...)

## S3 method for class 'sfm'
fmCov(object, use = "pairwise.complete.obs", ...)

## S3 method for class 'ffm'
fmCov(object, use = "pairwise.complete.obs", ...)

Arguments

object

fit object of class tsfm, sfm or ffm.

...

optional arguments passed to cov.

factor.cov

factor covariance matrix (optional); defaults to the sample covariance matrix.

use

method for computing covariances in the presence of missing values; one of "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs". Default is "pairwise.complete.obs".

Details

R(i, t), the return on asset i at time t, is assumed to follow a factor model of the form,

R(i,t) = alpha(i) + beta(i)*f(t) + e(i,t),

where, alpha(i) is the intercept, f(t) is a K x 1 vector of factor returns at time t, beta(i) is a 1 x K vector of factor exposures and the error terms e(i,t) are serially uncorrelated across time and contemporaneously uncorrelated across assets so that e(i,t) ~ iid(0,sig(i)^2). Thus, the variance of asset i's return is given by

var(R(i)) = beta(i)*cov(F)*tr(beta(i)) + sig(i)^2.

And, the N x N covariance matrix of asset returns is

var(R) = B*cov(F)*tr(B) + D,

where, B is the N x K matrix of factor betas and D is a diagonal matrix with sig(i)^2 along the diagonal.

The method for computing covariance can be specified via the ... argument. Note that the default of use="pairwise.complete.obs" for handling NAs restricts the method to "pearson".

Value

The computed N x N covariance matrix for asset returns based on the fitted factor model.

Author(s)

Eric Zivot, Yi-An Chen and Sangeetha Srinivasan.

References

Zivot, E., & Jia-hui, W. A. N. G. (2006). Modeling Financial Time Series with S-Plus Springer-Verlag.

See Also

fitTsfm,fitFfm

cov for more details on arguments use and method.

Examples

# Time Series Factor model example
 # load data
data(managers, package = 'PerformanceAnalytics')
 # Make syntactically valid column names
colnames(managers)
colnames(managers) <- make.names( colnames(managers))
colnames(managers)

fit <- fitTsfm(asset.names = colnames(managers[, (1:6)]), 
               factor.names = c("EDHEC.LS.EQ","SP500.TR"), 
               data = managers)                              
fmCov(fit)


braverock/factorAnalytics documentation built on March 2, 2024, 11:17 p.m.