[Returnanalytics-commits] r3571 - in pkg/FactorAnalytics: . R data man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Dec 6 07:21:17 CET 2014


Author: pragnya
Date: 2014-12-06 07:21:16 +0100 (Sat, 06 Dec 2014)
New Revision: 3571

Added:
   pkg/FactorAnalytics/data/StockReturns.RData
   pkg/FactorAnalytics/data/TreasuryYields.RData
   pkg/FactorAnalytics/man/StockReturns.Rd
   pkg/FactorAnalytics/man/TreasuryYields.Rd
Removed:
   pkg/FactorAnalytics/data/stat.fm.data.RData
   pkg/FactorAnalytics/man/stat.fm.data.Rd
Modified:
   pkg/FactorAnalytics/DESCRIPTION
   pkg/FactorAnalytics/R/Misc.R
   pkg/FactorAnalytics/R/fitSfm.R
   pkg/FactorAnalytics/R/fmCov.R
   pkg/FactorAnalytics/R/fmEsDecomp.R
   pkg/FactorAnalytics/R/fmSdDecomp.R
   pkg/FactorAnalytics/R/fmVaRDecomp.R
   pkg/FactorAnalytics/R/plot.sfm.r
   pkg/FactorAnalytics/R/predict.sfm.r
   pkg/FactorAnalytics/R/print.sfm.r
   pkg/FactorAnalytics/R/summary.sfm.r
   pkg/FactorAnalytics/man/fitSfm.Rd
   pkg/FactorAnalytics/man/fmCov.Rd
   pkg/FactorAnalytics/man/fmEsDecomp.Rd
   pkg/FactorAnalytics/man/fmSdDecomp.Rd
   pkg/FactorAnalytics/man/fmVaRDecomp.Rd
   pkg/FactorAnalytics/man/plot.sfm.Rd
   pkg/FactorAnalytics/man/predict.sfm.Rd
   pkg/FactorAnalytics/man/print.sfm.Rd
   pkg/FactorAnalytics/man/summary.sfm.Rd
   pkg/FactorAnalytics/vignettes/FA.bib
   pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw
   pkg/FactorAnalytics/vignettes/fitTsfm_vignette.pdf
Log:
Added TreasuryYields data. Renamed stat.fm.data to StockReturns

Modified: pkg/FactorAnalytics/DESCRIPTION
===================================================================
--- pkg/FactorAnalytics/DESCRIPTION	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/DESCRIPTION	2014-12-06 06:21:16 UTC (rev 3571)
@@ -1,8 +1,8 @@
 Package: factorAnalytics
 Type: Package
 Title: Factor Analytics
-Version: 2.0.6
-Date: 2014-12-04
+Version: 2.0.7
+Date: 2014-12-05
 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/Misc.R
===================================================================
--- pkg/FactorAnalytics/R/Misc.R	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/Misc.R	2014-12-06 06:21:16 UTC (rev 3571)
@@ -11,7 +11,7 @@
 #' @importFrom lars lars cv.lars
 #' @importFrom lmtest coeftest.default
 #' @importFrom sandwich vcovHC.default vcovHAC.default
-#' @importFrom lattice barchart panel.barchart panel.grid
+#' @importFrom lattice barchart panel.barchart panel.grid xyplot
 #' @importFrom corrplot corrplot
 #' @importFrom strucchange efp
 #' @importFrom MASS ginv 
\ No newline at end of file

Modified: pkg/FactorAnalytics/R/fitSfm.R
===================================================================
--- pkg/FactorAnalytics/R/fitSfm.R	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/fitSfm.R	2014-12-06 06:21:16 UTC (rev 3571)
@@ -1,9 +1,9 @@
 #' @title Fit a statistical factor model using principal component analysis
 #' 
-#' @description Fits a statistical factor model using principal component 
-#' analysis for one or more asset returns or excess returns. When the number of 
-#' assets exceeds the number of time periods, APCA (Asymptotic Principal 
-#' Component Analysis) is performed. An object of class \code{"sfm"} is 
+#' @description Fits a statistical factor model using Principal Component 
+#' Analysis (PCA) for one or more asset returns or excess returns. When the 
+#' number of assets exceeds the number of time periods, Asymptotic Principal 
+#' Component Analysis (APCA) is performed. An object of class \code{"sfm"} is 
 #' returned. This function is based on the S+FinMetric function \code{mfactor}.
 #' 
 #' @details
