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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 5 20:49:35 CEST 2013


Author: chenyian
Date: 2013-08-05 20:49:35 +0200 (Mon, 05 Aug 2013)
New Revision: 2722

Removed:
   pkg/FactorAnalytics/man/portfolioSdDecomposition.Rd
Modified:
   pkg/FactorAnalytics/R/factorModelEsDecomposition.R
   pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R
   pkg/FactorAnalytics/man/
   pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd
Log:
debug examples. 

Modified: pkg/FactorAnalytics/R/factorModelEsDecomposition.R
===================================================================
--- pkg/FactorAnalytics/R/factorModelEsDecomposition.R	2013-08-05 18:27:47 UTC (rev 2721)
+++ pkg/FactorAnalytics/R/factorModelEsDecomposition.R	2013-08-05 18:49:35 UTC (rev 2722)
@@ -66,15 +66,14 @@
 #'                                      assetvar = "TICKER",
 #'                                       wls = TRUE, regression = "classic", 
 #'                                       covariance = "classic", full.resid.cov = FALSE)
-#'  idx <- fit.fund$data[,fit.fund$assetvar]  == "STI"         
-#'  asset.ret <- fit.fund$data[idx,fit.fund$returnsvar]  
-#'  tmpData = cbind(asset.ret, fit.fund$factors,
-#'                  fit.fund$residuals[,"STI"]/sqrt(fit.fund$resid.variance["STI"]) )
-#'   colnames(tmpData)[c(1,length(tmpData[1,]))] = c("STI", "residual")
-#'   factorModelEsDecomposition(tmpData, 
+#'  idx <- fit.fund$data[,fit.fund$assetvar]  == "STI"  
+#' asset.ret <- fit.fund$data[idx,fit.fund$returnsvar]
+#' tmpData = cbind(asset.ret, fit.fund$factor.returns,
+#'                 fit.fund$residuals[,"STI"]/sqrt(fit.fund$resid.variance["STI"]) )
+#' colnames(tmpData)[c(1,length(tmpData[1,]))] = c("STI", "residual")
+#' factorModelEsDecomposition(tmpData, 
 #'                           fit.fund$beta["STI",],
-#'                           fit.fund$resid.variance["STI"], tail.prob=0.05,
-#'                           VaR.method = "historical" )
+#'                           fit.fund$resid.variance["STI"], tail.prob=0.05,VaR.method="historical")
 #' 
 #' @export
 #' 

Modified: pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R
===================================================================
--- pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R	2013-08-05 18:27:47 UTC (rev 2721)
+++ pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R	2013-08-05 18:49:35 UTC (rev 2722)
@@ -72,7 +72,7 @@
 #'  \dontrun{
 #' # load data from the database
 #' data(managers.df)
-#' fit <- fitTimeseriesFactorModel(assets.names=colnames(managers.df[,(1:6)]),
+#' fit <- fitTimeSeriesFactorModel(assets.names=colnames(managers.df[,(1:6)]),
 #'                                 factors.names=c("EDHEC.LS.EQ","SP500.TR"),
 #'                                 data=managers.df,fit.method="OLS")
 #' # summary of HAM1 


Property changes on: pkg/FactorAnalytics/man
___________________________________________________________________
Modified: svn:ignore
   - CornishFisher.Rd
Style.Rd
covEWMA.Rd
factorModelPerformanceAttribution.Rd
impliedFactorReturns.Rd
modifiedEsReport.Rd
modifiedIncrementalES.Rd
modifiedIncrementalVaR.Rd
modifiedPortfolioEsDecomposition.Rd
modifiedPortfolioVaRDecomposition.Rd
modifiedVaRReport.Rd
nonparametricEsReport.Rd
nonparametricIncrementalES.Rd
nonparametricIncrementalVaR.Rd
nonparametricPortfolioEsDecomposition.Rd
nonparametricPortfolioVaRDecomposition.Rd
nonparametricVaRReport.Rd
normalEsReport.Rd
normalIncrementalES.Rd
normalIncrementalVaR.Rd
normalPortfolioEsDecomposition.Rd
normalPortfolioVaRDecomposition.Rd
normalVaRReport.Rd
plot.FM.attribution.Rd
plot.MacroFactorModel.Rd
print.MacroFactorModel.Rd
scenarioPredictions.Rd
scenarioPredictionsPortfolio.Rd
stock.Rd
summary.FM.attribution.Rd
summary.MacroFactorModel.Rd
summary.TimeSeriesModel.Rd

   + CornishFisher.Rd
