[Returnanalytics-commits] r3609 - in pkg/FactorAnalytics: R man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 6 19:46:18 CET 2015


Author: chenyian
Date: 2015-03-06 19:46:18 +0100 (Fri, 06 Mar 2015)
New Revision: 3609

Modified:
   pkg/FactorAnalytics/R/fitTsfm.R
   pkg/FactorAnalytics/R/fitTsfmLagBeta.r
   pkg/FactorAnalytics/R/fitTsfmMT.r
   pkg/FactorAnalytics/R/fitTsfmUpDn.r
   pkg/FactorAnalytics/R/plot.tsfmUpDn.r
   pkg/FactorAnalytics/man/fitTsfm.Rd
   pkg/FactorAnalytics/man/fitTsfmLagBeta.Rd
   pkg/FactorAnalytics/man/fitTsfmMT.Rd
   pkg/FactorAnalytics/man/fitTsfmUpDn.Rd
   pkg/FactorAnalytics/man/plot.tsfmUpDn.Rd
   pkg/FactorAnalytics/tests/factorAnalytics.pdf
Log:
1. Edit fitTsfmLagBeta.Rd, fitTsfmMT.Rd, fitTsfmUpDn.Rd.
2. Update user manual. 

Modified: pkg/FactorAnalytics/R/fitTsfm.R
===================================================================
--- pkg/FactorAnalytics/R/fitTsfm.R	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/R/fitTsfm.R	2015-03-06 18:46:18 UTC (rev 3609)
@@ -36,17 +36,9 @@
 #' \code{fit.method} will be ignored.
 #' 
 #' Arguments \code{mkt.name} and \code{mkt.timing} allow for market-timing 
-#' factors to be added to any of the above methods. Market timing accounts for 
-#' the price movement of the general stock market relative to fixed income 
-#' securities. Specifying \code{mkt.timing="HM"}, includes 
-#' $down.market = max(0, R_f-R_m)$ as a factor, following Henriksson & Merton 
-#' (1981). The coefficient of this down-market factor can be interpreted as the 
-#' number of "free" put options on the market provided by the manager's 
-#' market-timings kills. Similarly, to account for market timing with respect 
-#' to volatility, one can specify \code{mkt.timing="TM"}. Following 
-#' Treynor & Mazuy (1966), $market.sqd = (R_m-R_f)^2$ is added as a factor. 
-#' For example, as a test for market timing, either of these factors can be 
-#' added to the single index regression model.
+#' factors to be added to any of the above methods. A wrapper function 
+#' \code{\link{fitTsfmMT}} is built based on this functionality. Please refer to 
+#' \code{fitTsfmMT} for detail.  
 #' 
 #' \subsection{Data Processing}{
 #' 

Modified: pkg/FactorAnalytics/R/fitTsfmLagBeta.r
===================================================================
--- pkg/FactorAnalytics/R/fitTsfmLagBeta.r	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/R/fitTsfmLagBeta.r	2015-03-06 18:46:18 UTC (rev 3609)
@@ -3,58 +3,18 @@
 #' @description This is a wrapper function to fits a time series lagged Betas factor model for one 
 #' or more asset returns or excess returns using time series regression. 
 #' Users can choose between ordinary least squares-OLS, discounted least 
-#' squares-DLS (or) robust regression. Several variable selection options  
+#' squares-DLS (or) robust regression like \code{fitTsfm}. Several variable selection options  
 #' including Stepwise, Subsets, Lars are available as well. An object of class 
 #' \code{"tsfm"} is returned.
 #' 
 #' @details 
-#' Typically, factor models are fit using excess returns. \code{rf.name} gives 
-#' the option to supply a risk free rate variable to subtract from each asset 
-#' return and factor to compute excess returns. 
+#' The lagged returns model estimates lagged market Beta. Specifically, 
+#' \deqn{r_t = \alpha + \beta_0 MKT_t + \beta_1 MKT_t-1 + \ldots + \beta_K MKT_t-K + \epsilon_t, t=1 \ldots T}
+#' where \eqn{r_t} is the asset returns, and MKT is the market factor. It is usually 
+#' needed for illiquid securities with stale prices. One can also report the sum of 
+#' the lagged Betas: 
+#' \deqn{\beta = \beta_0 + \beta_1 + \ldots + \beta_K }  
 #' 