@@ -119,17 +119,19 @@
 #' 
 #' @examples
 #' 
-#' # load data for fitSfm.r
-#' data(stat.fm.data)
-#' # data is from finmetric berndt.dat and folio.dat
+#' # load return data
+#' data(StockReturns)
 #' 
-#' # PCA is performed on sfm.dat and APCA on sfm.apca.dat
-#' class(sfm.dat)
-#' class(sfm.apca.dat)
+#' # PCA is performed on r.M and APCA on r.W
+#' class(r.M)
+#' dim(r.M)
+#' range(rownames(r.M))
+#' class(r.W)
+#' dim(r.W)
 #' 
 #' # PCA
 #' args(fitSfm)
-#' fit.pca <- fitSfm(sfm.dat, k=2)
+#' fit.pca <- fitSfm(r.M, k=2)
 #' class(fit.pca)
 #' names(fit.pca)
 #' head(fit.pca$factors)
@@ -139,13 +141,13 @@
 #' fit.pca$mimic
 #' 
 #' # APCA with number of factors, k=15
-#' fit.apca <- fitSfm(sfm.apca.dat, k=15, refine=TRUE)
+#' fit.apca <- fitSfm(r.W, k=15, refine=TRUE)
 #' 
 #' # APCA with the Bai & Ng method
-#' fit.apca.bn <- fitSfm(sfm.apca.dat, k="bn")
+#' fit.apca.bn <- fitSfm(r.W, k="bn")
 #' 
 #' # APCA with the Connor-Korajczyk method
-#' fit.apca.ck <- fitSfm(sfm.apca.dat, k="ck")
+#' fit.apca.ck <- fitSfm(r.W, k="ck")
 #' 
 #' @importFrom PerformanceAnalytics checkData
 #' 

Modified: pkg/FactorAnalytics/R/fmCov.R
===================================================================
--- pkg/FactorAnalytics/R/fmCov.R	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/fmCov.R	2014-12-06 06:21:16 UTC (rev 3571)
@@ -53,8 +53,8 @@
 #' fmCov(fit)
 #' 
 #' # Statistical Factor Model
-#' data(stat.fm.data)
-#' sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+#' data(StockReturns)
+#' sfm.pca.fit <- fitSfm(r.M, k=2)
 #' fmCov(sfm.pca.fit)
 #'                       
 #' \dontrun{

Modified: pkg/FactorAnalytics/R/fmEsDecomp.R
===================================================================
--- pkg/FactorAnalytics/R/fmEsDecomp.R	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/fmEsDecomp.R	2014-12-06 06:21:16 UTC (rev 3571)
@@ -77,8 +77,8 @@
 #' ES.decomp$cES
 #' 
 #' # Statistical Factor Model
-#' data(stat.fm.data)
-#' sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+#' data(StockReturns)
+#' sfm.pca.fit <- fitSfm(r.M, k=2)
 #' ES.decomp <- fmEsDecomp(sfm.pca.fit)
 #' ES.decomp$cES
 #' 

Modified: pkg/FactorAnalytics/R/fmSdDecomp.R
===================================================================
--- pkg/FactorAnalytics/R/fmSdDecomp.R	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/fmSdDecomp.R	2014-12-06 06:21:16 UTC (rev 3571)
@@ -64,8 +64,8 @@
 #' decomp$pcSd
 #' 
 #' # Statistical Factor Model
-#' data(stat.fm.data)
-#' sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+#' data(StockReturns)
+#' sfm.pca.fit <- fitSfm(r.M, k=2)
 #' decomp <- fmSdDecomp(sfm.pca.fit)
 #' decomp$pcSd
 #'  

