[Returnanalytics-commits] r3995 - / pkg/FactorAnalytics pkg/FactorAnalytics/R pkg/FactorAnalytics/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 16 15:22:45 CEST 2015


Author: pragnya
Date: 2015-09-16 15:22:44 +0200 (Wed, 16 Sep 2015)
New Revision: 3995

Modified:
   pkg/FactorAnalytics/DESCRIPTION
   pkg/FactorAnalytics/NAMESPACE
   pkg/FactorAnalytics/R/fitSfm.R
   pkg/FactorAnalytics/R/fitTsfm.R
   pkg/FactorAnalytics/R/zzz.R
   pkg/FactorAnalytics/man/Stock.df.Rd
   returnanalytics.Rproj
Log:
Add fitFfm for fitting fundamental factor models

Modified: pkg/FactorAnalytics/DESCRIPTION
===================================================================
--- pkg/FactorAnalytics/DESCRIPTION	2015-09-15 06:23:49 UTC (rev 3994)
+++ pkg/FactorAnalytics/DESCRIPTION	2015-09-16 13:22:44 UTC (rev 3995)
@@ -1,8 +1,8 @@
 Package: factorAnalytics
 Type: Package
 Title: Factor Analytics
-Version: 2.0.26
-Date: 2015-09-14
+Version: 2.0.27
+Date: 2015-09-16
 Author: Eric Zivot, Sangeetha Srinivasan and Yi-An Chen
 Maintainer: Sangeetha Srinivasan <sangee at uw.edu>
 Description: Linear factor model fitting for asset returns (three major types- 
@@ -15,11 +15,13 @@
 Depends:
     R (>= 3.0.0),
     xts (>= 0.9),
-    foreach (>= 1.4)
+    foreach (>= 1.4),
+    rrcov
 Imports: 
     PerformanceAnalytics(>= 1.4),
     zoo,
-    corrplot,  
+    corrplot,
+    robustbase,
     robust, 
     leaps, 
     lars,

Modified: pkg/FactorAnalytics/NAMESPACE
===================================================================
--- pkg/FactorAnalytics/NAMESPACE	2015-09-15 06:23:49 UTC (rev 3994)
+++ pkg/FactorAnalytics/NAMESPACE	2015-09-16 13:22:44 UTC (rev 3995)
@@ -1,7 +1,9 @@
 # Generated by roxygen2 (4.1.1): do not edit by hand
 
+S3method(coef,ffm)
 S3method(coef,sfm)
 S3method(coef,tsfm)
+S3method(fitted,ffm)
 S3method(fitted,sfm)
 S3method(fitted,tsfm)
 S3method(fmCov,sfm)
@@ -26,6 +28,7 @@
 S3method(print,summary.tsfmUpDn)
 S3method(print,tsfm)
 S3method(print,tsfmUpDn)
+S3method(residuals,ffm)
 S3method(residuals,sfm)
 S3method(residuals,tsfm)
 S3method(summary,pafm)
@@ -33,6 +36,7 @@
 S3method(summary,tsfm)
 S3method(summary,tsfmUpDn)
 export(dCornishFisher)
+export(fitFfm)
 export(fitSfm)
 export(fitTsfm)
 export(fitTsfmLagBeta)
@@ -50,6 +54,7 @@
 export(qCornishFisher)
 export(rCornishFisher)
 import(foreach)
+import(rrcov)
 import(xts)
 import(zoo)
 importFrom(MASS,ginv)
@@ -78,8 +83,12 @@
 importFrom(parallel,detectCores)
 importFrom(parallel,makeCluster)
 importFrom(parallel,stopCluster)
+importFrom(robust,covClassic)
+importFrom(robust,covRob)
 importFrom(robust,lmRob)
 importFrom(robust,step.lmRob)
+importFrom(robustbase,covOGK)
+importFrom(robustbase,scaleTau2)
 importFrom(sandwich,vcovHAC.default)
 importFrom(sandwich,vcovHC.default)
 importFrom(sn,dst)

Modified: pkg/FactorAnalytics/R/fitSfm.R
===================================================================
--- pkg/FactorAnalytics/R/fitSfm.R	2015-09-15 06:23:49 UTC (rev 3994)
+++ pkg/FactorAnalytics/R/fitSfm.R	2015-09-16 13:22:44 UTC (rev 3995)
@@ -155,7 +155,7 @@
                    corr=FALSE, ...) {
   
   # record the call as an element to be returned
-  call <- match.call()  
+  this.call <- match.call()  
   
   # check input data type and coerce to xts; remove NAs
   R.xts <- na.omit(checkData(data, method="xts"))
@@ -221,7 +221,7 @@
   }
   
   # create list of return values.
-  input <- list(call=call, data=R.xts, asset.names=colnames(R.xts))
+  input <- list(call=this.call, data=R.xts, asset.names=colnames(R.xts))
   result <- c(result, input)
   class(result) <- "sfm"
   return(result)