-#' Estimation method "OLS" corresponds to ordinary least squares using 
-#' \code{\link[stats]{lm}}, "DLS" is discounted least squares (weighted least 
-#' squares with exponentially declining weights that sum to unity), and, 
-#' "Robust" is robust regression (using \code{\link[robust]{lmRob}}). 
-#' 
-#' If \code{variable.selection="none"}, uses all the factors and performs no 
-#' variable selection. Whereas, "stepwise" performs traditional stepwise 
-#' LS or Robust regression (using \code{\link[stats]{step}} or 
-#' \code{\link[robust]{step.lmRob}}), that starts from the initial set of 
-#' factors and adds/subtracts factors only if the regression fit, as measured 
-#' by the Bayesian Information Criterion (BIC) or Akaike Information Criterion 
-#' (AIC), improves. And, "subsets" enables subsets selection using 
-#' \code{\link[leaps]{regsubsets}}; chooses the best performing subset of any 
-#' given size or within a range of subset sizes. Different methods such as 
-#' exhaustive search (default), forward or backward stepwise, or sequential 
-#' replacement can be employed.See \code{\link{fitTsfm.control}} for more 
-#' details on the control arguments.
-#'  
-#' \code{variable.selection="lars"} corresponds to least angle regression 
-#' using \code{\link[lars]{lars}} with variants "lasso" (default), "lar", 
-#' "stepwise" or "forward.stagewise". Note: If \code{variable.selection="lars"}, 
-#' \code{fit.method} will be ignored.
-#' 
-#' Market timing accounts for 
-#' the price movement of the general stock market relative to fixed income 
-#' securities. It includes 
-#' $down.market = max(0, R_f-R_m)$ as a factor, following Henriksson & Merton 
-#' (1981). The coefficient of this down-market factor can be interpreted as the 
-#' number of "free" put options on the market provided by the manager's 
-#' market-timings kills.
-#' 
-#' \subsection{Data Processing}{
-#' 
-#' Note about NAs: Before model fitting, incomplete cases are removed for 
-#' every asset (return data combined with respective factors' return data) 
-#' using \code{\link[stats]{na.omit}}. Otherwise, all observations in 
-#' \code{data} are included.
-#' 
-#' Note about \code{asset.names} and \code{factor.names}: Spaces in column 
-#' names of \code{data} will be converted to periods as \code{fitTsfm} works 
-#' with \code{xts} objects internally and colnames won't be left as they are.
-#' }
-#' 
 #' @param asset.names vector containing names of assets, whose returns or 
 #' excess returns are the dependent variable.
 #' @param factor.names vector containing names of the macroeconomic factors.
@@ -78,14 +38,11 @@
 #' \code{\link{fitTsfm.control}} for details.
 #' @param ... arguments passed to \code{\link{fitTsfm.control}}
 #' 
-#' @return fitTsfm returns an object of class \code{"tsfm"} for which 
-#' \code{print}, \code{plot}, \code{predict} and \code{summary} methods exist. 
+#' @return \code{fitTsfmLagBeta} also returns an object of class \code{"tsfm"} like 
+#' \code{fitTsfm}. The generic function such as \code{print}, \code{plot}, \code{predict} 
+#' and \code{summary} methods exist. Also, the generic accessor functions \code{coef}, 
+#' \code{fitted} \code{residuals} and  \code{fmCov} can be applied as well.
 #' 
-#' The generic accessor functions \code{coef}, \code{fitted} and 
-#' \code{residuals} extract various useful features of the fit object. 
-#' Additionally, \code{fmCov} computes the covariance matrix for asset returns 
-#' based on the fitted factor model
-#' 
 #' An object of class \code{"tsfm"} is a list containing the following 
 #' components:
 #' \item{asset.fit}{list of fitted objects for each asset. Each object is of 
@@ -110,34 +67,13 @@
 #' @author Yi-An Chen.
 #' 
 #' @references 
-#' Christopherson, J. A., Carino, D. R., & Ferson, W. E. (2009). Portfolio 
-#' performance measurement and benchmarking. McGraw Hill Professional.
+#' Scholes, M. and Williams, J. T. (1977). Estimating betas from non-synchronous
+#' data, Journal of Financial Economics, vol. 5, 1977, pp. 309-327
 #' 
-#' Efron, B., Hastie, T., Johnstone, I., & Tibshirani, R. (2004). Least angle 
-#' regression. The Annals of statistics, 32(2), 407-499. 
+#' @seealso 
+#' The original time series function \code{\link{fitTsfm}} and its generic functions
+#'  application.
 #' 