Modified: pkg/FactorAnalytics/R/fmVaRDecomp.R
===================================================================
--- pkg/FactorAnalytics/R/fmVaRDecomp.R	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/fmVaRDecomp.R	2014-12-06 06:21:16 UTC (rev 3571)
@@ -74,8 +74,8 @@
 #' VaR.decomp$cVaR
 #' 
 #' # Statistical Factor Model
-#' data(stat.fm.data)
-#' sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+#' data(StockReturns)
+#' sfm.pca.fit <- fitSfm(r.M, k=2)
 #' VaR.decomp <- fmVaRDecomp(sfm.pca.fit)
 #' VaR.decomp$cVaR
 #' 

Modified: pkg/FactorAnalytics/R/plot.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/plot.sfm.r	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/plot.sfm.r	2014-12-06 06:21:16 UTC (rev 3571)
@@ -101,10 +101,10 @@
 #' @examples
 #' 
 #' # load data from the database
-#' data(stat.fm.data)
+#' data(StockReturns)
 #' 
 #' # APCA with number of factors, k=15
-#' fit.apca <- fitSfm(sfm.apca.dat, k=15, refine=TRUE)
+#' fit.apca <- fitSfm(r.W, k=15, refine=TRUE)
 #' 
 #' # group plot(default); select type from menu prompt
 #' # menu is auto-looped to get multiple types of plots based on the same fit

Modified: pkg/FactorAnalytics/R/predict.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/predict.sfm.r	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/predict.sfm.r	2014-12-06 06:21:16 UTC (rev 3571)
@@ -17,12 +17,12 @@
 #' 
 #' @examples
 #' # load data from the database
-#' data(stat.fm.data)
+#' data(StockReturns)
 #' # fit the factor model with PCA
-#' fit <- fitSfm(sfm.dat, k=2)
+#' fit <- fitSfm(r.M, k=2)
 #' 
 #' pred.fit <- predict(fit)
-#' newdata <- data.frame("EDHEC LS EQ"=rnorm(n=120), "SP500 TR"=rnorm(n=120))
+#' newdata <- data.frame("CITCRP"=rnorm(n=120), "CONED"=rnorm(n=120))
 #' rownames(newdata) <- rownames(fit$data)
 #' pred.fit2 <- predict(fit, newdata, interval="confidence")
 #' 

Modified: pkg/FactorAnalytics/R/print.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/print.sfm.r	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/print.sfm.r	2014-12-06 06:21:16 UTC (rev 3571)
@@ -14,8 +14,8 @@
 #' @seealso \code{\link{fitSfm}}, \code{\link{summary.sfm}}
 #' 
 #' @examples
-#' data(stat.fm.data)
-#' fit <- fitSfm(sfm.dat, k=2)
+#' data(StockReturns)
+#' fit <- fitSfm(r.M, k=2)
 #' print(fit)
 #' 
 #' @method print sfm

Modified: pkg/FactorAnalytics/R/summary.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/summary.sfm.r	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/R/summary.sfm.r	2014-12-06 06:21:16 UTC (rev 3571)
@@ -35,9 +35,9 @@
 #' @seealso \code{\link{fitSfm}}, \code{\link[stats]{summary.lm}}
 #' 
 #' @examples
-#' data(stat.fm.data)
+#' data(StockReturns)
 #' # fit the factor model with PCA
-#' fit <- fitSfm(sfm.dat, k=2)
+#' fit <- fitSfm(r.M, k=2)
 #' 
 #' # summary of factor model fit for all assets
 #' summary(fit, "HAC")

Added: pkg/FactorAnalytics/data/StockReturns.RData
===================================================================
(Binary files differ)


Property changes on: pkg/FactorAnalytics/data/StockReturns.RData
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/FactorAnalytics/data/TreasuryYields.RData
===================================================================
(Binary files differ)


Property changes on: pkg/FactorAnalytics/data/TreasuryYields.RData
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: pkg/FactorAnalytics/data/stat.fm.data.RData
===================================================================
(Binary files differ)