Style.Rd
covEWMA.Rd
factorModelPerformanceAttribution.Rd
impliedFactorReturns.Rd
modifiedEsReport.Rd
modifiedIncrementalES.Rd
modifiedIncrementalVaR.Rd
modifiedPortfolioEsDecomposition.Rd
modifiedPortfolioVaRDecomposition.Rd
modifiedVaRReport.Rd
nonparametricEsReport.Rd
nonparametricIncrementalES.Rd
nonparametricIncrementalVaR.Rd
nonparametricPortfolioEsDecomposition.Rd
nonparametricPortfolioVaRDecomposition.Rd
nonparametricVaRReport.Rd
normalEsReport.Rd
normalIncrementalES.Rd
normalIncrementalVaR.Rd
normalPortfolioEsDecomposition.Rd
normalPortfolioVaRDecomposition.Rd
normalVaRReport.Rd
plot.FM.attribution.Rd
plot.MacroFactorModel.Rd
portfolioSdDecomposition.Rd
print.MacroFactorModel.Rd
scenarioPredictions.Rd
scenarioPredictionsPortfolio.Rd
stock.Rd
summary.FM.attribution.Rd
summary.MacroFactorModel.Rd
summary.TimeSeriesModel.Rd


Modified: pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd	2013-08-05 18:27:47 UTC (rev 2721)
+++ pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd	2013-08-05 18:49:35 UTC (rev 2722)
@@ -81,14 +81,13 @@
                                       wls = TRUE, regression = "classic",
                                       covariance = "classic", full.resid.cov = FALSE)
  idx <- fit.fund$data[,fit.fund$assetvar]  == "STI"
- asset.ret <- fit.fund$data[idx,fit.fund$returnsvar]
- tmpData = cbind(asset.ret, fit.fund$factors,
-                 fit.fund$residuals[,"STI"]/sqrt(fit.fund$resid.variance["STI"]) )
-  colnames(tmpData)[c(1,length(tmpData[1,]))] = c("STI", "residual")
-  factorModelEsDecomposition(tmpData,
+asset.ret <- fit.fund$data[idx,fit.fund$returnsvar]
+tmpData = cbind(asset.ret, fit.fund$factor.returns,
+                fit.fund$residuals[,"STI"]/sqrt(fit.fund$resid.variance["STI"]) )
+colnames(tmpData)[c(1,length(tmpData[1,]))] = c("STI", "residual")
+factorModelEsDecomposition(tmpData,
                           fit.fund$beta["STI",],
-                          fit.fund$resid.variance["STI"], tail.prob=0.05,
-                          VaR.method = "historical" )
+                          fit.fund$resid.variance["STI"], tail.prob=0.05,VaR.method="historical")
 }
 \author{
   Eric Zviot and Yi-An Chen.

Deleted: pkg/FactorAnalytics/man/portfolioSdDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/portfolioSdDecomposition.Rd	2013-08-05 18:27:47 UTC (rev 2721)
+++ pkg/FactorAnalytics/man/portfolioSdDecomposition.Rd	2013-08-05 18:49:35 UTC (rev 2722)
@@ -1,52 +0,0 @@
-\name{portfolioSdDecomposition}
-\alias{portfolioSdDecomposition}
-\title{Compute portfolio sd (risk) decomposition by asset.}
-\usage{
-  portfolioSdDecomposition(w.vec, cov.assets)
-}
-\arguments{
-  \item{w.vec}{N x 1 vector of portfolio weights}
-
-  \item{cov.assets}{N x N asset covariance matrix}
-}
-\value{
-  an S3 list containing
-}
-\description{
-  Compute portfolio sd (risk) decomposition by asset.
-}
-\examples{
-# load data from the database
-data(managers.df)
-ret.assets = managers.df[,(1:6)]
-factors    = managers.df[,(7:9)]
-# fit the factor model with OLS
-fit <-fitMacroeconomicFactorModel(ret.assets,factors,fit.method="OLS",
-                                  variable.selection="all subsets", factor.set = 3)
-# factor SD decomposition for HAM1
-cov.factors = var(factors)
-manager.names = colnames(managers.df[,(1:6)])
-factor.names  = colnames(managers.df[,(7:9)])
-# assuming equal weight vector
-w.vec = rep(1/6,6)
-# compute with sample covariance matrix (omit NA)
-cov.sample = ccov(managers.df[,manager.names],na.action=na.omit)
-port.sd.decomp.sample = portfolioSdDecomposition(w.vec, cov.sample$cov)
-# show bar chart
-barplot(port.sd.decomp.sample$pcsd.p,
-        main="Fund Percent Contributions to Portfolio SD",
-        ylab="Percent Contribution", legend.text=FALSE,
-        col="blue")
-
-# compute with factor model covariance matrix
-returnCov.mat<- factorModelCovariance(fit$beta.mat,var(factors),fit$residVars.vec)
-port.sd.decomp.fm = portfolioSdDecomposition(w.vec, returnCov.mat)
-}
-\author{
-  Eric Zivot and Yi-An Chen
-}
-\references{
-  Qian, Hua and Sorensen (2007) Quantitative Equity
-  Portfolio Management, chapter 3.
-}
-



More information about the Returnanalytics-commits mailing list