-#' Hastie, T., Tibshirani, R., Friedman, J., Hastie, T., Friedman, J., & 
-#' Tibshirani, R. (2009). The elements of statistical learning (Vol. 2, No. 1). 
-#' New York: Springer.
-#' 
-#' Henriksson, R. D., & Merton, R. C. (1981). On market timing and investment 
-#' performance. II. Statistical procedures for evaluating forecasting skills. 
-#' Journal of business, 513-533.
-#' 
-#' Treynor, J., & Mazuy, K. (1966). Can mutual funds outguess the market. 
-#' Harvard business review, 44(4), 131-136.
-#' 
-#' @seealso The \code{tsfm} methods for generic functions: 
-#' \code{\link{plot.tsfm}}, \code{\link{predict.tsfm}}, 
-#' \code{\link{print.tsfm}} and \code{\link{summary.tsfm}}. 
-#' 
-#' And, the following extractor functions: \code{\link[stats]{coef}}, 
-#' \code{\link[stats]{fitted}}, \code{\link[stats]{residuals}},
-#' \code{\link{fmCov}}, \code{\link{fmSdDecomp}}, \code{\link{fmVaRDecomp}} 
-#' and \code{\link{fmEsDecomp}}.
-#' 
-#' \code{\link{paFm}} for Performance Attribution. 
-#' 
 #' @examples
 #' # load data from the database
 #' data(managers)

Modified: pkg/FactorAnalytics/R/fitTsfmMT.r
===================================================================
--- pkg/FactorAnalytics/R/fitTsfmMT.r	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/R/fitTsfmMT.r	2015-03-06 18:46:18 UTC (rev 3609)
@@ -8,53 +8,13 @@
 #' \code{"tsfm"} is returned.
 #' 
 #' @details 
-#' Typically, factor models are fit using excess returns. \code{rf.name} gives 
-#' the option to supply a risk free rate variable to subtract from each asset 
-#' return and factor to compute excess returns. 
-#' 
-#' Estimation method "OLS" corresponds to ordinary least squares using 
-#' \code{\link[stats]{lm}}, "DLS" is discounted least squares (weighted least 
-#' squares with exponentially declining weights that sum to unity), and, 
-#' "Robust" is robust regression (using \code{\link[robust]{lmRob}}). 
-#' 
-#' If \code{variable.selection="none"}, uses all the factors and performs no 
-#' variable selection. Whereas, "stepwise" performs traditional stepwise 
-#' LS or Robust regression (using \code{\link[stats]{step}} or 
-#' \code{\link[robust]{step.lmRob}}), that starts from the initial set of 
-#' factors and adds/subtracts factors only if the regression fit, as measured 
-#' by the Bayesian Information Criterion (BIC) or Akaike Information Criterion 
-#' (AIC), improves. And, "subsets" enables subsets selection using 
-#' \code{\link[leaps]{regsubsets}}; chooses the best performing subset of any 
-#' given size or within a range of subset sizes. Different methods such as 
-#' exhaustive search (default), forward or backward stepwise, or sequential 
-#' replacement can be employed.See \code{\link{fitTsfm.control}} for more 
-#' details on the control arguments.
-#'  
-#' \code{variable.selection="lars"} corresponds to least angle regression 
-#' using \code{\link[lars]{lars}} with variants "lasso" (default), "lar", 
-#' "stepwise" or "forward.stagewise". Note: If \code{variable.selection="lars"}, 
-#' \code{fit.method} will be ignored.
-#' 
-#' Market timing accounts for 
-#' the price movement of the general stock market relative to fixed income 
-#' securities. It includes 
-#' $down.market = max(0, R_f-R_m)$ as a factor, following Henriksson & Merton 
+#' The Market timing accounts for the price movement of the general stock market relative to fixed income 
+#' securities. It includes down.market = max(0, R_f-R_m) as a factor, following Henriksson & Merton 
 #' (1981). The coefficient of this down-market factor can be interpreted as the 
-#' number of "free" put options on the market provided by the manager's 
-#' market-timings kills.
+#' number of "free" put options on the market provided by the manager's market-timings kills.
 #' 
-#' \subsection{Data Processing}{
 #' 
-#' Note about NAs: Before model fitting, incomplete cases are removed for 
-#' every asset (return data combined with respective factors' return data) 
-#' using \code{\link[stats]{na.omit}}. Otherwise, all observations in 
-#' \code{data} are included.
 #' 
-#' Note about \code{asset.names} and \code{factor.names}: Spaces in column 
-#' names of \code{data} will be converted to periods as \code{fitTsfm} works 
-#' with \code{xts} objects internally and colnames won't be left as they are.
-#' }
-#' 
 #' @param asset.names vector containing names of assets, whose returns or 
 #' excess returns are the dependent variable.
 #' @param factor.names vector containing names of the macroeconomic factors.
@@ -76,14 +36,11 @@
 #' \code{\link{fitTsfm.control}} for details.
 #' @param ... arguments passed to \code{\link{fitTsfm.control}}
 #' 