Added: pkg/FactorAnalytics/man/StockReturns.Rd
===================================================================
--- pkg/FactorAnalytics/man/StockReturns.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/StockReturns.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -0,0 +1,53 @@
+\name{StockReturns}
+\alias{StockReturns}
+\alias{r.M}
+\alias{r.W}
+\docType{data}
+\title{Stock Return Data}
+\description{
+\code{r.M}: A "data.frame" object with monthly returns (ranging from January 1978 to December 1987) for 15 assets whose names are given in the 'Details'.
+  
+\code{r.W}: A "data.frame" object with weekly returns (ranging from January 8, 1997 to June 28, 2000) for 1618 U.S. stocks.
+}
+\details{
+The 15 assets in \code{r.M} are as follows:
+  CITCRP monthly returns of Citicorp.  
+  CONED monthly returns of Consolidated Edison.  
+  CONTIL monthly returns of Continental Illinois.  
+  DATGEN monthly returns of Data General.  
+  DEC monthly returns of Digital Equipment Company. 
+  DELTA monthly returns of Delta Airlines.  
+  GENMIL monthly returns of General Mills.  
+  GERBER monthly returns of Gerber.  
+  IBM monthly returns of International Business Machines.  
+  MARKET a value-weighted composite monthly returns based on transactions from the New York Stock Exchange and the American Exchange.  
+  MOBIL monthly returns of Mobile.  
+  PANAM monthly returns of Pan American Airways.  
+  PSNH monthly returns of Public Service of New Hampshire.  
+  TANDY monthly returns of Tandy.  
+  TEXACO monthly returns of Texaco.  
+  WEYER monthly returns of Weyerhauser.  
+  RKFREE monthly returns on 30-day U.S. Treasury bills.
+}
+\usage{data(StockReturns)}
+\format{
+data.frame object
+\describe{
+    \item{\code{r.M}}{monthly from Jan-1998 through Dec-1987}
+    \item{\code{r.W}}{weekly from Jan-08-1997 through Jun-28-2000}
+  }
+}
+\source{
+  S+FinMetrics Berndt.dat & folio.dat
+}
+\references{
+Berndt, E. R. (1991). The practice of econometrics: classic and contemporary. Reading, MA: Addison-Wesley.
+}
+\examples{
+data(StockReturns)
+dim(r.M)
+range(rownames(r.M))
+dim(r.W)
+range(rownames(r.W))
+}
+\keyword{datasets}

Added: pkg/FactorAnalytics/man/TreasuryYields.Rd
===================================================================
--- pkg/FactorAnalytics/man/TreasuryYields.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/TreasuryYields.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -0,0 +1,37 @@
+\name{TreasuryYields}
+\alias{TreasuryYields}
+\alias{tr.yields}
+\docType{data}
+\title{
+Treasury yields at different maturities
+}
+\description{
+The following is adapted from chapter 17 of Ruppert (2010).
+
+The data object contains yields on Treasury bonds at 11 maturities, T = 1, 3, and 6 months and 1, 2, 3, 5, 7, 10, 20, and 30 years. Daily yields were taken from a U.S. Treasury website for the time period January 2, 1990, to October 31, 2008.
+
+Daily yields were missing from some values of T because, for example to quote the website, "Treasury discontinued the 20-year constant maturity series at the
+end of calendar year 1986 and reinstated that series on October 1, 1993." Dif-
+ferencing may cause a few additional days to have missing values.
+}
+\usage{data(TreasuryYields)}
+\format{
+xts time series object
+\describe{
+    \item{\code{tr.yields}}{Jan-02-1990 through Oct-31-2008}
+  }
+}
+\source{
+SDAFE author's website: \url{http://people.orie.cornell.edu/davidr/SDAFE/index.html}
+}
+\references{
+Ruppert, D. (2010). Statistics and data analysis for financial engineering. Springer.
+}
+\examples{
+data(TreasuryYields)
+# preview the data
+head(tr.yields)
+}
+\keyword{datasets}
+\keyword{ts}
+

