factorModelCovariance: Compute Factor Model Covariance Matrix.

Description Usage Arguments Details Value Author(s) References Examples

Description

Compute asset return covariance matrix from factor model.

Usage

1
  factorModelCovariance(beta, factor.cov, resid.variance)

Arguments

beta

N x K matrix of factor betas, where N is the number of assets and K is the number of factors.

factor.cov

K x K factor return covariance matrix.

resid.variance

N x 1 vector of asset specific residual variances from the factor model.

Details

The return on asset i is assumed to follow the factor model
R(i,t) = alpha + t(beta)*F(t) + e(i,t), e(i,t) ~ iid(0, sig(i)^2)
where beta is a K x 1 vector of factor exposures. The return variance is then
var(R(i,t) = t(beta)*var(F(t))*beta + sig(i)^2,
and the N x N covariance matrix of the return vector R is
var(R) = B*var(F(t))*t(B) + D
where B is the N x K matrix of asset betas and D is a diagonal matrix with sig(i)^2 values along the diagonal.

Value

N x N return covariance matrix based on factor model parameters.

Author(s)

Eric Zivot and Yi-An Chen.

References

Zivot, E. and J. Wang (2006), Modeling Financial Time Series with S-PLUS, Second Edition, Springer-Verlag.

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
28
29
30
31
32
33
34
35
36
37
## Not run: 
# Time Series model

data(managers.df)
factors    = managers.df[,(7:9)]
fit <- fitTimeSeriesFactorModel(assets.names=colnames(managers.df[,(1:6)]),
                                factors.names=c("EDHEC.LS.EQ","SP500.TR"),
                                data=managers.df,fit.method="OLS")
factors    = managers.df[,(7:8)]
factorModelCovariance(fit$beta,var(factors),fit$resid.variance)

# Statistical Model
data(stat.fm.data)
sfm.pca.fit <- fitStatisticalFactorModel(sfm.dat,k=2)
#' factorModelCovariance(t(sfm.pca.fit$loadings),var(sfm.pca.fit$factors),sfm.pca.fit$resid.variance)

sfm.apca.fit <- fitStatisticalFactorModel(sfm.apca.dat,k=2)

factorModelCovariance(t(sfm.apca.fit$loadings),
                       var(sfm.apca.fit$factors),sfm.apca.fit$resid.variance)

 # fundamental factor model example
 #'
 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)
fit.fund <- fitFundamentalFactorModel(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 <- factorModelCovariance(beta.mat1,fit.fund$factor.cov$cov,fit.fund$resid.variance)
fit.fund$returns.cov$cov == ret.cov.fundm

## End(Not run)

R-Finance/FactorAnalytics documentation built on May 8, 2019, 3:51 a.m.