[Returnanalytics-commits] r2991 - in pkg/FactorAnalytics: R man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 5 01:09:18 CEST 2013


Author: chenyian
Date: 2013-09-05 01:09:17 +0200 (Thu, 05 Sep 2013)
New Revision: 2991

Modified:
   pkg/FactorAnalytics/R/fitFundamentalFactorModel.R
   pkg/FactorAnalytics/man/fitFundamentalFactorModel.Rd
   pkg/FactorAnalytics/vignettes/fundamentalFM.Rnw
Log:
edit vignette. 

Modified: pkg/FactorAnalytics/R/fitFundamentalFactorModel.R
===================================================================
--- pkg/FactorAnalytics/R/fitFundamentalFactorModel.R	2013-09-04 21:32:10 UTC (rev 2990)
+++ pkg/FactorAnalytics/R/fitFundamentalFactorModel.R	2013-09-04 23:09:17 UTC (rev 2991)
@@ -17,9 +17,10 @@
 #' and Yindeng Jiang. Guy Yullen re-implemented the function in R and requires
 #' the following additional R libraries: zoo time series library, robust
 #' Insightful robust library ported to R and robustbase Basic robust statistics
-#' package for R
+#' package for R. Yi-An Chen from UW economics deparment re-organize the codes and finalize this 
+#' function.  
 #'  
-#' 
+#'
 #' @param data data.frame, data must have \emph{assetvar}, \emph{returnvar}, \emph{datevar}
 #' , and exposure.names. Generally, data is panel data setup, so it needs firm variabales 
 #' and time variables. Data has to be a balanced panel. 

Modified: pkg/FactorAnalytics/man/fitFundamentalFactorModel.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitFundamentalFactorModel.Rd	2013-09-04 21:32:10 UTC (rev 2990)
+++ pkg/FactorAnalytics/man/fitFundamentalFactorModel.Rd	2013-09-04 23:09:17 UTC (rev 2991)
@@ -100,7 +100,9 @@
   Jiang. Guy Yullen re-implemented the function in R and
   requires the following additional R libraries: zoo time
   series library, robust Insightful robust library ported