-#' @return fitTsfm returns an object of class \code{"tsfm"} for which 
-#' \code{print}, \code{plot}, \code{predict} and \code{summary} methods exist. 
+#' @return \code{fitTsfmMT} also returns an object of class \code{"tsfm"} like 
+#' \code{fitTsfm}. The generic function such as \code{print}, \code{plot}, \code{predict} 
+#' and \code{summary} methods exist. Also, the generic accessor functions \code{coef}, 
+#' \code{fitted} \code{residuals} and  \code{fmCov} can be applied as well.
 #' 
-#' The generic accessor functions \code{coef}, \code{fitted} and 
-#' \code{residuals} extract various useful features of the fit object. 
-#' Additionally, \code{fmCov} computes the covariance matrix for asset returns 
-#' based on the fitted factor model
-#' 
 #' An object of class \code{"tsfm"} is a list containing the following 
 #' components:
 #' \item{asset.fit}{list of fitted objects for each asset. Each object is of 
@@ -108,34 +65,17 @@
 #' @author Yi-An Chen.
 #' 
 #' @references 
-#' Christopherson, J. A., Carino, D. R., & Ferson, W. E. (2009). Portfolio 
-#' performance measurement and benchmarking. McGraw Hill Professional.
-#' 
-#' Efron, B., Hastie, T., Johnstone, I., & Tibshirani, R. (2004). Least angle 
-#' regression. The Annals of statistics, 32(2), 407-499. 
-#' 
-#' Hastie, T., Tibshirani, R., Friedman, J., Hastie, T., Friedman, J., & 
-#' Tibshirani, R. (2009). The elements of statistical learning (Vol. 2, No. 1). 
-#' New York: Springer.
-#' 
 #' Henriksson, R. D., & Merton, R. C. (1981). On market timing and investment 
 #' performance. II. Statistical procedures for evaluating forecasting skills. 
 #' Journal of business, 513-533.
 #' 
-#' Treynor, J., & Mazuy, K. (1966). Can mutual funds outguess the market. 
-#' Harvard business review, 44(4), 131-136.
+#' #' Christopherson, J. A., Carino, D. R., & Ferson, W. E. (2009). Portfolio 
+#' performance measurement and benchmarking. McGraw Hill Professional. pp.127-133
 #' 
-#' @seealso The \code{tsfm} methods for generic functions: 
-#' \code{\link{plot.tsfm}}, \code{\link{predict.tsfm}}, 
-#' \code{\link{print.tsfm}} and \code{\link{summary.tsfm}}. 
+#' @seealso 
+#' The original time series function \code{\link{fitTsfm}} and its generic functions
+#'  application.
 #' 
-#' And, the following extractor functions: \code{\link[stats]{coef}}, 
-#' \code{\link[stats]{fitted}}, \code{\link[stats]{residuals}},
-#' \code{\link{fmCov}}, \code{\link{fmSdDecomp}}, \code{\link{fmVaRDecomp}} 
-#' and \code{\link{fmEsDecomp}}.
-#' 
-#' \code{\link{paFm}} for Performance Attribution. 
-#' 
 #' @examples
 #' # load data from the database
 #' data(managers)

Modified: pkg/FactorAnalytics/R/fitTsfmUpDn.r
===================================================================
--- pkg/FactorAnalytics/R/fitTsfmUpDn.r	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/R/fitTsfmUpDn.r	2015-03-06 18:46:18 UTC (rev 3609)
@@ -1,6 +1,6 @@
 #' @title Fit a up and down market factor model using time series regression
 #' 
-#' @description This is a wrapper function to fits a up/down market model for one 
+#' @description This is a wrapper function to fits a up and down market model for one 
 #' or more asset returns or excess returns using time series regression. 
 #' Users can choose between ordinary least squares-OLS, discounted least 
 #' squares-DLS (or) robust regression. Several variable selection options  
@@ -8,46 +8,11 @@
 #' \code{"tsfm"} is returned.
 #' 
 #' @details 
-#' Typically, factor models are fit using excess returns. \code{rf.name} gives 
-#' the option to supply a risk free rate variable to subtract from each asset 
-#' return and factor to compute excess returns. 
+#' \code{fitTsfmUpDn} will use \code{fitTsfm} to fit a time series model for up and down market respectively. If 
+#' risk free rate is provided, the up market is the excess market returns which is no less than 0.
+#' The goal of up and down marke is to capture different market Betas in the up and down markets. 
 #' 
-#' Estimation method "OLS" corresponds to ordinary least squares using 
-#' \code{\link[stats]{lm}}, "DLS" is discounted least squares (weighted least 
-#' squares with exponentially declining weights that sum to unity), and, 
-#' "Robust" is robust regression (using \code{\link[robust]{lmRob}}). 
 #' 