Modified: pkg/FactorAnalytics/man/fitSfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitSfm.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/fitSfm.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -76,10 +76,10 @@
 \item{asset.ret}{N x T matrix of fitted asset returns from the factor model.}
 }
 \description{
-Fits a statistical factor model using principal component
-analysis for one or more asset returns or excess returns. When the number of
-assets exceeds the number of time periods, APCA (Asymptotic Principal
-Component Analysis) is performed. An object of class \code{"sfm"} is
+Fits a statistical factor model using Principal Component
+Analysis (PCA) for one or more asset returns or excess returns. When the
+number of assets exceeds the number of time periods, Asymptotic Principal
+Component Analysis (APCA) is performed. An object of class \code{"sfm"} is
 returned. This function is based on the S+FinMetric function \code{mfactor}.
 }
 \details{
@@ -118,17 +118,19 @@
 factor realizations are inverted to enable more meaningful interpretation.
 }
 \examples{
-# load data for fitSfm.r
-data(stat.fm.data)
-# data is from finmetric berndt.dat and folio.dat
+# load return data
+data(StockReturns)
 
-# PCA is performed on sfm.dat and APCA on sfm.apca.dat
-class(sfm.dat)
-class(sfm.apca.dat)
+# PCA is performed on r.M and APCA on r.W
+class(r.M)
+dim(r.M)
+range(rownames(r.M))
+class(r.W)
+dim(r.W)
 
 # PCA
 args(fitSfm)
-fit.pca <- fitSfm(sfm.dat, k=2)
+fit.pca <- fitSfm(r.M, k=2)
 class(fit.pca)
 names(fit.pca)
 head(fit.pca$factors)
@@ -138,13 +140,13 @@
 fit.pca$mimic
 
 # APCA with number of factors, k=15
-fit.apca <- fitSfm(sfm.apca.dat, k=15, refine=TRUE)
+fit.apca <- fitSfm(r.W, k=15, refine=TRUE)
 
 # APCA with the Bai & Ng method
-fit.apca.bn <- fitSfm(sfm.apca.dat, k="bn")
+fit.apca.bn <- fitSfm(r.W, k="bn")
 
 # APCA with the Connor-Korajczyk method
-fit.apca.ck <- fitSfm(sfm.apca.dat, k="ck")
+fit.apca.ck <- fitSfm(r.W, k="ck")
 }
 \author{
 Eric Zivot, Sangeetha Srinivasan and Yi-An Chen

Modified: pkg/FactorAnalytics/man/fmCov.Rd
===================================================================
--- pkg/FactorAnalytics/man/fmCov.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/fmCov.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -59,8 +59,8 @@
 fmCov(fit)
 
 # Statistical Factor Model
-data(stat.fm.data)
-sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+data(StockReturns)
+sfm.pca.fit <- fitSfm(r.M, k=2)
 fmCov(sfm.pca.fit)
 
 \dontrun{

Modified: pkg/FactorAnalytics/man/fmEsDecomp.Rd
===================================================================
--- pkg/FactorAnalytics/man/fmEsDecomp.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/fmEsDecomp.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -75,8 +75,8 @@
 ES.decomp$cES
 
 # Statistical Factor Model
-data(stat.fm.data)
-sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+data(StockReturns)
+sfm.pca.fit <- fitSfm(r.M, k=2)
 ES.decomp <- fmEsDecomp(sfm.pca.fit)
 ES.decomp$cES
 }

Modified: pkg/FactorAnalytics/man/fmSdDecomp.Rd
===================================================================
--- pkg/FactorAnalytics/man/fmSdDecomp.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/fmSdDecomp.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -61,8 +61,8 @@
 decomp$pcSd
 
 # Statistical Factor Model
-data(stat.fm.data)
-sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+data(StockReturns)
+sfm.pca.fit <- fitSfm(r.M, k=2)
 decomp <- fmSdDecomp(sfm.pca.fit)
 decomp$pcSd
 }

Modified: pkg/FactorAnalytics/man/fmVaRDecomp.Rd
===================================================================
--- pkg/FactorAnalytics/man/fmVaRDecomp.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/fmVaRDecomp.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -75,8 +75,8 @@
 VaR.decomp$cVaR
 
 # Statistical Factor Model