-  to R and robustbase Basic robust statistics package for R
+  to R and robustbase Basic robust statistics package for
+  R. Yi-An Chen from UW economics deparment re-organize the
+  codes and finalize this function.
 }
 \examples{
 # BARRA type factor model

Modified: pkg/FactorAnalytics/vignettes/fundamentalFM.Rnw
===================================================================
--- pkg/FactorAnalytics/vignettes/fundamentalFM.Rnw	2013-09-04 21:32:10 UTC (rev 2990)
+++ pkg/FactorAnalytics/vignettes/fundamentalFM.Rnw	2013-09-04 23:09:17 UTC (rev 2991)
@@ -8,21 +8,26 @@
 \begin{document}
 \SweaveOpts{concordance=TRUE}
 
-\title{factorAnalytics: Factor Model Fitting}
+\title{factorAnalytics: A Concise User Guide}
 \author{Yi-An Chen}
 \maketitle
 
 \section{Introduction}
-This vignette aims to help users to learn how to use fundamental factor model in \verb at factorAnalytics@ package. We will walk through users a few examples from scratch. 
+This vignette aims to help users to learn how to use fit factor model with \verb at factorAnalytics@ package. We will walk through users a few examples from data input to risk analysis and performance attribution. 
 
-\subsection{Fundamental Factor Model}
+\section{Factor Model}
 A factor model is defined as \\
 \begin{equation} 
  r_t = bf_t + \epsilon_t\;,t=1 \cdots T \label{fm} 
 \end{equation}
-Where $r_t$ is N x 1, b is N x K and f is K x 1. N is number of variables and K is number of factors. b is usually called factor exposures or factor loadings and f is factor returns. $\epsilon_t$ is serial uncorrelated but may be cross-correlated. The model is useful to fit for examples asset returns. The famous CAPM (Capital Assets Pricing Model) is a one factor model with f equal to market returns.
+Where $r_t$ is N x 1 exress returns, b is N x K and f is K x 1. N is number of variables and K is number of factors. b is usually called factor exposures or factor loadings, and b can be time-varying $b_t$ in fundamental factor model setting. f is factor returns. $\epsilon_t$ is serial uncorrelated but may be cross-correlated. The model is useful to fit asset pricing model. The famous CAPM (Capital Assets Pricing Model) is a one factor model with f equal to market returns.
 
-In the case of fundamental factor model, we assume we know b, factor exposures which are assets characteristics, like market capitalization or book-to-market ratio. f is unknown and we can use OLS or WLS regression skills to estimate for each period. In specific,
+\verb at factorAnalytics@ package provides 3 different kinds of factor models. That is fundamental factor model, statistical factor model and time series factor model. We will walk through them one by one.
+
+
+\subsection{Fundamental Factor Model}
+
+In the case of fundamental factor model, we assume we know factor exposures b which are assets characteristics, like market capitalization or book-to-market ratio. Therefore, $b_t$ is known and $f_t$ is unknown. We run cross-section OLS or WLS regression to estimate $f_t$ for each time period. In specific,
 \begin{equation}\label{ffm}
 r_t = f_M + b\hat{f_t} + \hat{\epsilon_t}\;,t=1 \cdots T 
 \end{equation}
@@ -30,17 +35,17 @@
 
 This approach is also called BARRA type approach since it is initially developed by BARRA and later on been merged by MSCI. The famous Barra global equity model (GEM3) contains more than 50 factors. 
 
-\section{Example 1}
-We will walk through the first examples in this section. We will use style factors like size.
-\subsection{Loading Data}
+\subsection{Example 1}
+We will walk through the first examples in this section where use style factors like size are used.
+\subsubsection{Loading Data}
 Let's look at the arguments of \verb at fitFundamentalFactorModel()@ which will deal with fundamental factor model in \verb at factorAnalytics@.
 <<args>>=
 library(factorAnalytics)
 args(fitFundamentalFactorModel)
 @
-\verb at data@ is in class of \verb at data.frame@ and is required to have \emph{assetvar},\emph{returnvar} and \emph{datevar}. One can image data is like panel data setup and need firm variable and time variable. So data has dimension (N x T) and at least 3 consumes to specify information needed.    
+\verb at data@ is in class of \verb at data.frame@ and is required to have \emph{assetvar},\emph{returnvar} and \emph{datevar}. One can image \emph{data} is like panel data setup and need firm variable and time variable. Data has dimension (N x T) and at least 3 consumes to specify information needed.    
 
-We download data from CRSP/Compustat quarterly fundamental and name \verb at equity@ which contains 67 stocks from January 2000 to December 2013.  
+We download data from CRSP/Compustat quarterly fundamental and name it \verb at equity@. It contains 67 stocks and 106 time period from January 2000 to December 2013.  
 
 <<loading.data>>=
 #equity <- data(equity)
@@ -49,50 +54,51 @@
 length(unique(equity$datadate)) # number of period t 
 length(unique(equity$tic)) # number of assets
 @
-We want asset returns.
+We need asset returns to run our model. We can utilize \verb at Delt()@ to calculate price percentage change which is exactly asset returns in \verb at quantmod@ package. 
 <<get.returns>>=
 library(quantmod)   # for Delt. See Delt for detail
 equity <- cbind(equity,do.call(rbind,lapply(split(equity,equity$tic), 
                                             function(x) Delt(x$PRCCQ)))) 
 names(equity)[22] <- "RET"
 @
-We want market value and book-to-market ratio too. market vale can be achieved by common stocks outstanding x price and book value we use common/ordinary equity value. We also take log on market value. 
+We want market value and book-to-market ratio to be our style factors. Market vale can be achieved by common stocks outstanding multiply price and book value is common/ordinary equity value. We take log for market value. 
 <<get.mv.bm>>==
 equity$MV <- log(equity$PRCCQ*equity$CSHOQ) 
 equity$BM <- equity$CEQQ/equity$MV
 @
-now we use model \ref{ffm} where K=2, b = [ MV , BM ].
+now we will fit Equation \ref{ffm} with b = [MV BM].
 
-We will get an error message if \verb at datevar@ is not \verb at as.Date@ format compatible. In our example, our date variable is \emph{DATACQTR} and looks like "2000Q1". We have to convert it to \verb at as.Date@ compatible. We can utilize \verb at as.yearqtr@ to do it. Also, we will use character string for asset variable instead of factor.
+We will get an error message if \verb at datevar@ is not \verb at as.Date@ format compatible. In our example, our date variable is \emph{DATACQTR} and looks like "2000Q1". We have to convert it to \verb at as.Date@ compatible. We can utilize \verb at as.yearqtr@ in \verb at xts@ package to do it. Also, we will use character string for asset variable instead of factor.\footnote{The best data input is to convert all your data into xts class since we use xts to compute everything in this package, although it is not restricted to it.}
 <<as.yearqtr>>=
 a <- unlist( lapply(strsplit(as.character(equity$DATACQTR),"Q"),
                function(x)  paste(x[[1]],"-",x[[2]],sep="") ) )
 equity$yearqtr <- as.yearqtr(a,format="%Y-%q")
 equity$tic <- as.character(equity$tic)
-equity <- subset(equity,yearqtr != "2000 Q1")
-# delete the first element of each assets
+equity <- subset(equity,yearqtr != "2000 Q1") # delete the first element of each assets
 @
 
-\subsection{Fit the Model}
+\subsubsection{Fit the Model}
 fit the function:
 <<fit.ffm>>=
 fit.fund <- fitFundamentalFactorModel(exposure.names=c("BM","MV"),datevar="yearqtr",
-                                      returnsvar ="RET",assetvar="tic",wls=TRUE,data=equity)
+                                      returnsvar ="RET",assetvar="tic",wls=TRUE,
+                                      data=equity)
 names(fit.fund)
 @
 