-#' If \code{variable.selection="none"}, uses all the factors and performs no 
-#' variable selection. Whereas, "stepwise" performs traditional stepwise 
-#' LS or Robust regression (using \code{\link[stats]{step}} or 
-#' \code{\link[robust]{step.lmRob}}), that starts from the initial set of 
-#' factors and adds/subtracts factors only if the regression fit, as measured 
-#' by the Bayesian Information Criterion (BIC) or Akaike Information Criterion 
-#' (AIC), improves. And, "subsets" enables subsets selection using 
-#' \code{\link[leaps]{regsubsets}}; chooses the best performing subset of any 
-#' given size or within a range of subset sizes. Different methods such as 
-#' exhaustive search (default), forward or backward stepwise, or sequential 
-#' replacement can be employed.See \code{\link{fitTsfm.control}} for more 
-#' details on the control arguments.
-#'  
-#' \code{variable.selection="lars"} corresponds to least angle regression 
-#' using \code{\link[lars]{lars}} with variants "lasso" (default), "lar", 
-#' "stepwise" or "forward.stagewise". Note: If \code{variable.selection="lars"}, 
-#' \code{fit.method} will be ignored.
-#' 
-#' 
-#' \subsection{Data Processing}{
-#' 
-#' Note about NAs: Before model fitting, incomplete cases are removed for 
-#' every asset (return data combined with respective factors' return data) 
-#' using \code{\link[stats]{na.omit}}. Otherwise, all observations in 
-#' \code{data} are included.
-#' 
-#' Note about \code{asset.names} and \code{factor.names}: Spaces in column 
-#' names of \code{data} will be converted to periods as \code{fitTsfm} works 
-#' with \code{xts} objects internally and colnames won't be left as they are.
-#' }
-#' 
 #' @param asset.names vector containing names of assets, whose returns or 
 #' excess returns are the dependent variable.
 #' @param factor.names vector containing names of the macroeconomic factors.
@@ -70,20 +35,19 @@
 #' @param ... arguments passed to \code{\link{fitTsfm.control}}
 #' 
 #' @return 
+#' \code{fitTsfmUpDn} returns an object \code{tsfmUpDn}. It supports generic function such as 
+#' \code{summary}, \code{predict}, \code{plot} and \code{print}.
 #' 
-#' fitTsfmUpDn returns a list object containing \code{Up} and \code{Dn}. 
-#' Both \code{Up} and \code{Dn} are class of \code{"tsfm"}. 
-#'  
-#' fitTsfm returns an object of class \code{"tsfm"} for which 
-#' \code{print}, \code{plot}, \code{predict} and \code{summary} methods exist. 
+#' It is also a list object containing \code{Up} and \code{Dn}. Both \code{Up} and \code{Dn} are class of \code{"tsfm"}. As a result, for each list 
+#' object, The generic function such as \code{print}, \code{plot}, \code{predict} 
+#' and \code{summary} methods exist for both \code{Up} and \code{Dn}. Also, the generic accessor functions \code{coef}, 
+#' \code{fitted} \code{residuals} and  \code{fmCov} can be applied as well.
 #' 
-#' The generic accessor functions \code{coef}, \code{fitted} and 
-#' \code{residuals} extract various useful features of the fit object. 
-#' Additionally, \code{fmCov} computes the covariance matrix for asset returns 
-#' based on the fitted factor model
+#' An object of class \code{"tsfmUpDn"} is a list containing \code{Up} and \code{Dn}:
+#' \item{Up}{An object of \code{tsfm} fitted by \code{fitTsfm} for the up market.}
+#' \item{Dn}{An object of \code{tsfm} fitted by \code{fitTsfm} for the down market.}
 #' 
-#' An object of class \code{"tsfm"} is a list containing the following 
-#' components:
+#' Each object of \code{tsfm} contains : 
 #' \item{asset.fit}{list of fitted objects for each asset. Each object is of 
 #' class \code{lm} if \code{fit.method="OLS" or "DLS"}, class \code{lmRob} if 
 #' the \code{fit.method="Robust"}, or class \code{lars} if 
@@ -109,31 +73,14 @@
 #' Christopherson, J. A., Carino, D. R., & Ferson, W. E. (2009). Portfolio 
 #' performance measurement and benchmarking. McGraw Hill Professional.
 #' 