-data(stat.fm.data)
-sfm.pca.fit <- fitSfm(sfm.dat, k=2)
+data(StockReturns)
+sfm.pca.fit <- fitSfm(r.M, k=2)
 VaR.decomp <- fmVaRDecomp(sfm.pca.fit)
 VaR.decomp$cVaR
 }

Modified: pkg/FactorAnalytics/man/plot.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/plot.sfm.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/plot.sfm.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -106,10 +106,10 @@
 }
 \examples{
 # load data from the database
-data(stat.fm.data)
+data(StockReturns)
 
 # APCA with number of factors, k=15
-fit.apca <- fitSfm(sfm.apca.dat, k=15, refine=TRUE)
+fit.apca <- fitSfm(r.W, k=15, refine=TRUE)
 
 # group plot(default); select type from menu prompt
 # menu is auto-looped to get multiple types of plots based on the same fit

Modified: pkg/FactorAnalytics/man/predict.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/predict.sfm.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/predict.sfm.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -22,12 +22,12 @@
 }
 \examples{
 # load data from the database
-data(stat.fm.data)
+data(StockReturns)
 # fit the factor model with PCA
-fit <- fitSfm(sfm.dat, k=2)
+fit <- fitSfm(r.M, k=2)
 
 pred.fit <- predict(fit)
-newdata <- data.frame("EDHEC LS EQ"=rnorm(n=120), "SP500 TR"=rnorm(n=120))
+newdata <- data.frame("CITCRP"=rnorm(n=120), "CONED"=rnorm(n=120))
 rownames(newdata) <- rownames(fit$data)
 pred.fit2 <- predict(fit, newdata, interval="confidence")
 }

Modified: pkg/FactorAnalytics/man/print.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/print.sfm.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/print.sfm.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -19,8 +19,8 @@
 volatilities from the fitted object.
 }
 \examples{
-data(stat.fm.data)
-fit <- fitSfm(sfm.dat, k=2)
+data(StockReturns)
+fit <- fitSfm(r.M, k=2)
 print(fit)
 }
 \author{

Deleted: pkg/FactorAnalytics/man/stat.fm.data.Rd
===================================================================
--- pkg/FactorAnalytics/man/stat.fm.data.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/stat.fm.data.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -1,42 +0,0 @@
-\docType{data}
-\name{stat.fm.data}
-\alias{sfm.apca.dat}
-\alias{sfm.dat}
-\alias{stat.fm.data}
-\title{Monthly Stock Return Data || Portfolio of Weekly Stock Returns}
-\source{
-  S+FinMetrics Berndt.dat & folio.dat
-}
-\description{
-  sfm.dat: This is a monthly "data.frame" object from
-  January 1978 to December 1987, with seventeen columns
-  representing monthly returns of certain assets, as in
-  Chapter 2 of Berndt (1991).  sfm.apca.dat: This is a
-  weekly "data.frame" object with dimension 182 x 1618,
-  which runs from January 8, 1997 to June 28, 2000 and
-  represents the stock returns on 1618 U.S. stocks.
-}
-\details{
-  CITCRP monthly returns of Citicorp.  CONED monthly
-  returns of Consolidated Edison.  CONTIL monthly returns
-  of Continental Illinois.  DATGEN monthly returns of Data
-  General.  DEC monthly returns of Digital Equipment
-  Company. DELTA monthly returns of Delta Airlines.  GENMIL
-  monthly returns of General Mills.  GERBER monthly returns
-  of Gerber.  IBM monthly returns of International Business
-  Machines.  MARKET a value-weighted composite monthly
-  returns based on transactions from the New York Stock
-  Exchange and the American Exchange.  MOBIL monthly
-  returns of Mobile.  PANAM monthly returns of Pan American
-  Airways.  PSNH monthly returns of Public Service of New
-  Hampshire.  TANDY monthly returns of Tandy.  TEXACO
-  monthly returns of Texaco.  WEYER monthly returns of
-  Weyerhauser.  RKFREE monthly returns on 30-day U.S.
-  Treasury bills.
-}
-\references{
-  Berndt, E. R. (1991). The Practice of Econometrics:
-  Classic and Contemporary. Addison-Wesley Publishing Co.
-}
-\keyword{datasets}
-

Modified: pkg/FactorAnalytics/man/summary.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/summary.sfm.Rd	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/man/summary.sfm.Rd	2014-12-06 06:21:16 UTC (rev 3571)
@@ -47,9 +47,9 @@
 t-statistics using \code{\link[lmtest]{coeftest}}.
 }
 \examples{
-data(stat.fm.data)
+data(StockReturns)
 # fit the factor model with PCA
-fit <- fitSfm(sfm.dat, k=2)
+fit <- fitSfm(r.M, k=2)
 
 # summary of factor model fit for all assets
 summary(fit, "HAC")

Modified: pkg/FactorAnalytics/vignettes/FA.bib
===================================================================
--- pkg/FactorAnalytics/vignettes/FA.bib	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/vignettes/FA.bib	2014-12-06 06:21:16 UTC (rev 3571)
@@ -9,6 +9,13 @@
   publisher={Wiley Online Library}
 }
 
