[Returnanalytics-commits] r3610 - in pkg/FactorAnalytics: . R man tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Mar 11 02:13:15 CET 2015
Author: chenyian
Date: 2015-03-11 02:13:15 +0100 (Wed, 11 Mar 2015)
New Revision: 3610
Modified:
pkg/FactorAnalytics/DESCRIPTION
pkg/FactorAnalytics/R/fitTsfmLagBeta.r
pkg/FactorAnalytics/R/fitTsfmMT.r
pkg/FactorAnalytics/R/fitTsfmUpDn.r
pkg/FactorAnalytics/R/plot.tsfmUpDn.r
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:
version 2.011.
1. Delete argument "factor.names" in fitTsfmLagBeta.r, fitTsfmMT.r and fitTsfmUpDn.r so that the function is simpler.
2. Edit document fitTsfmLagBeta.Rd, fitTsfmMT.Rd and fitTsfmUpDn.Rd.
Modified: pkg/FactorAnalytics/DESCRIPTION
===================================================================
--- pkg/FactorAnalytics/DESCRIPTION 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/DESCRIPTION 2015-03-11 01:13:15 UTC (rev 3610)
@@ -1,8 +1,8 @@
Package: factorAnalytics
Type: Package
Title: Factor Analytics
-Version: 2.0.10
-Date: 2015-01-27
+Version: 2.0.11
+Date: 2015-03-10
Author: Eric Zivot, Sangeetha Srinivasan and Yi-An Chen
Maintainer: Sangeetha Srinivasan <sangee at uw.edu>
Description: An R package for the estimation and risk analysis of linear factor
Modified: pkg/FactorAnalytics/R/fitTsfmLagBeta.r
===================================================================
--- pkg/FactorAnalytics/R/fitTsfmLagBeta.r 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/R/fitTsfmLagBeta.r 2015-03-11 01:13:15 UTC (rev 3610)
@@ -3,8 +3,7 @@
#' @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 like \code{fitTsfm}. Several variable selection options
-#' including Stepwise, Subsets, Lars are available as well. An object of class
+#' squares-DLS (or) robust regression like \code{fitTsfm}.An object of class
#' \code{"tsfm"} is returned.
#'
#' @details
@@ -17,12 +16,11 @@
#'
#' @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.
-#' @param mkt.name name of the column for market excess returns (Rm-Rf). It
+#' @param mkt.name name of the column for market returns. It
#' is required for a lagged Betas factor model.
#' @param rf.name name of the column of risk free rate variable to calculate
-#' excess returns for all assets (in \code{asset.names}) and factors (in
-#' \code{factor.names}). Default is NULL, and no action is taken.
+#' excess returns for all assets (in \code{asset.names}) and the market factor (in
+#' \code{mkt.name}).Default is NULL, and no action is taken.
#' @param LagBeta A integer number to specify numbers of lags of Betas to
#' include in the model. The Default is 1.
#' @param data vector, matrix, data.frame, xts, timeSeries or zoo object
@@ -30,9 +28,6 @@
#' optionally, \code{mkt.name} and \code{rf.name}.
#' @param fit.method the estimation method, one of "OLS", "DLS" or "Robust".
#' See details. Default is "OLS".
-#' @param variable.selection the variable selection method, one of "none",
-#' "stepwise","subsets","lars". See details. Default is "none".
-#' \code{mkt.name} is required if any of these options are to be implemented.
#' @param control list of control parameters. The default is constructed by
#' the function \code{\link{fitTsfm.control}}. See the documentation for
#' \code{\link{fitTsfm.control}} for details.
@@ -41,27 +36,22 @@
#' @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.
+#' \code{fitted}, \code{residuals} and \code{fmCov} can be applied as well.
#'
#' 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
#' class \code{lm} if \code{fit.method="OLS" or "DLS"}, class \code{lmRob} if
-#' the \code{fit.method="Robust"}, or class \code{lars} if
-#' \code{variable.selection="lars"}.}
+#' the \code{fit.method="Robust"}.}
#' \item{alpha}{length-N vector of estimated alphas.}
-#' \item{beta}{N x K matrix of estimated betas.}
+#' \item{beta}{N x (L+1) matrix of estimated betas.}
#' \item{r2}{length-N vector of R-squared values.}
#' \item{resid.sd}{length-N vector of residual standard deviations.}
-#' \item{fitted}{xts data object of fitted values; iff
-#' \code{variable.selection="lars"}}
#' \item{call}{the matched function call.}
#' \item{data}{xts data object containing the assets and factors.}
#' \item{asset.names}{asset.names as input.}
-#' \item{factor.names}{factor.names as input.}
#' \item{fit.method}{fit.method as input.}
-#' \item{variable.selection}{variable.selection as input.}
-#' Where N is the number of assets, K is the number of factors and T is the
+#' Where N is the number of assets, L is the number of lagged market Betas and T is the
#' number of time periods.
#'
#' @author Yi-An Chen.
@@ -80,8 +70,7 @@
#'
#' # example: A lagged Beetas model with OLS fit
#' fit <- fitTsfmLagBeta(asset.names=colnames(managers[,(1:6)]),LagBeta=2,
-#' factor.names="SP500.TR",mkt.name="SP500.TR",
-#' rf.name="US.3m.TR",data=managers)
+#' mkt.name="SP500.TR",rf.name="US.3m.TR",data=managers)
#' summary(fit)
#' fitted(fit)
#'
@@ -92,9 +81,9 @@
#'
#' @export
-fitTsfmLagBeta <- function(asset.names, factor.names=NULL, mkt.name=NULL, rf.name=NULL,
+fitTsfmLagBeta <- function(asset.names, mkt.name, rf.name=NULL,
data=data, fit.method=c("OLS","DLS","Robust"),LagBeta=1,
- variable.selection=c("none","stepwise","subsets","lars"), control=fitTsfm.control(...),...) {
+ control=fitTsfm.control(...),...) {
if (is.null(mkt.name)) {
stop("Missing argument: mkt.name has to be specified for lagged Betas model.")
@@ -106,6 +95,7 @@
}
# Create market lag terms
+ factor.names = mkt.name
mktlag <- lag(data[,mkt.name],k=seq(1:LagBeta))
for (i in 1:LagBeta) {
colnames(mktlag)[i] <- paste("MktLag",i,sep="")
@@ -114,7 +104,7 @@
data <- merge(data,mktlag)
fit <- fitTsfm(asset.names=asset.names,factor.names=factor.names,mkt.name=mkt.name,rf.name=rf.name,
- data=data,fit.method=fit.method,variable.selection=variable.selection,control=control)
+ data=data,fit.method=fit.method,variable.selection="none",control=control)
return(fit)
}
\ No newline at end of file
Modified: pkg/FactorAnalytics/R/fitTsfmMT.r
===================================================================
--- pkg/FactorAnalytics/R/fitTsfmMT.r 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/R/fitTsfmMT.r 2015-03-11 01:13:15 UTC (rev 3610)
@@ -3,8 +3,7 @@
#' @description This is a wrapper function to fits a time series market timing 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
-#' including Stepwise, Subsets, Lars are available as well. An object of class
+#' squares-DLS (or) robust regression. An object of class
#' \code{"tsfm"} is returned.
#'
#' @details
@@ -17,20 +16,16 @@
#'
#' @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.
-#' @param mkt.name name of the column for market excess returns (Rm-Rf); It
+#' @param mkt.name name of the column for market returns; It
#' is required for a market timing model.
#' @param rf.name name of the column of risk free rate variable to calculate
-#' excess returns for all assets (in \code{asset.names}) and factors (in
-#' \code{factor.names}). Default is NULL, and no action is taken.
+#' excess returns for all assets (in \code{asset.names}) and the market factor (in
+#' \code{mkt.name}).Default is NULL, and no action is taken.
#' @param data vector, matrix, data.frame, xts, timeSeries or zoo object
#' containing column(s) named in \code{asset.names}, \code{factor.names} and
#' optionally, \code{mkt.name} and \code{rf.name}.
#' @param fit.method the estimation method, one of "OLS", "DLS" or "Robust".
#' See details. Default is "OLS".
-#' @param variable.selection the variable selection method, one of "none",
-#' "stepwise","subsets","lars". See details. Default is "none".
-#' \code{mkt.name} is required if any of these options are to be implemented.
#' @param control list of control parameters. The default is constructed by
#' the function \code{\link{fitTsfm.control}}. See the documentation for
#' \code{\link{fitTsfm.control}} for details.
@@ -39,27 +34,22 @@
#' @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.
+#' \code{fitted}, \code{residuals} and \code{fmCov} can be applied as well.
#'
#' 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
#' class \code{lm} if \code{fit.method="OLS" or "DLS"}, class \code{lmRob} if
-#' the \code{fit.method="Robust"}, or class \code{lars} if
-#' \code{variable.selection="lars"}.}
+#' the \code{fit.method="Robust"}.}
#' \item{alpha}{length-N vector of estimated alphas.}
-#' \item{beta}{N x K matrix of estimated betas.}
+#' \item{beta}{N x 2 matrix of estimated betas.}
#' \item{r2}{length-N vector of R-squared values.}
#' \item{resid.sd}{length-N vector of residual standard deviations.}
-#' \item{fitted}{xts data object of fitted values; iff
-#' \code{variable.selection="lars"}}
#' \item{call}{the matched function call.}
#' \item{data}{xts data object containing the assets and factors.}
#' \item{asset.names}{asset.names as input.}
-#' \item{factor.names}{factor.names as input.}
#' \item{fit.method}{fit.method as input.}
-#' \item{variable.selection}{variable.selection as input.}
-#' Where N is the number of assets, K is the number of factors and T is the
+#' Where N is the number of assets and T is the
#' number of time periods.
#'
#' @author Yi-An Chen.
@@ -93,17 +83,15 @@
#'
#' @export
-fitTsfmMT <- function(asset.names, factor.names=NULL, mkt.name=NULL, rf.name=NULL,
+fitTsfmMT <- function(asset.names,mkt.name, rf.name=NULL,
data=data, fit.method=c("OLS","DLS","Robust"),
- variable.selection=c("none","stepwise","subsets","lars"), control=fitTsfm.control(...),...) {
+ control=fitTsfm.control(...),...) {
if (is.null(mkt.name)){
stop("Missing argument: mkt.name has to be specified for market timing model.")
}
- factor.names <- union(factor.names,mkt.name)
-
- fit.Timing <- fitTsfm(asset.names=asset.names,factor.names=factor.names,mkt.name=mkt.name,rf.name=rf.name,
- data=data,fit.method=fit.method,variable.selection=variable.selection,control=control,mkt.timing="HM")
+ fit.Timing <- fitTsfm(asset.names=asset.names,factor.names=mkt.name,mkt.name=mkt.name,rf.name=rf.name,
+ data=data,fit.method=fit.method,variable.selection="none",control=control,mkt.timing="HM")
return(fit.Timing)
}
Modified: pkg/FactorAnalytics/R/fitTsfmUpDn.r
===================================================================
--- pkg/FactorAnalytics/R/fitTsfmUpDn.r 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/R/fitTsfmUpDn.r 2015-03-11 01:13:15 UTC (rev 3610)
@@ -3,32 +3,27 @@
#' @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
-#' including Stepwise, Subsets, Lars are available as well. An object of class
-#' \code{"tsfm"} is returned.
+#' squares-DLS (or) robust regression. An object of class
+#' \code{"tsfmUpDn"} is returned.
#'
#' @details
#' \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.
+#' The goal of up and down market model is to capture two different market Betas in the up and down markets.
#'
#'
#' @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.
-#' @param mkt.name name of the column for market excess returns (Rm-Rf). It
+#' @param mkt.name name of the column for market returns. It
#' is required for a up/down market model.
#' @param rf.name name of the column of risk free rate variable to calculate
-#' excess returns for all assets (in \code{asset.names}) and factors (in
-#' \code{factor.names}). Default is NULL, and no action is taken.
+#' excess returns for all assets (in \code{asset.names}) and the market factor (in
+#' \code{mkt.name}). Default is \code{NULL}, and no action is taken.
#' @param data vector, matrix, data.frame, xts, timeSeries or zoo object
#' containing column(s) named in \code{asset.names}, \code{factor.names} and
#' optionally, \code{mkt.name} and \code{rf.name}.
#' @param fit.method the estimation method, one of "OLS", "DLS" or "Robust".
#' See details. Default is "OLS".
-#' @param variable.selection the variable selection method, one of "none",
-#' "stepwise","subsets","lars". See details. Default is "none".
-#' \code{mkt.name} is required if any of these options are to be implemented.
#' @param control list of control parameters. The default is constructed by
#' the function \code{\link{fitTsfm.control}}. See the documentation for
#' \code{\link{fitTsfm.control}} for details.
@@ -41,7 +36,7 @@
#' 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.
+#' \code{fitted}, \code{residuals} and \code{fmCov} can be applied as well.
#'
#' 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.}
@@ -50,21 +45,17 @@
#' 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
-#' \code{variable.selection="lars"}.}
+#' the \code{fit.method="Robust"}}
#' \item{alpha}{length-N vector of estimated alphas.}
-#' \item{beta}{N x K matrix of estimated betas.}
+#' \item{beta}{N x 1 matrix of estimated betas.}
#' \item{r2}{length-N vector of R-squared values.}
#' \item{resid.sd}{length-N vector of residual standard deviations.}
-#' \item{fitted}{xts data object of fitted values; iff
-#' \code{variable.selection="lars"}}
#' \item{call}{the matched function call.}
#' \item{data}{xts data object containing the assets and factors.}
#' \item{asset.names}{asset.names as input.}
#' \item{factor.names}{factor.names as input.}
#' \item{fit.method}{fit.method as input.}
-#' \item{variable.selection}{variable.selection as input.}
-#' Where N is the number of assets, K is the number of factors and T is the
+#' Where N is the number of assets and T is the
#' number of time periods.
#'
#' @author Yi-An Chen.
@@ -105,50 +96,46 @@
#' @export
-fitTsfmUpDn <- function(asset.names, factor.names=NULL, mkt.name=NULL, rf.name=NULL,
- data=data, fit.method=c("OLS","DLS","Robust"),
- variable.selection=c("none","stepwise","subsets","lars"),
- control=fitTsfm.control(...),...) {
+fitTsfmUpDn <- function(asset.names, mkt.name, rf.name=NULL,
+ data=data, fit.method=c("OLS","DLS","Robust"),
+ control=fitTsfm.control(...),...) {
if (is.null(mkt.name)){
stop("Missing argument: mkt.name has to be specified for up and down market model.")
}
-
-
- factor.names <- union(factor.names,mkt.name)
-
+
# convert data into an xts object and hereafter work with xts objects
data.xts <- checkData(data)
# convert index to 'Date' format for uniformity
time(data.xts) <- as.Date(time(data.xts))
# extract columns to be used in the time series regression
- dat.xts <- merge(data.xts[,asset.names], data.xts[,factor.names])
+ dat.xts <- merge(data.xts[,asset.names], data.xts[,mkt.name])
### After merging xts objects, the spaces in names get converted to periods
# convert all asset and factor returns to excess return form if specified
if (!is.null(rf.name)) {
dat.xts <- "[<-"(dat.xts,,vapply(dat.xts, function(x) x-data.xts[,rf.name],
FUN.VALUE = numeric(nrow(dat.xts))))
- warning("Up market is defined as the excess Market returns is no less than 0.")
+ warning("The up market is defined as the excess Market returns is no less than 0.")
} else {
- warning("Up market is defined as the Market returns is no less than 0.")
+ warning("The up market is defined as the Market returns is no less than 0.")
}
mkt <- dat.xts[,mkt.name]
# up market
dataUp.xts <- dat.xts[mkt >= 0]
- fitUp <- fitTsfm(asset.names=asset.names,factor.names=factor.names,mkt.name=mkt.name,rf.name=rf.name,
- data=dataUp.xts,fit.method=fit.method,variable.selection=variable.selection,
+ fitUp <- fitTsfm(asset.names=asset.names,factor.names=mkt.name,mkt.name=mkt.name,rf.name=rf.name,
+ data=dataUp.xts,fit.method=fit.method,variable.selection="none",
control=control)
# down market
dataDn.xts <- dat.xts[mkt < 0]
- fitDn <- fitTsfm(asset.names=asset.names,factor.names=factor.names,mkt.name=mkt.name,rf.name=rf.name,
- data=dataDn.xts,fit.method=fit.method,variable.selection=variable.selection,
+ fitDn <- fitTsfm(asset.names=asset.names,factor.names=mkt.name,mkt.name=mkt.name,rf.name=rf.name,
+ data=dataDn.xts,fit.method=fit.method,variable.selection="none",
control=control)
result <- list(Up = fitUp, Dn = fitDn)
Modified: pkg/FactorAnalytics/R/plot.tsfmUpDn.r
===================================================================
--- pkg/FactorAnalytics/R/plot.tsfmUpDn.r 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/R/plot.tsfmUpDn.r 2015-03-11 01:13:15 UTC (rev 3610)
@@ -12,8 +12,8 @@
#' @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
#' to provide the name of market returns.
-#' @param assets.name The name of the assets used in \code{fitTsfmUpDn}. It only supports
-#' single asset so far.
+#' @param assets.name The name of the asset used in \code{fitTsfmUpDn}. It supports one
+#' asset name at once.
#' @param ... Other arguments can be used in \code{plot}.
#' @author Yi-An Chen
#'
Modified: pkg/FactorAnalytics/man/fitTsfmLagBeta.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfmLagBeta.Rd 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/man/fitTsfmLagBeta.Rd 2015-03-11 01:13:15 UTC (rev 3610)
@@ -4,23 +4,20 @@
\alias{fitTsfmLagBeta}
\title{Fit a lagged Betas factor model using time series regression}
\usage{
-fitTsfmLagBeta(asset.names, factor.names = NULL, mkt.name = NULL,
- rf.name = NULL, data = data, fit.method = c("OLS", "DLS", "Robust"),
- LagBeta = 1, variable.selection = c("none", "stepwise", "subsets",
- "lars"), control = fitTsfm.control(...), ...)
+fitTsfmLagBeta(asset.names, mkt.name, rf.name = NULL, data = data,
+ fit.method = c("OLS", "DLS", "Robust"), LagBeta = 1,
+ control = fitTsfm.control(...), ...)
}
\arguments{
\item{asset.names}{vector containing names of assets, whose returns or
excess returns are the dependent variable.}
-\item{factor.names}{vector containing names of the macroeconomic factors.}
-
-\item{mkt.name}{name of the column for market excess returns (Rm-Rf). It
+\item{mkt.name}{name of the column for market returns. It
is required for a lagged Betas factor model.}
\item{rf.name}{name of the column of risk free rate variable to calculate
-excess returns for all assets (in \code{asset.names}) and factors (in
-\code{factor.names}). Default is NULL, and no action is taken.}
+excess returns for all assets (in \code{asset.names}) and the market factor (in
+\code{mkt.name}).Default is NULL, and no action is taken.}
\item{data}{vector, matrix, data.frame, xts, timeSeries or zoo object
containing column(s) named in \code{asset.names}, \code{factor.names} and
@@ -32,10 +29,6 @@
\item{LagBeta}{A integer number to specify numbers of lags of Betas to
include in the model. The Default is 1.}
-\item{variable.selection}{the variable selection method, one of "none",
-"stepwise","subsets","lars". See details. Default is "none".
-\code{mkt.name} is required if any of these options are to be implemented.}
-
\item{control}{list of control parameters. The default is constructed by
the function \code{\link{fitTsfm.control}}. See the documentation for
\code{\link{fitTsfm.control}} for details.}
@@ -46,35 +39,29 @@
\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.
+\code{fitted}, \code{residuals} and \code{fmCov} can be applied as well.
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
class \code{lm} if \code{fit.method="OLS" or "DLS"}, class \code{lmRob} if
-the \code{fit.method="Robust"}, or class \code{lars} if
-\code{variable.selection="lars"}.}
+the \code{fit.method="Robust"}.}
\item{alpha}{length-N vector of estimated alphas.}
-\item{beta}{N x K matrix of estimated betas.}
+\item{beta}{N x (L+1) matrix of estimated betas.}
\item{r2}{length-N vector of R-squared values.}
\item{resid.sd}{length-N vector of residual standard deviations.}
-\item{fitted}{xts data object of fitted values; iff
-\code{variable.selection="lars"}}
\item{call}{the matched function call.}
\item{data}{xts data object containing the assets and factors.}
\item{asset.names}{asset.names as input.}
-\item{factor.names}{factor.names as input.}
\item{fit.method}{fit.method as input.}
-\item{variable.selection}{variable.selection as input.}
-Where N is the number of assets, K is the number of factors and T is the
+Where N is the number of assets, L is the number of lagged market Betas and T is the
number of time periods.
}
\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 like \code{fitTsfm}. Several variable selection options
-including Stepwise, Subsets, Lars are available as well. An object of class
+squares-DLS (or) robust regression like \code{fitTsfm}.An object of class
\code{"tsfm"} is returned.
}
\details{
@@ -91,8 +78,7 @@
# example: A lagged Beetas model with OLS fit
fit <- fitTsfmLagBeta(asset.names=colnames(managers[,(1:6)]),LagBeta=2,
- factor.names="SP500.TR",mkt.name="SP500.TR",
- rf.name="US.3m.TR",data=managers)
+ mkt.name="SP500.TR",rf.name="US.3m.TR",data=managers)
summary(fit)
fitted(fit)
}
Modified: pkg/FactorAnalytics/man/fitTsfmMT.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfmMT.Rd 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/man/fitTsfmMT.Rd 2015-03-11 01:13:15 UTC (rev 3610)
@@ -4,23 +4,20 @@
\alias{fitTsfmMT}
\title{Fit a time serie market timing factor model using time series regression}
\usage{
-fitTsfmMT(asset.names, factor.names = NULL, mkt.name = NULL,
- rf.name = NULL, data = data, fit.method = c("OLS", "DLS", "Robust"),
- variable.selection = c("none", "stepwise", "subsets", "lars"),
- control = fitTsfm.control(...), ...)
+fitTsfmMT(asset.names, mkt.name, rf.name = NULL, data = data,
+ fit.method = c("OLS", "DLS", "Robust"), control = fitTsfm.control(...),
+ ...)
}
\arguments{
\item{asset.names}{vector containing names of assets, whose returns or
excess returns are the dependent variable.}
-\item{factor.names}{vector containing names of the macroeconomic factors.}
-
-\item{mkt.name}{name of the column for market excess returns (Rm-Rf); It
+\item{mkt.name}{name of the column for market returns; It
is required for a market timing model.}
\item{rf.name}{name of the column of risk free rate variable to calculate
-excess returns for all assets (in \code{asset.names}) and factors (in
-\code{factor.names}). Default is NULL, and no action is taken.}
+excess returns for all assets (in \code{asset.names}) and the market factor (in
+\code{mkt.name}).Default is NULL, and no action is taken.}
\item{data}{vector, matrix, data.frame, xts, timeSeries or zoo object
containing column(s) named in \code{asset.names}, \code{factor.names} and
@@ -29,10 +26,6 @@
\item{fit.method}{the estimation method, one of "OLS", "DLS" or "Robust".
See details. Default is "OLS".}
-\item{variable.selection}{the variable selection method, one of "none",
-"stepwise","subsets","lars". See details. Default is "none".
-\code{mkt.name} is required if any of these options are to be implemented.}
-
\item{control}{list of control parameters. The default is constructed by
the function \code{\link{fitTsfm.control}}. See the documentation for
\code{\link{fitTsfm.control}} for details.}
@@ -43,35 +36,29 @@
\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.
+\code{fitted}, \code{residuals} and \code{fmCov} can be applied as well.
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
class \code{lm} if \code{fit.method="OLS" or "DLS"}, class \code{lmRob} if
-the \code{fit.method="Robust"}, or class \code{lars} if
-\code{variable.selection="lars"}.}
+the \code{fit.method="Robust"}.}
\item{alpha}{length-N vector of estimated alphas.}
-\item{beta}{N x K matrix of estimated betas.}
+\item{beta}{N x 2 matrix of estimated betas.}
\item{r2}{length-N vector of R-squared values.}
\item{resid.sd}{length-N vector of residual standard deviations.}
-\item{fitted}{xts data object of fitted values; iff
-\code{variable.selection="lars"}}
\item{call}{the matched function call.}
\item{data}{xts data object containing the assets and factors.}
\item{asset.names}{asset.names as input.}
-\item{factor.names}{factor.names as input.}
\item{fit.method}{fit.method as input.}
-\item{variable.selection}{variable.selection as input.}
-Where N is the number of assets, K is the number of factors and T is the
+Where N is the number of assets and T is the
number of time periods.
}
\description{
This is a wrapper function to fits a time series market timing 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
-including Stepwise, Subsets, Lars are available as well. An object of class
+squares-DLS (or) robust regression. An object of class
\code{"tsfm"} is returned.
}
\details{
Modified: pkg/FactorAnalytics/man/fitTsfmUpDn.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfmUpDn.Rd 2015-03-06 18:46:18 UTC (rev 3609)
+++ pkg/FactorAnalytics/man/fitTsfmUpDn.Rd 2015-03-11 01:13:15 UTC (rev 3610)
@@ -4,23 +4,20 @@
\alias{fitTsfmUpDn}
\title{Fit a up and down market factor model using time series regression}
\usage{
-fitTsfmUpDn(asset.names, factor.names = NULL, mkt.name = NULL,
- rf.name = NULL, data = data, fit.method = c("OLS", "DLS", "Robust"),
- variable.selection = c("none", "stepwise", "subsets", "lars"),
- control = fitTsfm.control(...), ...)
+fitTsfmUpDn(asset.names, mkt.name, rf.name = NULL, data = data,
+ fit.method = c("OLS", "DLS", "Robust"), control = fitTsfm.control(...),
+ ...)
}
\arguments{
\item{asset.names}{vector containing names of assets, whose returns or
excess returns are the dependent variable.}
-\item{factor.names}{vector containing names of the macroeconomic factors.}
-
-\item{mkt.name}{name of the column for market excess returns (Rm-Rf). It
+\item{mkt.name}{name of the column for market returns. It
is required for a up/down market model.}
\item{rf.name}{name of the column of risk free rate variable to calculate
-excess returns for all assets (in \code{asset.names}) and factors (in
-\code{factor.names}). Default is NULL, and no action is taken.}
+excess returns for all assets (in \code{asset.names}) and the market factor (in
+\code{mkt.name}). Default is \code{NULL}, and no action is taken.}
\item{data}{vector, matrix, data.frame, xts, timeSeries or zoo object
containing column(s) named in \code{asset.names}, \code{factor.names} and
@@ -29,10 +26,6 @@
\item{fit.method}{the estimation method, one of "OLS", "DLS" or "Robust".
See details. Default is "OLS".}
-\item{variable.selection}{the variable selection method, one of "none",
-"stepwise","subsets","lars". See details. Default is "none".
-\code{mkt.name} is required if any of these options are to be implemented.}
-
\item{control}{list of control parameters. The default is constructed by
the function \code{\link{fitTsfm.control}}. See the documentation for
\code{\link{fitTsfm.control}} for details.}
@@ -46,7 +39,7 @@
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.
+\code{fitted}, \code{residuals} and \code{fmCov} can be applied as well.
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.}
@@ -55,35 +48,30 @@
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
-\code{variable.selection="lars"}.}
+the \code{fit.method="Robust"}}
\item{alpha}{length-N vector of estimated alphas.}
-\item{beta}{N x K matrix of estimated betas.}
+\item{beta}{N x 1 matrix of estimated betas.}
\item{r2}{length-N vector of R-squared values.}
\item{resid.sd}{length-N vector of residual standard deviations.}
-\item{fitted}{xts data object of fitted values; iff
-\code{variable.selection="lars"}}
\item{call}{the matched function call.}
\item{data}{xts data object containing the assets and factors.}
\item{asset.names}{asset.names as input.}
\item{factor.names}{factor.names as input.}
\item{fit.method}{fit.method as input.}
-\item{variable.selection}{variable.selection as input.}
-Where N is the number of assets, K is the number of factors and T is the
+Where N is the number of assets and T is the
number of time periods.
}
\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
-including Stepwise, Subsets, Lars are available as well. An object of class
-\code{"tsfm"} is returned.
+squares-DLS (or) robust regression. An object of class
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/returnanalytics -r 3610
More information about the Returnanalytics-commits
mailing list