[Returnanalytics-commits] r2291 - pkg/PerformanceAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Oct 26 17:56:41 CEST 2012


Author: braverock
Date: 2012-10-26 17:56:41 +0200 (Fri, 26 Oct 2012)
New Revision: 2291

Modified:
   pkg/PerformanceAnalytics/R/PortfolioRisk.R
Log:
- use sd.default for vector

Modified: pkg/PerformanceAnalytics/R/PortfolioRisk.R
===================================================================
--- pkg/PerformanceAnalytics/R/PortfolioRisk.R	2012-10-25 15:22:45 UTC (rev 2290)
+++ pkg/PerformanceAnalytics/R/PortfolioRisk.R	2012-10-26 15:56:41 UTC (rev 2291)
@@ -272,7 +272,7 @@
    T = dim(R)[1]; N = dim(R)[2];
    portfolioreturn = c();
    for( t in 1:T ){ portfolioreturn = c( portfolioreturn , sum(w*R[t,]) ) }
-   bandwith = 2.575*sd.xts(portfolioreturn)/(T^(1/5)) ;
+   bandwith = 2.575*sd(portfolioreturn)/(T^(1/5)) ;
    CVaR = c();
    VaR = -quantile( portfolioreturn , probs = alpha );
    weights = kernel(x= (-VaR-portfolioreturn) , h=bandwith);



More information about the Returnanalytics-commits mailing list