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

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

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
fmCov(object, ...)

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

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

Arguments

object

fit object of class tsfm, sfm or ffm.

...

optional arguments passed to cov.

use

an optional character string giving a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "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
18
19
20
21
22
23
24
25
26
27
# 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)

## Not run: 
# Fundamental Factor Model
data(stock)
# there are 447 assets
exposure.names <- c("BOOK2MARKET", "LOG.MARKETCAP")
beta.mat <- subset(stock, DATE=="2003-12-31")[, exposure.names]
beta.mat1 <- cbind(rep(1, 447), beta.mat1)
# FM return covariance
fit.fund <- fitFfm(exposure.names=c("BOOK2MARKET", "LOG.MARKETCAP"),
                   data=stock, returnsvar="RETURN", datevar="DATE",
                   assetvar="TICKER", wls=TRUE, regression="classic",
                   covariance="classic", full.resid.cov=FALSE)
ret.cov.fundm <- fmCov(beta.mat1,fit.fund$factor.cov$cov,fit.fund$resid.sd)
fit.fund$returns.cov$cov == ret.cov.fundm

## End(Not run)

arorar/FactorAnalytics documentation built on May 10, 2019, 1:47 p.m.