-#' Efron, B., Hastie, T., Johnstone, I., & Tibshirani, R. (2004). Least angle 
-#' regression. The Annals of statistics, 32(2), 407-499. 
+#' @seealso 
+#' The \code{tsfmUpDn} methods for generic functions: 
+#' \code{\link{plot.tsfmUpDn}}, \code{\link{predict.tsfmUpDn}}, 
+#' \code{\link{print.tsfmUpDn}} and \code{\link{summary.tsfmUpDn}}. 
 #' 
-#' Hastie, T., Tibshirani, R., Friedman, J., Hastie, T., Friedman, J., & 
-#' Tibshirani, R. (2009). The elements of statistical learning (Vol. 2, No. 1). 
-#' New York: Springer.
 #' 
-#' Henriksson, R. D., & Merton, R. C. (1981). On market timing and investment 
-#' performance. II. Statistical procedures for evaluating forecasting skills. 
-#' Journal of business, 513-533.
-#' 
-#' Treynor, J., & Mazuy, K. (1966). Can mutual funds outguess the market. 
-#' Harvard business review, 44(4), 131-136.
-#' 
-#' @seealso The \code{tsfm} methods for generic functions: 
-#' \code{\link{plot.tsfm}}, \code{\link{predict.tsfm}}, 
-#' \code{\link{print.tsfm}} and \code{\link{summary.tsfm}}. 
-#' 
-#' And, the following extractor functions: \code{\link[stats]{coef}}, 
-#' \code{\link[stats]{fitted}}, \code{\link[stats]{residuals}},
-#' \code{\link{fmCov}}, \code{\link{fmSdDecomp}}, \code{\link{fmVaRDecomp}} 
-#' and \code{\link{fmEsDecomp}}.
-#' 
-#' \code{\link{paFm}} for Performance Attribution. 
-#' 
+#' The original time series function \code{\link{fitTsfm}} and its generic functions
+#'  application.
 #' @examples
 #' # load data from the database
 #' data(managers)
@@ -141,9 +88,12 @@
 #' # example: Up and down market factor model with OLS fit
 #' fitUpDn <- fitTsfmUpDn(asset.names=colnames(managers[,(1:6)]),mkt.name="SP500.TR",
 #'                        data=managers, fit.method="OLS",control=NULL)
-#'  # List object
-#'  fitUpDn
 #'  
+#'  print(fitUpDn)
+#'  summary(fitUpDn)
+#'  
+#'  # A list object
+#'  fitUpDn
 #'  summary(fitUpDn$Up)
 #'  summary(fitUpDn$Dn)
 #'  

Modified: pkg/FactorAnalytics/R/plot.tsfmUpDn.r
===================================================================
--- pkg/FactorAnalytics/R/plot.tsfmUpDn.r	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/R/plot.tsfmUpDn.r	2015-03-06 18:46:18 UTC (rev 3609)
@@ -6,8 +6,8 @@
 #' This method plots actual values against fitted value of up and down market time series
 #' factor model. The black dots are actual values and the red lines are fitted values.
 #' 
-#' For other types of plots, use the list objects (\code{Up} and \code{Dn}) of class \code{tsfmUpDn}. As a result, the
-#' \code{plot.tsfm} can be applied.
+#' For other types of plots, use the list objects \code{Up} and \code{Dn} of class \code{tsfmUpDn}. 
+#' The \code{plot.tsfm} can be applied.
 #' 
 #' @param object an object of class \code{tsfmUpDn} produced by \code{fitTsfmUpDn}.
 #' @param mkt.name The name of market returns used in \code{fitTsfmUpDn}. It is necessary

Modified: pkg/FactorAnalytics/man/fitTsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfm.Rd	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/man/fitTsfm.Rd	2015-03-06 18:46:18 UTC (rev 3609)
@@ -120,17 +120,9 @@
 \code{fit.method} will be ignored.
 
 Arguments \code{mkt.name} and \code{mkt.timing} allow for market-timing