Modified: pkg/FactorAnalytics/R/fitTsfm.R
===================================================================
--- pkg/FactorAnalytics/R/fitTsfm.R	2015-09-15 06:23:49 UTC (rev 3994)
+++ pkg/FactorAnalytics/R/fitTsfm.R	2015-09-16 13:22:44 UTC (rev 3995)
@@ -155,7 +155,7 @@
                     control=fitTsfm.control(...), ...) {
   
   # record the call as an element to be returned
-  call <- match.call()
+  this.call <- match.call()
   
   # set defaults and check input vailidity
   fit.method = fit.method[1]
@@ -230,7 +230,7 @@
   } else if (variable.selection == "lars") {
     result.lars <- SelectLars(dat.xts, asset.names, factor.names, lars.args, 
                               cv.lars.args, lars.criterion)
-    input <- list(call=call, data=dat.xts, asset.names=asset.names, 
+    input <- list(call=this.call, data=dat.xts, asset.names=asset.names, 
                   factor.names=factor.names, mkt.name=mkt.name, fit.method=NULL, 
                   variable.selection=variable.selection)
     result <- c(result.lars, input)
@@ -251,10 +251,14 @@
   rownames(beta) <- asset.names
   # extract r2 and residual sd
   r2 <- sapply(reg.list, function(x) summary(x)$r.squared)
-  resid.sd <- sapply(reg.list, function(x) summary(x)$sigma)
+  if (fit.method=="DLS") {
+    resid.sd <- sapply(reg.list, function(x) sd(residuals(x)))
+  } else {
+    resid.sd <- sapply(reg.list, function(x) summary(x)$sigma)
+  }
   # create list of return values.
   result <- list(asset.fit=reg.list, alpha=alpha, beta=beta, r2=r2, 
-                 resid.sd=resid.sd, call=call, data=dat.xts, 
+                 resid.sd=resid.sd, call=this.call, data=dat.xts, 
                  asset.names=asset.names, factor.names=factor.names, 
                  mkt.name=mkt.name, fit.method=fit.method, 
                  variable.selection=variable.selection)

Modified: pkg/FactorAnalytics/R/zzz.R
===================================================================
--- pkg/FactorAnalytics/R/zzz.R	2015-09-15 06:23:49 UTC (rev 3994)
+++ pkg/FactorAnalytics/R/zzz.R	2015-09-16 13:22:44 UTC (rev 3995)
@@ -1,15 +1,17 @@
 #' @import xts
 #' @import zoo
 #' @import foreach
+#' @import rrcov
 
 #' @importFrom PerformanceAnalytics checkData Return.cumulative 
-#' @importFrom robust lmRob step.lmRob
+#' @importFrom robust lmRob step.lmRob covRob covClassic
 #' @importFrom leaps regsubsets
 #' @importFrom lars lars cv.lars
 #' @importFrom lmtest coeftest.default
 #' @importFrom sandwich vcovHC.default vcovHAC.default
 #' @importFrom MASS ginv
 #' @importFrom tseries tsbootstrap
+#' @importFrom robustbase scaleTau2 covOGK
 
 #' @importFrom PerformanceAnalytics chart.TimeSeries chart.ACFplus 
 #' chart.Histogram chart.QQPlot chart.Correlation

Modified: pkg/FactorAnalytics/man/Stock.df.Rd
===================================================================
--- pkg/FactorAnalytics/man/Stock.df.Rd	2015-09-15 06:23:49 UTC (rev 3994)
+++ pkg/FactorAnalytics/man/Stock.df.Rd	2015-09-16 13:22:44 UTC (rev 3995)
@@ -10,12 +10,18 @@
   Date range: 1996-02-29 through 2003-12-31
 }
 \details{
-  ID variables: DATE, TICKER
+  Date variable: DATE
   
-  Continuous variables: RETURN, PRICE, VOLUME, SHARES.OUT, MARKET.EQUITY, 
+  Stock ID: TICKER
+  
+  Stock return and price variables: RETURN, PRICE
+  
+  Numeric exposures: VOLUME, SHARES.OUT, MARKET.EQUITY, 
   LTDEBT, NET.SALES, COMMON.EQUITY, NET.INCOME, STOCKHOLDERS.EQUITY, 
-  LOG.MARKETCAP, LOG.PRICE, BOOK2MARKET 
+  LOG.MARKETCAP, LOG.PRICE, BOOK2MARKET
   
+  Note: Numeric exposures are standardized as z-scores.
+  
   Categorical variables: GICS, GICS.INDUSTRY, GICS.SECTOR
 }
 \usage{

Modified: returnanalytics.Rproj
===================================================================
--- returnanalytics.Rproj	2015-09-15 06:23:49 UTC (rev 3994)
+++ returnanalytics.Rproj	2015-09-16 13:22:44 UTC (rev 3995)
@@ -17,4 +17,4 @@
 PackageInstallArgs: --no-multiarch --with-keep.source
 PackageBuildArgs: --resave-data
 PackageBuildBinaryArgs: --data-compress
-PackageRoxygenize: rd,namespace
+PackageRoxygenize: rd,namespace,vignette



More information about the Returnanalytics-commits mailing list