+ at book{berndt1991practice,
+  title={The practice of econometrics: classic and contemporary},
+  author={Berndt, Ernst R},
+  year={1991},
+  publisher={Addison-Wesley Reading, MA}
+}
+
 @article{chen1986economic,
   title={Economic forces and the stock market},
   author={Chen, Nai-Fu and Roll, Richard and Ross, Stephen A},
@@ -116,6 +123,13 @@
   publisher={RISK MAGAZINE LIMITED}
 }
 
+ at book{ruppert2010statistics,
+  title={Statistics and data analysis for financial engineering},
+  author={Ruppert, David},
+  year={2010},
+  publisher={Springer}
+}
+
 @article{sharpe1964capital,
   title={Capital asset prices: A theory of market equilibrium under conditions of risk*},
   author={Sharpe, William F},

Modified: pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw
===================================================================
--- pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw	2014-12-05 20:52:29 UTC (rev 3570)
+++ pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw	2014-12-06 06:21:16 UTC (rev 3571)
@@ -53,27 +53,27 @@
 
 \begin{itemize}
 
-\item \verb"fitTsfm(asset.names, factor.names, data, fit.method, variable.selection)": Fits a time series (a.k.a. macroeconomic) factor model for one or more asset returns or excess returns using time series regression. Ordinary least squares (OLS), discounted least squares (DLS) and robust regression fitting are possible. Variable selection methods include "stepwise", "subsets" and "lars". An object of class "tsfm" containing the fitted objects, model coefficients, R-squared and residual volatility is returned.
+\item \verb"fitTsfm(asset.names, factor.names, data, fit.method, variable.selection, ...)": Fits a time series (a.k.a. macroeconomic) factor model for one or more asset returns or excess returns using time series regression. Ordinary least squares (OLS), discounted least squares (DLS) and robust regression fitting are possible. Variable selection methods include "stepwise", "subsets" and "lars". An object of class "tsfm" containing the fitted objects, model coefficients, R-squared and residual volatility is returned.
 
-\item \verb"coef(object)": Extracts the coefficient matrix (intercept and factor betas) for all assets fit by the "tsfm" object.
+\item \verb"coef(object, ...)": Extracts the coefficient matrix (intercept and factor betas) for all assets fit by the "tsfm" object.
 
-\item \verb"fitted(object)": Returns an "xts" data object of fitted asset returns from the factor model for all assets.
+\item \verb"fitted(object, ...)": Returns an "xts" data object of fitted asset returns from the factor model for all assets.
 
-\item \verb"residuals(object)": Returns an "xts" data object of residuals from the fitted factor model for all assets.
+\item \verb"residuals(object, ...)": Returns an "xts" data object of residuals from the fitted factor model for all assets.
 
-\item \verb"fmCov(object, use)": Returns the \code{N x N} symmetric covariance matrix for asset returns based on the fitted factor model. \code{"use"} specifies how missing values are to be handled.
+\item \verb"fmCov(object, use, ...)": Returns the \code{N x N} symmetric covariance matrix for asset returns based on the fitted factor model. \code{"use"} specifies how missing values are to be handled.
 
-\item \verb"fmSdDecomp(object, use)": Returns a list containing the standard deviation of asset returns based on the fitted factor model and the marginal, component and percentage component factor contributions estimated from the given sample. \code{"use"} specifies how missing values are to be handled.
+\item \verb"fmSdDecomp(object, use, ...)": Returns a list containing the standard deviation of asset returns based on the fitted factor model and the marginal, component and percentage component factor contributions estimated from the given sample. \code{"use"} specifies how missing values are to be handled.
 
-\item \verb"fmVaRDecomp(object, p, method, invert)": Returns a list containing the value-at-risk for asset returns based on the fitted factor model and the marginal, component and percentage component factor contributions estimated from the given sample. \code{"p"} and \code{"method"} specify the confidence level and method (one of "modified","gaussian", "historical" or "kernel") to calculate  VaR. VaR is by default a positive quantity and specifying \code{"invert=TRUE"} allows the VaR value to be expressed as a negative quantity. These 3 arguments, \code{"p"}, \code{"method"} and \code{"invert"} are passed on to the \code{VaR} function in the \code{PerformanceAnalytics} package to calculate VaR.
+\item \verb"fmVaRDecomp(object, p, method, invert, ...)": Returns a list containing the value-at-risk for asset returns based on the fitted factor model and the marginal, component and percentage component factor contributions estimated from the given sample. \code{"p"} and \code{"method"} specify the confidence level and method (one of "modified","gaussian", "historical" or "kernel") to calculate  VaR. VaR is by default a positive quantity and specifying \code{"invert=TRUE"} allows the VaR value to be expressed as a negative quantity. These 3 arguments, \code{"p"}, \code{"method"} and \code{"invert"} are passed on to the \code{VaR} function in the \code{PerformanceAnalytics} package to calculate VaR.
 
-\item \verb"fmEsDecomp(object, p, method, invert)": Returns a list containing the expected shortfall for asset returns based on the fitted factor model and the marginal, component and percentage component factor contributions estimated from the given sample. Arguments \code{"p"}, \code{"method"} and \code{invert} are the same as above.
+\item \verb"fmEsDecomp(object, p, method, invert, ...)": Returns a list containing the expected shortfall for asset returns based on the fitted factor model and the marginal, component and percentage component factor contributions estimated from the given sample. Arguments \code{"p"}, \code{"method"} and \code{invert} are the same as above.
 
 \item \verb"plot(x)": The \code{plot} method for class "tsfm" can be used for plotting factor model characteristics of an individual asset or a group of assets (default). The type of individual/group plot can be specified or chosen from a menu prompt, which is the default if type is not specified. Further the menu reappears (default) to access multiple plots for the same asset(s) unless looping is disabled by setting \code{loop=FALSE}.
 
-\item \verb"predict(object, newdata)": The \code{predict} method for class "tsfm" returns a vector or matrix of predicted values for a new data sample or simulated values.
+\item \verb"predict(object, newdata, ...)": The \code{predict} method for class "tsfm" returns a vector or matrix of predicted values for a new data sample or simulated values.
 
-\item \verb"summary(object, se.type)": The \code{summary} method for class "tsfm" returns an object of class \code{"summary.tsfm"} containing the summaries of the fitted "lm", "lmRob" or "lars" objects and the chosen type (HC/HAC) of standard errors and t-statistics to display. Printing the factor model summary object outputs the call, coefficients (with standard errors and t-statistics), r-squared and residual volatility (under the homo-skedasticity assumption) for all assets. 
+\item \verb"summary(object, se.type, ...)": The \code{summary} method for class "tsfm" returns an object of class \code{"summary.tsfm"} containing the summaries of the fitted "lm", "lmRob" or "lars" objects and the chosen type (HC/HAC) of standard errors and t-statistics to display. Printing the factor model summary object outputs the call, coefficients (with standard errors and t-statistics), r-squared and residual volatility (under the homo-skedasticity assumption) for all assets. 
 
 \end{itemize}
 

Modified: pkg/FactorAnalytics/vignettes/fitTsfm_vignette.pdf
===================================================================
(Binary files differ)



More information about the Returnanalytics-commits mailing list