-factors to be added to any of the above methods. Market timing accounts for
-the price movement of the general stock market relative to fixed income
-securities. Specifying \code{mkt.timing="HM"}, includes
-$down.market = max(0, R_f-R_m)$ as a factor, following Henriksson & Merton
-(1981). The coefficient of this down-market factor can be interpreted as the
-number of "free" put options on the market provided by the manager's
-market-timings kills. Similarly, to account for market timing with respect
-to volatility, one can specify \code{mkt.timing="TM"}. Following
-Treynor & Mazuy (1966), $market.sqd = (R_m-R_f)^2$ is added as a factor.
-For example, as a test for market timing, either of these factors can be
-added to the single index regression model.
+factors to be added to any of the above methods. A wrapper function
+\code{\link{fitTsfmMT}} is built based on this functionality. Please refer to
+\code{fitTsfmMT} for detail.
 
 \subsection{Data Processing}{
 

Modified: pkg/FactorAnalytics/man/fitTsfmLagBeta.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfmLagBeta.Rd	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/man/fitTsfmLagBeta.Rd	2015-03-06 18:46:18 UTC (rev 3609)
@@ -43,14 +43,11 @@
 \item{...}{arguments passed to \code{\link{fitTsfm.control}}}
 }
 \value{
-fitTsfm returns an object of class \code{"tsfm"} for which
-\code{print}, \code{plot}, \code{predict} and \code{summary} methods exist.
+\code{fitTsfmLagBeta} also returns an object of class \code{"tsfm"} like
+\code{fitTsfm}. The generic function such as \code{print}, \code{plot}, \code{predict}
+and \code{summary} methods exist. Also, the generic accessor functions \code{coef},
+\code{fitted} \code{residuals} and  \code{fmCov} can be applied as well.
 
-The generic accessor functions \code{coef}, \code{fitted} and
-\code{residuals} extract various useful features of the fit object.
-Additionally, \code{fmCov} computes the covariance matrix for asset returns
-based on the fitted factor model
-
 An object of class \code{"tsfm"} is a list containing the following
 components:
 \item{asset.fit}{list of fitted objects for each asset. Each object is of
@@ -76,58 +73,18 @@
 This is a wrapper function to fits a time series lagged Betas factor model for one
 or more asset returns or excess returns using time series regression.
 Users can choose between ordinary least squares-OLS, discounted least
-squares-DLS (or) robust regression. Several variable selection options
+squares-DLS (or) robust regression like \code{fitTsfm}. Several variable selection options
 including Stepwise, Subsets, Lars are available as well. An object of class
 \code{"tsfm"} is returned.
 }
 \details{
-Typically, factor models are fit using excess returns. \code{rf.name} gives
-the option to supply a risk free rate variable to subtract from each asset
-return and factor to compute excess returns.
-
-Estimation method "OLS" corresponds to ordinary least squares using
-\code{\link[stats]{lm}}, "DLS" is discounted least squares (weighted least
-squares with exponentially declining weights that sum to unity), and,
-"Robust" is robust regression (using \code{\link[robust]{lmRob}}).
-
-If \code{variable.selection="none"}, uses all the factors and performs no
-variable selection. Whereas, "stepwise" performs traditional stepwise
-LS or Robust regression (using \code{\link[stats]{step}} or
-\code{\link[robust]{step.lmRob}}), that starts from the initial set of
-factors and adds/subtracts factors only if the regression fit, as measured
-by the Bayesian Information Criterion (BIC) or Akaike Information Criterion
-(AIC), improves. And, "subsets" enables subsets selection using
-\code{\link[leaps]{regsubsets}}; chooses the best performing subset of any
-given size or within a range of subset sizes. Different methods such as
-exhaustive search (default), forward or backward stepwise, or sequential
-replacement can be employed.See \code{\link{fitTsfm.control}} for more
-details on the control arguments.
-
-\code{variable.selection="lars"} corresponds to least angle regression
-using \code{\link[lars]{lars}} with variants "lasso" (default), "lar",
-"stepwise" or "forward.stagewise". Note: If \code{variable.selection="lars"},
-\code{fit.method} will be ignored.
-
-Market timing accounts for
-the price movement of the general stock market relative to fixed income
-securities. It includes
-$down.market = max(0, R_f-R_m)$ as a factor, following Henriksson & Merton
-(1981). The coefficient of this down-market factor can be interpreted as the
-number of "free" put options on the market provided by the manager's
-market-timings kills.
-
-\subsection{Data Processing}{
-
-Note about NAs: Before model fitting, incomplete cases are removed for
-every asset (return data combined with respective factors' return data)
-using \code{\link[stats]{na.omit}}. Otherwise, all observations in
-\code{data} are included.
-
-Note about \code{asset.names} and \code{factor.names}: Spaces in column
-names of \code{data} will be converted to periods as \code{fitTsfm} works
-with \code{xts} objects internally and colnames won't be left as they are.
+The lagged returns model estimates lagged market Beta. Specifically,
+\deqn{r_t = \alpha + \beta_0 MKT_t + \beta_1 MKT_t-1 + \ldots + \beta_K MKT_t-K + \epsilon_t, t=1 \ldots T}
+where \eqn{r_t} is the asset returns, and MKT is the market factor. It is usually
+needed for illiquid securities with stale prices. One can also report the sum of
+the lagged Betas:
+\deqn{\beta = \beta_0 + \beta_1 + \ldots + \beta_K }
 }
-}
 \examples{
 # load data from the database
 data(managers)
@@ -143,33 +100,11 @@
 Yi-An Chen.
 }
 \references{
-Christopherson, J. A., Carino, D. R., & Ferson, W. E. (2009). Portfolio
-performance measurement and benchmarking. McGraw Hill Professional.
-
-Efron, B., Hastie, T., Johnstone, I., & Tibshirani, R. (2004). Least angle
-regression. The Annals of statistics, 32(2), 407-499.
-
-Hastie, T., Tibshirani, R., Friedman, J., Hastie, T., Friedman, J., &
-Tibshirani, R. (2009). The elements of statistical learning (Vol. 2, No. 1).
-New York: Springer.
-
-Henriksson, R. D., & Merton, R. C. (1981). On market timing and investment
-performance. II. Statistical procedures for evaluating forecasting skills.
-Journal of business, 513-533.
-
-Treynor, J., & Mazuy, K. (1966). Can mutual funds outguess the market.
-Harvard business review, 44(4), 131-136.
+Scholes, M. and Williams, J. T. (1977). Estimating betas from non-synchronous
+data, Journal of Financial Economics, vol. 5, 1977, pp. 309-327
 }
 \seealso{
-The \code{tsfm} methods for generic functions:
-\code{\link{plot.tsfm}}, \code{\link{predict.tsfm}},
-\code{\link{print.tsfm}} and \code{\link{summary.tsfm}}.
-
-And, the following extractor functions: \code{\link[stats]{coef}},
-\code{\link[stats]{fitted}}, \code{\link[stats]{residuals}},
-\code{\link{fmCov}}, \code{\link{fmSdDecomp}}, \code{\link{fmVaRDecomp}}
-and \code{\link{fmEsDecomp}}.
-
-\code{\link{paFm}} for Performance Attribution.
+The original time series function \code{\link{fitTsfm}} and its generic functions
+ application.
 }
 

Modified: pkg/FactorAnalytics/man/fitTsfmMT.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfmMT.Rd	2015-03-04 18:47:01 UTC (rev 3608)
+++ pkg/FactorAnalytics/man/fitTsfmMT.Rd	2015-03-06 18:46:18 UTC (rev 3609)
@@ -40,14 +40,11 @@
 \item{...}{arguments passed to \code{\link{fitTsfm.control}}}
 }
 \value{
-fitTsfm returns an object of class \code{"tsfm"} for which
-\code{print}, \code{plot}, \code{predict} and \code{summary} methods exist.
+\code{fitTsfmMT} also returns an object of class \code{"tsfm"} like
+\code{fitTsfm}. The generic function such as \code{print}, \code{plot}, \code{predict}
+and \code{summary} methods exist. Also, the generic accessor functions \code{coef},
+\code{fitted} \code{residuals} and  \code{fmCov} can be applied as well.
 
-The generic accessor functions \code{coef}, \code{fitted} and
-\code{residuals} extract various useful features of the fit object.
-Additionally, \code{fmCov} computes the covariance matrix for asset returns
-based on the fitted factor model
-
 An object of class \code{"tsfm"} is a list containing the following
 components:
 \item{asset.fit}{list of fitted objects for each asset. Each object is of
@@ -78,53 +75,11 @@
 \code{"tsfm"} is returned.
 }
 \details{
-Typically, factor models are fit using excess returns. \code{rf.name} gives
-the option to supply a risk free rate variable to subtract from each asset
-return and factor to compute excess returns.
-
-Estimation method "OLS" corresponds to ordinary least squares using
-\code{\link[stats]{lm}}, "DLS" is discounted least squares (weighted least
-squares with exponentially declining weights that sum to unity), and,
-"Robust" is robust regression (using \code{\link[robust]{lmRob}}).
-
-If \code{variable.selection="none"}, uses all the factors and performs no
-variable selection. Whereas, "stepwise" performs traditional stepwise
-LS or Robust regression (using \code{\link[stats]{step}} or
-\code{\link[robust]{step.lmRob}}), that starts from the initial set of
-factors and adds/subtracts factors only if the regression fit, as measured
-by the Bayesian Information Criterion (BIC) or Akaike Information Criterion
-(AIC), improves. And, "subsets" enables subsets selection using
-\code{\link[leaps]{regsubsets}}; chooses the best performing subset of any
-given size or within a range of subset sizes. Different methods such as
-exhaustive search (default), forward or backward stepwise, or sequential
-replacement can be employed.See \code{\link{fitTsfm.control}} for more
-details on the control arguments.
-
-\code{variable.selection="lars"} corresponds to least angle regression
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/returnanalytics -r 3609


More information about the Returnanalytics-commits mailing list