[Returnanalytics-commits] r3619 - in pkg/FactorAnalytics: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Mar 20 00:17:52 CET 2015
Author: chenyian
Date: 2015-03-20 00:17:52 +0100 (Fri, 20 Mar 2015)
New Revision: 3619
Modified:
pkg/FactorAnalytics/R/plot.tsfm.r
pkg/FactorAnalytics/man/fitTsfm.Rd
pkg/FactorAnalytics/man/fitTsfm.control.Rd
pkg/FactorAnalytics/man/plot.tsfm.Rd
pkg/FactorAnalytics/man/predict.tsfmUpDn.Rd
pkg/FactorAnalytics/man/summary.tsfm.Rd
Log:
debug so Rd2pdf can work.
Modified: pkg/FactorAnalytics/R/plot.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/plot.tsfm.r 2015-03-19 23:01:59 UTC (rev 3618)
+++ pkg/FactorAnalytics/R/plot.tsfm.r 2015-03-19 23:17:52 UTC (rev 3619)
@@ -17,7 +17,7 @@
#'
#' Setting \code{plot.single=TRUE} enables individual plots. If there is more
#' than one asset fit by \code{x}, \code{asset.name} should be specified.
-#' However, if the \code{tsfm} object \code{x} only contains one asset’s factor
+#' However, if the \code{tsfm} object \code{x} only contains a single asset factor
#' model fit, plot.tsfm can infer \code{asset.name} without user input.
#'
#' CUSUM plots (individual asset plot options 10, 11 and 12) are applicable
Modified: pkg/FactorAnalytics/man/fitTsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfm.Rd 2015-03-19 23:01:59 UTC (rev 3618)
+++ pkg/FactorAnalytics/man/fitTsfm.Rd 2015-03-19 23:17:52 UTC (rev 3619)
@@ -1,193 +1,194 @@
-% Generated by roxygen2 (4.0.2): do not edit by hand
-\name{fitTsfm}
-\alias{coef.tsfm}
-\alias{fitTsfm}
-\alias{fitted.tsfm}
-\alias{residuals.tsfm}
-\title{Fit a time series factor model using time series regression}
-\usage{
-fitTsfm(asset.names, factor.names, mkt.name = NULL, rf.name = NULL,
- data = data, fit.method = c("OLS", "DLS", "Robust"),
- variable.selection = c("none", "stepwise", "subsets", "lars"),
- control = fitTsfm.control(...), ...)
-
-\method{coef}{tsfm}(object, ...)
-
-\method{fitted}{tsfm}(object, ...)
-
-\method{residuals}{tsfm}(object, ...)
-}
-\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 returns. Default is NULL.}
-
-\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.}
-
-\item{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}.}
-
-\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.}
-
-\item{...}{arguments passed to \code{\link{fitTsfm.control}}}
-
-\item{object}{a fit object of class \code{tsfm} which is returned by
-\code{fitTsfm}}
-}
-\value{
-fitTsfm returns an object of class \code{"tsfm"} for which
-\code{print}, \code{plot}, \code{predict} and \code{summary} methods exist.
-
-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
-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"}.}
-\item{alpha}{length-N vector of estimated alphas.}
-\item{beta}{N x K 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{mkt.name}{mkt.name 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
-number of time periods.
-}
-\description{
-Fits a time series (a.k.a. macroeconomic) 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
-\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.
-
-Argument \code{mkt.name} can be used to add market-timing factors to any of
-the above methods. Please refer to \code{\link{fitTsfmMT}}, a wrapper to
-\code{fitTsfm} for details.
-
-\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.
-}
-}
-\examples{
-# load data from the database
-data(managers)
-fit <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
- factor.names=colnames(managers[,(7:9)]), data=managers)
-summary(fit)
-fitted(fit)
-# plot actual returns vs. fitted factor model returns for HAM1
-plot(fit, plot.single=TRUE, asset.name="HAM1", which=1)
-# group plot; type selected from menu prompt; auto-looped for multiple plots
-# plot(fit)
-
-
-# example using "subsets" variable selection
-fit.sub <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
- factor.names=colnames(managers[,(7:9)]),
- data=managers, variable.selection="subsets",
- method="exhaustive", nvmin=2)
-
-# example using "lars" variable selection and subtracting risk-free rate
-fit.lar <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
- factor.names=colnames(managers[,(7:9)]),
- rf.name="US.3m.TR", data=managers,
- variable.selection="lars", lars.criterion="cv")
-}
-\author{
-Eric Zivot, Sangeetha Srinivasan and 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.
-}
-\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.
-}
-
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/fitTsfm.R
+\name{fitTsfm}
+\alias{coef.tsfm}
+\alias{fitTsfm}
+\alias{fitted.tsfm}
+\alias{residuals.tsfm}
+\title{Fit a time series factor model using time series regression}
+\usage{
+fitTsfm(asset.names, factor.names, mkt.name = NULL, rf.name = NULL,
+ data = data, fit.method = c("OLS", "DLS", "Robust"),
+ variable.selection = c("none", "stepwise", "subsets", "lars"),
+ control = fitTsfm.control(...), ...)
+
+\method{coef}{tsfm}(object, ...)
+
+\method{fitted}{tsfm}(object, ...)
+
+\method{residuals}{tsfm}(object, ...)
+}
+\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 returns. Default is NULL.}
+
+\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.}
+
+\item{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}.}
+
+\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.}
+
+\item{...}{arguments passed to \code{\link{fitTsfm.control}}}
+
+\item{object}{a fit object of class \code{tsfm} which is returned by
+\code{fitTsfm}}
+}
+\value{
+fitTsfm returns an object of class \code{"tsfm"} for which
+\code{print}, \code{plot}, \code{predict} and \code{summary} methods exist.
+
+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
+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"}.}
+\item{alpha}{length-N vector of estimated alphas.}
+\item{beta}{N x K 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{mkt.name}{mkt.name 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
+number of time periods.
+}
+\description{
+Fits a time series (a.k.a. macroeconomic) 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
+\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.
+
+Argument \code{mkt.name} can be used to add market-timing factors to any of
+the above methods. Please refer to \code{\link{fitTsfmMT}}, a wrapper to
+\code{fitTsfm} for details.
+
+\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.
+}
+}
+\examples{
+# load data from the database
+data(managers)
+fit <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
+ factor.names=colnames(managers[,(7:9)]), data=managers)
+summary(fit)
+fitted(fit)
+# plot actual returns vs. fitted factor model returns for HAM1
+plot(fit, plot.single=TRUE, asset.name="HAM1", which=1)
+# group plot; type selected from menu prompt; auto-looped for multiple plots
+# plot(fit)
+
+
+# example using "subsets" variable selection
+fit.sub <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
+ factor.names=colnames(managers[,(7:9)]),
+ data=managers, variable.selection="subsets",
+ method="exhaustive", nvmin=2)
+
+# example using "lars" variable selection and subtracting risk-free rate
+fit.lar <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
+ factor.names=colnames(managers[,(7:9)]),
+ rf.name="US.3m.TR", data=managers,
+ variable.selection="lars", lars.criterion="cv")
+}
+\author{
+Eric Zivot, Sangeetha Srinivasan and 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.
+}
+\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.
+}
+
Modified: pkg/FactorAnalytics/man/fitTsfm.control.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitTsfm.control.Rd 2015-03-19 23:01:59 UTC (rev 3618)
+++ pkg/FactorAnalytics/man/fitTsfm.control.Rd 2015-03-19 23:17:52 UTC (rev 3619)
@@ -1,170 +1,171 @@
-% Generated by roxygen2 (4.0.2): do not edit by hand
-\name{fitTsfm.control}
-\alias{fitTsfm.control}
-\title{List of control parameters for \code{fitTsfm}}
-\usage{
-fitTsfm.control(decay = 0.95, weights, model = TRUE, x = FALSE,
- y = FALSE, qr = TRUE, nrep = NULL, efficiency = 0.9, scope, scale,
- direction, trace = FALSE, steps = 1000, k = 2, nvmin = 1, nvmax = 8,
- force.in = NULL, force.out = NULL, method, really.big = FALSE, type,
- normalize = TRUE, eps = .Machine$double.eps, max.steps,
- lars.criterion = "Cp", K = 10)
-}
-\arguments{
-\item{decay}{a scalar in (0, 1] to specify the decay factor for "DLS".
-Default is 0.95.}
-
-\item{weights}{an optional vector of weights to be used in the fitting
-process for \code{fit.method="OLS","Robust"}, or
-\code{variable.selection="subsets"}. Should be \code{NULL} or a numeric
-vector. The length of \code{weights} must be the same as the number of
-observations. The weights must be nonnegative and it is strongly
-recommended that they be strictly positive.}
-
-\item{model,x,y,qr}{logicals passed to \code{lm} for
-\code{fit.method="OLS"}. If \code{TRUE} the corresponding components of the
-fit (the model frame, the model matrix, the response, the QR decomposition)
-are returned.}
-
-\item{nrep}{the number of random subsamples to be drawn for
-\code{fit.method="Robust"}. If the data set is small and "Exhaustive"
-resampling is being used, the value of \code{nrep} is ignored.}
-
-\item{efficiency}{the asymptotic efficiency of the final estimate for
-\code{fit.method="Robust"}. Default is 0.9.}
-
-\item{scope}{defines the range of models examined in the \code{"stepwise"}
-search. This should be either a single formula, or a list containing
-components \code{upper} and \code{lower}, both formulae. See
-\code{\link[stats]{step}} for how to specify the formulae and usage.}
-
-\item{scale}{optional parameter for \code{variable.selection="stepwise"}.
-The argument is passed to \code{\link[stats]{step}} or
-\code{\link[robust]{step.lmRob}} as appropriate.}
-
-\item{direction}{the mode of \code{"stepwise"} search, can be one of "both",
-"backward", or "forward", with a default of "both". If the \code{scope}
-argument is missing the default for \code{direction} is "backward".}
-
-\item{trace}{If positive (or, not \code{FALSE}), info is printed during the
-running of \code{\link[stats]{step}}, \code{\link[robust]{step.lmRob}},
-\code{\link[lars]{lars}} or \code{\link[lars]{cv.lars}} as relevant. Larger
-values may give more detailed information. Default is \code{FALSE}.}
-
-\item{steps}{the maximum number of steps to be considered for
-\code{"stepwise"}. Default is 1000 (essentially as many as required). It is
-typically used to stop the process early.}
-
-\item{k}{the multiple of the number of degrees of freedom used for the
-penalty in \code{"stepwise"}. Only \code{k = 2} gives the genuine AIC.
-\code{k = log(n)} is sometimes referred to as BIC or SBC. Default is 2.}
-
-\item{nvmin}{minimum size of subsets to examine for \code{"subsets"}.
-Default is 1.}
-
-\item{nvmax}{maximum size of subsets to examine for \code{"subsets"}.
-Default is 8.}
-
-\item{force.in}{index to columns of design matrix that should be in all
-models for \code{"subsets"}. Default is \code{NULL}.}
-
-\item{force.out}{index to columns of design matrix that should be in no
-models for \code{"subsets"}. Default is \code{NULL}.}
-
-\item{method}{one of "exhaustive", "forward", "backward" or "seqrep"
-(sequential replacement) to specify the type of subset search/selection.
-Required if \code{variable selection="subsets"} is chosen. Default is
-"exhaustive".}
-
-\item{really.big}{option for \code{"subsets"}; Must be \code{TRUE} to
-perform exhaustive search on more than 50 variables.}
-
-\item{type}{option for \code{"lars"}. One of "lasso", "lar",
-"forward.stagewise" or "stepwise". The names can be abbreviated to any
-unique substring. Default is "lasso".}
-
-\item{normalize}{option for \code{"lars"}. If \code{TRUE}, each variable is
-standardized to have unit L2 norm, otherwise they are left alone. Default
-is \code{TRUE}.}
-
-\item{eps}{option for \code{"lars"}; An effective zero.}
-
-\item{max.steps}{Limit the number of steps taken for \code{"lars"}; the
-default is \code{8 * min(m, n-intercept)}, with \code{m} the number of
-variables, and \code{n} the number of samples. For \code{type="lar"} or
-\code{type="stepwise"}, the maximum number of steps is
-\code{min(m,n-intercept)}. For \code{type="lasso"} and especially
-\code{type="forward.stagewise"}, there can be many more terms, because
-although no more than \code{min(m,n-intercept)} variables can be active
-during any step, variables are frequently droppped and added as the
-algorithm proceeds. Although the default usually guarantees that the
-algorithm has proceeded to the saturated fit, users should check.}
-
-\item{lars.criterion}{an option to assess model selection for the
-\code{"lars"} method; one of "Cp" or "cv". See details. Default is "Cp".}
-
-\item{K}{number of folds for computing the K-fold cross-validated mean
-squared prediction error for \code{"lars"}. Default is 10.}
-}
-\value{
-A list of the above components. This is only meant to be used by
-\code{fitTsfm}.
-}
-\description{
-Creates a list of control parameters for \code{\link{fitTsfm}}.
-All control parameters that are not passed to this function are set to
-default values. This function is meant for internal use only!!
-}
-\details{
-This control function is used to process optional arguments passed
-via \code{...} to \code{fitTsfm}. These arguments are validated and defaults
-are set if necessary before being passed internally to one of the following
-functions: \code{\link[stats]{lm}}, \code{\link[robust]{lmRob}},
-\code{\link[stats]{step}}, \code{\link[leaps]{regsubsets}},
-\code{\link[lars]{lars}} and \code{\link[lars]{cv.lars}}. See their
-respective help files for more details. The arguments to each of these
-functions are listed above in approximately the same order for user
-convenience.
-
-The scalar \code{decay} is used by \code{\link{fitTsfm}} to compute
-exponentially decaying weights for \code{fit.method="DLS"}. Alternately, one
-can directly specify \code{weights}, a weights vector, to be used with
-"OLS" or "Robust". Especially when fitting multiple assets, care should be
-taken to ensure that the length of the weights vector matches the number of
-observations (excluding cases ignored due to NAs).
-
-\code{lars.criterion} selects the criterion (one of "Cp" or "cv") to
-determine the best fitted model for \code{variable.selection="lars"}. The
-"Cp" statistic (defined in page 17 of Efron et al. (2004)) is calculated
-using \code{\link[lars]{summary.lars}}. While, "cv" computes the K-fold
-cross-validated mean squared prediction error using
-\code{\link[lars]{cv.lars}}.
-}
-\examples{
-\dontrun{
-# check argument list passed by fitTsfm.control
-tsfm.ctrl <- fitTsfm.control(method="exhaustive", nvmin=2)
-print(tsfm.ctrl)
-}
-
-# used internally by fitTsfm in the example below
-data(managers)
-fit <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
- factor.names=colnames(managers[,(7:9)]),
- data=managers, variable.selection="subsets",
- method="exhaustive", nvmin=2)
-}
-\author{
-Sangeetha Srinivasan
-}
-\references{
-Efron, B., Hastie, T., Johnstone, I., & Tibshirani, R. (2004). Least angle
-regression. The Annals of statistics, 32(2), 407-499.
-}
-\seealso{
-\code{\link{fitTsfm}}, \code{\link[stats]{lm}},
-\code{\link[robust]{lmRob}}, \code{\link[stats]{step}},
-\code{\link[leaps]{regsubsets}}, \code{\link[lars]{lars}} and
-\code{\link[lars]{cv.lars}}
-}
-
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/fitTsfm.control.R
+\name{fitTsfm.control}
+\alias{fitTsfm.control}
+\title{List of control parameters for \code{fitTsfm}}
+\usage{
+fitTsfm.control(decay = 0.95, weights, model = TRUE, x = FALSE,
+ y = FALSE, qr = TRUE, nrep = NULL, efficiency = 0.9, scope, scale,
+ direction, trace = FALSE, steps = 1000, k = 2, nvmin = 1, nvmax = 8,
+ force.in = NULL, force.out = NULL, method, really.big = FALSE, type,
+ normalize = TRUE, eps = .Machine$double.eps, max.steps,
+ lars.criterion = "Cp", K = 10)
+}
+\arguments{
+\item{decay}{a scalar in (0, 1] to specify the decay factor for "DLS".
+Default is 0.95.}
+
+\item{weights}{an optional vector of weights to be used in the fitting
+process for \code{fit.method="OLS","Robust"}, or
+\code{variable.selection="subsets"}. Should be \code{NULL} or a numeric
+vector. The length of \code{weights} must be the same as the number of
+observations. The weights must be nonnegative and it is strongly
+recommended that they be strictly positive.}
+
+\item{model,x,y,qr}{logicals passed to \code{lm} for
+\code{fit.method="OLS"}. If \code{TRUE} the corresponding components of the
+fit (the model frame, the model matrix, the response, the QR decomposition)
+are returned.}
+
+\item{nrep}{the number of random subsamples to be drawn for
+\code{fit.method="Robust"}. If the data set is small and "Exhaustive"
+resampling is being used, the value of \code{nrep} is ignored.}
+
+\item{efficiency}{the asymptotic efficiency of the final estimate for
+\code{fit.method="Robust"}. Default is 0.9.}
+
+\item{scope}{defines the range of models examined in the \code{"stepwise"}
+search. This should be either a single formula, or a list containing
+components \code{upper} and \code{lower}, both formulae. See
+\code{\link[stats]{step}} for how to specify the formulae and usage.}
+
+\item{scale}{optional parameter for \code{variable.selection="stepwise"}.
+The argument is passed to \code{\link[stats]{step}} or
+\code{\link[robust]{step.lmRob}} as appropriate.}
+
+\item{direction}{the mode of \code{"stepwise"} search, can be one of "both",
+"backward", or "forward", with a default of "both". If the \code{scope}
+argument is missing the default for \code{direction} is "backward".}
+
+\item{trace}{If positive (or, not \code{FALSE}), info is printed during the
+running of \code{\link[stats]{step}}, \code{\link[robust]{step.lmRob}},
+\code{\link[lars]{lars}} or \code{\link[lars]{cv.lars}} as relevant. Larger
+values may give more detailed information. Default is \code{FALSE}.}
+
+\item{steps}{the maximum number of steps to be considered for
+\code{"stepwise"}. Default is 1000 (essentially as many as required). It is
+typically used to stop the process early.}
+
+\item{k}{the multiple of the number of degrees of freedom used for the
+penalty in \code{"stepwise"}. Only \code{k = 2} gives the genuine AIC.
+\code{k = log(n)} is sometimes referred to as BIC or SBC. Default is 2.}
+
+\item{nvmin}{minimum size of subsets to examine for \code{"subsets"}.
+Default is 1.}
+
+\item{nvmax}{maximum size of subsets to examine for \code{"subsets"}.
+Default is 8.}
+
+\item{force.in}{index to columns of design matrix that should be in all
+models for \code{"subsets"}. Default is \code{NULL}.}
+
+\item{force.out}{index to columns of design matrix that should be in no
+models for \code{"subsets"}. Default is \code{NULL}.}
+
+\item{method}{one of "exhaustive", "forward", "backward" or "seqrep"
+(sequential replacement) to specify the type of subset search/selection.
+Required if \code{variable selection="subsets"} is chosen. Default is
+"exhaustive".}
+
+\item{really.big}{option for \code{"subsets"}; Must be \code{TRUE} to
+perform exhaustive search on more than 50 variables.}
+
+\item{type}{option for \code{"lars"}. One of "lasso", "lar",
+"forward.stagewise" or "stepwise". The names can be abbreviated to any
+unique substring. Default is "lasso".}
+
+\item{normalize}{option for \code{"lars"}. If \code{TRUE}, each variable is
+standardized to have unit L2 norm, otherwise they are left alone. Default
+is \code{TRUE}.}
+
+\item{eps}{option for \code{"lars"}; An effective zero.}
+
+\item{max.steps}{Limit the number of steps taken for \code{"lars"}; the
+default is \code{8 * min(m, n-intercept)}, with \code{m} the number of
+variables, and \code{n} the number of samples. For \code{type="lar"} or
+\code{type="stepwise"}, the maximum number of steps is
+\code{min(m,n-intercept)}. For \code{type="lasso"} and especially
+\code{type="forward.stagewise"}, there can be many more terms, because
+although no more than \code{min(m,n-intercept)} variables can be active
+during any step, variables are frequently droppped and added as the
+algorithm proceeds. Although the default usually guarantees that the
+algorithm has proceeded to the saturated fit, users should check.}
+
+\item{lars.criterion}{an option to assess model selection for the
+\code{"lars"} method; one of "Cp" or "cv". See details. Default is "Cp".}
+
+\item{K}{number of folds for computing the K-fold cross-validated mean
+squared prediction error for \code{"lars"}. Default is 10.}
+}
+\value{
+A list of the above components. This is only meant to be used by
+\code{fitTsfm}.
+}
+\description{
+Creates a list of control parameters for \code{\link{fitTsfm}}.
+All control parameters that are not passed to this function are set to
+default values. This function is meant for internal use only!!
+}
+\details{
+This control function is used to process optional arguments passed
+via \code{...} to \code{fitTsfm}. These arguments are validated and defaults
+are set if necessary before being passed internally to one of the following
+functions: \code{\link[stats]{lm}}, \code{\link[robust]{lmRob}},
+\code{\link[stats]{step}}, \code{\link[leaps]{regsubsets}},
+\code{\link[lars]{lars}} and \code{\link[lars]{cv.lars}}. See their
+respective help files for more details. The arguments to each of these
+functions are listed above in approximately the same order for user
+convenience.
+
+The scalar \code{decay} is used by \code{\link{fitTsfm}} to compute
+exponentially decaying weights for \code{fit.method="DLS"}. Alternately, one
+can directly specify \code{weights}, a weights vector, to be used with
+"OLS" or "Robust". Especially when fitting multiple assets, care should be
+taken to ensure that the length of the weights vector matches the number of
+observations (excluding cases ignored due to NAs).
+
+\code{lars.criterion} selects the criterion (one of "Cp" or "cv") to
+determine the best fitted model for \code{variable.selection="lars"}. The
+"Cp" statistic (defined in page 17 of Efron et al. (2004)) is calculated
+using \code{\link[lars]{summary.lars}}. While, "cv" computes the K-fold
+cross-validated mean squared prediction error using
+\code{\link[lars]{cv.lars}}.
+}
+\examples{
+\dontrun{
+# check argument list passed by fitTsfm.control
+tsfm.ctrl <- fitTsfm.control(method="exhaustive", nvmin=2)
+print(tsfm.ctrl)
+}
+
+# used internally by fitTsfm in the example below
+data(managers)
+fit <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
+ factor.names=colnames(managers[,(7:9)]),
+ data=managers, variable.selection="subsets",
+ method="exhaustive", nvmin=2)
+}
+\author{
+Sangeetha Srinivasan
+}
+\references{
+Efron, B., Hastie, T., Johnstone, I., & Tibshirani, R. (2004). Least angle
+regression. The Annals of statistics, 32(2), 407-499.
+}
+\seealso{
+\code{\link{fitTsfm}}, \code{\link[stats]{lm}},
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/returnanalytics -r 3619
More information about the Returnanalytics-commits
mailing list