-A few notice for fitting fundamental factor model. So far this function can only deal with balanced panel because we want to extract return covariance and residuals and so on. Second, \verb at datevar@ has to be \verb at as.Date@ compatible, otherwise the function can not read the time index. It is somehow inconvenient but make sure we will not mess up with time index. 
+A few notice for fitting fundamental factor model. So far this function can only deal with balanced panel because we want to extract return covariance and residuals and so on. Second, \verb at datevar@ has to be \verb at as.Date@ compatible, otherwise the function can not read time index. It is somehow inconvenient but make sure we will not mess up with any time issue. 
 
 Default fit method for \verb at fitFundamentalFactorModel()@ is classic OLS and covariance matrix is also classic covariance matrix defined by \verb at covClassic()@ in \verb at robust@ package. One can change to robust estimation and robust covariance matrix estimation. 
 
 
 \verb at returns.cov@ contains information about returns covariance. return covariance is 
-\[ \Sigma_x = B \Sigma_f B' +  D \]. If \verb at full.resid.cov@ is \emph{FALSE}, D is diagonal matrix with variance of residuals in diagonal terms. If \emph{TRUE}, D is covariance matrix of residuals. 
+\[ \Sigma_x = B \Sigma_f B' +  D \]
+If \verb at full.resid.cov@ is \emph{FALSE}, D is diagonal matrix with variance of residuals in diagonal terms. If \emph{TRUE}, D is covariance matrix of residuals. 
 
 <<fit.fund>>=
 names(fit.fund$returns.cov)
 @
-Once can check out \verb at fit.fund$factor.cov@, \verb at fit.fund$resids.cov@ and \verb at fit.fund$resid.variance@ for detail. 
+Please check out \verb at fit.fund$factor.cov@, \verb at fit.fund$resids.cov@ and \verb at fit.fund$resid.variance@ yourself for detail. 
 
 
 factor returns, residuals,t-stats are xts class. 
@@ -102,7 +108,7 @@
 fit.fund$tstats
 @
 
-There are a few generic function \verb at predict@, \verb at summary@, \verb at print@ and \verb at plot@ one can utilize. 
+Output of \verb at fitFundamentalFactorModel()@ is of class \emph{FundamentalFactorModel}. There are generic function \verb at predict@, \verb at summary@, \verb at print@ and \verb at plot@ can be applied. 
 <<generic.fun,results=hide>>=
 summary(fit.fund)
 predict(fit.fund)
@@ -130,7 +136,7 @@
 Enter an item from the menu, or 0 to exit
 \end{verbatim}
 
-For example, choose 1 will give factor returns and it looks like 
+For example, choose 1 will give factor returns and it looks like in Figure \ref{fig1}
 <<label=plot.fit.fund,fig=TRUE,echo=FALSE,include=FALSE,results=hide>>=
 plot(fit.fund,which.plot=1,max.show=3)
 @
@@ -145,24 +151,24 @@
 \label{fig1}
 \end{figure}
 
-\section{Example 2: Barra type industry/country model}
-In a global equity model or specific country equity model, modelers usually want to use industry/country dummies. In our example, we have 63 stocks in different industry. In specific, 
+\subsection{Example 2: Barra type industry/country model}
+In a global equity model or specific country equity model, modelers can use industry/country dummies. In our example, we have 63 stocks in different industry. In specific, 
 \begin{equation}
-x_{it} = a_{i,t} + \Sigma_{j=1}^{J}b_{i,j}f_{i,t} + \epsilon_{i,t},\;for\,each\,i\,,t
+x_{it} = \Sigma_{j=1}^{J}b_{i,j}f_{i,t} + \epsilon_{i,t},\;for\,each\,i\,,t
 \end{equation}
 where $b_{i,j} = 1$ if stock i in industry j and $b_{i,j}=0$ otherwise. 
 In matrix form:\[ x_t = Bf_t + \epsilon_t \] and B is the N X J matrix of industry dummies.  
 
-\emph{SPCINDCD} in our data are $S\&P$ industry code, what we only have to do to fit industry model is to add this variable name into \verb at exposure.names@. Be sure this variable is \emph{character} not \emph{numeric}. Otherwise the function will not create dummies.
+\emph{SPCINDCD} in our \verb at equity@ contains $S\&P$ industry codes, we add this variable name into \verb at exposure.names@ and we can fit Barra type industry model. Be sure this variable is of class\emph{character} not \emph{numeric}. Otherwise the function will not create dummies.
 
 <<ind.model>>=
 equity$SPCINDCD <- as.character(equity$SPCINDCD)
 fit.ind <- fitFundamentalFactorModel(exposure.names=c("SPCINDCD"),datevar="yearqtr",
-                                      returnsvar ="RET",assetvar="tic",wls=FALSE,data=equity)
+                                      returnsvar ="RET",assetvar="tic",wls=FALSE,
+                                     data=equity)
 @
-One can also use generic function to do plot, summary...
 
-\verb at fitFundamentalFactorModel()@ support industry/country dummy factor exposures and style factor exposures together. Try 
+\verb at fitFundamentalFactorModel()@ supports mixed model like fit industry/country dummy factor exposures and style factor exposures together. For example,
 <<mixted,results=hide>>=
 fit.mix <- fitFundamentalFactorModel(exposure.names=c("BM","MV","SPCINDCD"),
                                      datevar="yearqtr",returnsvar ="RET",
@@ -170,15 +176,15 @@
 @
 
 
-\section{Standardizing Factor Exposure}
+\subsubsection{Standardizing Factor Exposure}
 It is common to standardize factor exposure to have weight mean 0 and standard deviation equal to 1. The weight are often taken as proportional to square root of market capitalization, although other weighting schemes are possible. 
 
 We will try example 1 but with standardized factor exposure with square root of market capitalization. First we create a weighting variable.
 
 <<standardized.fund>>=
-equity$weight <- sqrt(exp(equity$MV)) # we take log for MV before.
+equity$weight <- sqrt(exp(equity$MV)) # we took log for MV before.
 @
-We can choose \verb at standardized.factor.exposure@ to be \verb at TRUE@ and \verb at weight.var@ equal to weighting variable. 
+We can choose \verb at standardized.factor.exposure@ to be \verb at TRUE@ and \verb at weight.var@ equals to weighting variable. 
 <<s.fit>>=
 fit.fund2 <- fitFundamentalFactorModel(exposure.names=c("BM","MV"),
                                      datevar="yearqtr",returnsvar ="RET",
@@ -187,21 +193,21 @@
                                        weight.var = "weight"  )
 @
 
-\section{Statistical Factor Model}
+The advantage of weight facotr exposures is better interpretation of factor returns. $f_t$ can be interpreted as long-short zero investment portfolio. In our case, $f_{MVt}$ will long big size stocks and short small size stocks. 
 
-In statistical factor model, neither factor exposure b (normally called factor loadings in statistical factor model) nor factor returns $f_t$ are observed in equation \ref{fm2}:
+\subsection{Statistical Factor Model}
+
+In statistical factor model, neither factor exposure b (normally called factor loadings in statistical factor model) nor factor returns $f_t$ are observed in equation \ref{fm}. So we can rewrite the model as:
 \begin{equation} 
  r_t = bf_t + \epsilon_t\;,t=1 \cdots T \label{fm2} 
 \end{equation}
 Factor returns $f_t$ can be calculated as principle components of covariance matrix of assets returns if number of asset N is less than the number of time period T, and factor loadings can be calculated using conventional least square technique. 
 
-
-
 By default, the first principle component or factor will explain the most variation of returns covariance matrix and so on. 
 
 In some cases, when number of assets N is larger than number of time period T. Connor and Korajczyk (1986) develop an alternative method called asymptotic principal components, building on the approximate factor model theory of Chamberlain and Rothschild (1983). Connor and Korajczyk analyze the eigenvector of the T X T cross product of  matrix returns rather then N X N covariance matrix of returns. They show the first k eigenvectors of this cross product matrix provide consistent estimates of the k X T matrix of factor returns. 
 
-We can use function \verb at fitStatisticalFactorModel@ to fit statistical factor model. First, we need asset returns in time series or xts format. We choose xts to work with because time index is easy to handle but this is not restricted to the model fit. 
+We can use function \verb at fitStatisticalFactorModel@ to fit statistical factor model. First, we need asset returns in time series or xts class. We choose xts to work with because time index is easy to handle but this is not restricted to the function. 
 
 <<create.xts>>=
 library(xts)
@@ -216,7 +222,7 @@
 ret <- ret[,-1]
 dim(ret)
 @
-We then fit the model. The data \verb at ret@ has 63 assets and 52 time period. So we will exploit asymptotic principal components analysis to find factor returns. There are two ways to find numbers of factors, Connor and Korajczyk(1995) and Bai and Ng (2002) are provided in the function. We will use Bai and Ng (2002) to choose the numbers of factors.    
+The data \verb at ret@ contians 63 assets and 52 time periods. We will exploit asymptotic principal components analysis to fit statistical model. There are two ways to find numbers of factors, Connor and Korajczyk(1995) and Bai and Ng (2002). Both are provided in our function. We will use Bai and Ng (2002) to choose the numbers of factors.    
 
 <<stat.fm>>=
 fit.stat <- fitStatisticalFactorModel(data=ret,
@@ -224,7 +230,7 @@
 names(fit.stat)
 @
 
-5 factors is chosen by Bai and Ng (2002). Factor returns can be found using \verb@$factors at .    
+5 factors is chosen by Bai and Ng (2002). Factor returns can be found \verb at fit.stat$factors at .    
 <<stat.factor.returns>>=
 fit.stat$k
 @
@@ -260,8 +266,8 @@
 
 Similar to \verb at fitFundamentalFactorModel@, generic functions like \verb at summary@, \verb at print@, \verb at plot@ and \verb at predict@ can be used for statistical factor model. 
 
-\section{Time Series Factor Model}
-In Time Series factor model, factor returns $f_t$ is observed and taken as macroeconomic time series like GDP or other time series like market returns or credit spread. In our package, we have provided some common used times series in data set \verb at CommonFactors@. \verb at factors@ is monthly time series and \verb at factors.Q@ is quarterly time series.
+\subsection{Time Series Factor Model}
+In Time Series factor model, factor returns $f_t$ is observed and taken as macroeconomic time series like GDP or other time series like market returns or credit spread. In our package, we provid some common used times series in data set \verb at CommonFactors@. \verb at factors@ is monthly time series and \verb at factors.Q@ is quarterly time series.
 
 <<common.factors>>=
 data(CommonFactors)
@@ -275,10 +281,12 @@
 ts.data <- na.omit(merge(ret,ts.factors))
 @
 
-We will use SP500, 10 years and 3 months term spread and difference of VIX as our factors. 
+We will use SP500, 10 years and 3 months term spread and difference of VIX as our common factors. 
 
 <<fit.ts>>=
-fit.time <- fitTimeSeriesFactorModel(assets.names=tic,factors.names=c("SP500","Term.Spread","dVIX"),data=ts.data,fit.method="OLS")
+fit.time <- fitTimeSeriesFactorModel(assets.names=tic,
+                                     factors.names=c("SP500","Term.Spread","dVIX"),
+                                     data=ts.data,fit.method="OLS")
 @
 
 \verb at asset.fit@ can show model fit for each assets, for example for asset \verb at AA@. 
@@ -287,10 +295,13 @@
 @
 
 
-\verb at fitTimeSeriesFactorModel@ also have various variable selection algorithm to choose. One can include all the factor and let the function to decide which one is the best model. For example, we include all common factors and use method \verb at stepwise@ which utilizes \verb at step@ function in \verb at stat@ package 
+\verb at fitTimeSeriesFactorModel@ also have various variable selection algorithm to choose. One can include every factor and let the function to decide which one is the best model. For example, we include every common factors and use method \verb at stepwise@ which utilizes \verb at step@ function in \verb at stat@ package 
 
 <<fit.ts>>=
-fit.time2 <- fitTimeSeriesFactorModel(assets.names=tic,factors.names=names(ts.factors),data=ts.data,fit.method="OLS",variable.selection = "stepwise")
+fit.time2 <- fitTimeSeriesFactorModel(assets.names=tic,
+                                      factors.names=names(ts.factors),
+                                      data=ts.data,fit.method="OLS",
+                                      variable.selection = "stepwise")
 @
 There are 5 factors chosen for asset AA for example. 
 <<AA.fit>>=
@@ -302,7 +313,7 @@
 \section{Risk Analysis}
 
 \subsection{Factor Model Risk Budgeting}
-One can do risk analysis easily with factor model. According to Meucci (2007), factor model can be represented as 
+One can do risk analysis with factor model. According to Meucci (2007), factor model can be represented as 
 
 \begin{align}
 r_{it} &= \alpha_i + \beta_{i1}f_{1t} + \beta_{i2}f_{2t} + \cdots + \beta_{ik}f_{kt} + \sigma{i}z_{it},\;i=1 \cdots N,\;t=1 \cdots T \\
@@ -321,11 +332,12 @@
 $\beta_{ki}\frac{\partial RM_i}{\partial \beta_{ki}}$ is called component contribution of factor k to $RM_i$ \\
 $\beta_{ki}\frac{\partial RM_i}{\partial \beta_{ki}}/RM_i$ is called percentage contribution of factor k to $RM_i$
 
-\verb at factorAnalytics@ package provide 3 different risk metrics decomposition, Standard deviation (Std), Value-at-Risk (VaR) and Expected Shortfall (ES) with historical distribution, Normal distribution and Cornish-Fisher distribution. 
+\verb at factorAnalytics@ package provide 3 different risk metrics decomposition, Standard deviation (Std), Value-at-Risk (VaR) and Expected Shortfall (ES). Each one with different distribution such as historical distribution, Normal distribution and Cornish-Fisher distribution. 
 
-For example, factor model VaR decomposition with Normal distribution of asset AA for a statistical factor model.
+This example shows factor model VaR decomposition with Normal distribution of asset AA for a statistical factor model.
 <<risk.decomp>>=
-data.rd <- cbind(ret[,"AA"],fit.stat$factors,fit.stat$residuals[,"AA"]/sqrt(fit.stat$resid.variance["AA"]))
+data.rd <- cbind(ret[,"AA"],fit.stat$factors,
+                 fit.stat$residuals[,"AA"]/sqrt(fit.stat$resid.variance["AA"]))
 var.decp <- factorModelVaRDecomposition(data.rd,fit.stat$loadings[,"AA"],
                             fit.stat$resid.variance["AA"],tail.prob=0.05,
                              VaR.method="gaussian")
@@ -339,7 +351,7 @@
 @
 It looks like the second factor contributes the largest risk to asset AA. 
 
-One can use \verb at plot@ method to see barplot of risk budgeting. Default is to show 6 assets. Figure \ref{fig4} shows componenet contribution to VaR for several different assets. 
+One can use \verb at plot()@ method to see barplot of risk budgeting. Default is to show 6 assets. Figure \ref{fig4} shows componenet contribution to VaR for several different assets. 
 
 <<label=plot.rb.stat,fig=TRUE,echo=FALSE,include=FALSE,results=hide>>=
 plot(fit.stat,which.plot=8,legend.text=TRUE, args.legend=list(x="topright"),
@@ -384,12 +396,17 @@
 \end{equation}
 can break down asset returns into two pieces. The first term is \emph{returns atttributed to factors} $Bf_t$ and the second term is called \emph{specific returns} which is simply $\alpha + e_t$. 
 
-For example, let's breakdown time series factor model we usded previously. Function \verb at factorModelPerformanceAttribution()@ can help us to calculate performance attribution. 
+For example, we can breakdown time series factor model.\\ 
+Function \verb at factorModelPerformanceAttribution()@ can help us to calculate performance attribution. 
 <<ts.attr>>=
 ts.attr <- factorModelPerformanceAttribution(fit.time)
 names(ts.attr)
 @
 There are 3 items generated by the function. \verb at cum.ret.attr.f@ will return a N x K matrix with cummulative returns attributed to factors. \verb at cum.spec.ret@ will return a N x 1 matrix with cummulative specific returns. \verb at attr.list@ will return a list which contains returns atttribution to each factors and specific returns asset by asset. In addition, a \emph{FM.attribution} class will be generated and generic function \verb at print()@, \verb at summary()@ and \verb at plot()@ can be applied to it.  
 
+\subsection{Benchmark and Active Returns}
 
+Portfolio performance is usually compared to similar type of benchmark. US equity portfolio will compare its performance with S$\&$P 500 index for example. Therefore, \emph{active returns} under active management is interested. We define active returns = assets returns - benchmark. 
+
+We can also calculate active return attribution just simply fit active return with fundamental factor model, statistical factor model or time series factor model and calculate by \verb at factorModelPerformanceAttribution()@. 
 \end{document}
\ No newline at end of file



More information about the Returnanalytics-commits mailing list