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

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/fmCov.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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, fitSfm, fitFfm

cov for more details on arguments use and method.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Time Series Factor model
data(managers)
fit <- fitTsfm(asset.names=colnames(managers[, (1:6)]), 
               factor.names=c("EDHEC.LS.EQ","SP500.TR"), data=managers)                              
fmCov(fit)

# Statistical Factor Model
data(StockReturns)
sfm.pca.fit <- fitSfm(r.M, k=2)
fmCov(sfm.pca.fit)

# Fundamental factor Model
data(Stock.df)
exposure.vars <- c("BOOK2MARKET", "LOG.MARKETCAP", "GICS.SECTOR")
fit2 <- fitFfm(data=stock, asset.var="TICKER", ret.var="RETURN", 
              date.var="DATE", exposure.vars=exposure.vars)
fmCov(fit2)

sangeeuw/factorAnalytics documentation built on May 28, 2019, 3:40 p.m.