[Returnanalytics-commits] r2295 - pkg/PerformanceAnalytics/tests/Examples
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 10 15:05:28 CET 2012
Author: braverock
Date: 2012-11-10 15:05:28 +0100 (Sat, 10 Nov 2012)
New Revision: 2295
Modified:
pkg/PerformanceAnalytics/tests/Examples/PerformanceAnalytics-Ex.Rout.save
Log:
- update example output using current code
Modified: pkg/PerformanceAnalytics/tests/Examples/PerformanceAnalytics-Ex.Rout.save
===================================================================
--- pkg/PerformanceAnalytics/tests/Examples/PerformanceAnalytics-Ex.Rout.save 2012-11-08 14:59:26 UTC (rev 2294)
+++ pkg/PerformanceAnalytics/tests/Examples/PerformanceAnalytics-Ex.Rout.save 2012-11-10 14:05:28 UTC (rev 2295)
@@ -1,5 +1,5 @@
-R version 2.14.2 (2012-02-29)
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)
@@ -49,16 +49,16 @@
> ### Name: ActivePremium
> ### Title: Active Premium
> ### Aliases: ActivePremium
-> ### Keywords: ts multivariate distribution models
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
-> data(managers)
+> data(managers)
> ActivePremium(managers[, "HAM1", drop=FALSE], managers[, "SP500 TR", drop=FALSE])
[1] 0.04078668
-> ActivePremium(managers[,1,drop=FALSE], managers[,8,drop=FALSE])
+> ActivePremium(managers[,1,drop=FALSE], managers[,8,drop=FALSE])
[1] 0.04078668
-> ActivePremium(managers[,1:6], managers[,8,drop=FALSE])
+> ActivePremium(managers[,1:6], managers[,8,drop=FALSE])
HAM1 HAM2 HAM3 HAM4 HAM5
Active Premium: SP500 TR 0.04078668 0.07759873 0.05446935 0.02473443 0.02182245
HAM6
@@ -74,17 +74,105 @@
>
>
> cleanEx()
-> nameEx("BetaCoVariance")
-> ### * BetaCoVariance
+> nameEx("AdjustedSharpeRatio")
+> ### * AdjustedSharpeRatio
>
> flush(stderr()); flush(stdout())
>
-> ### Name: Beta Co-Moments
+> ### Name: AdjustedSharpeRatio
+> ### Title: Adjusted Sharpe ratio of the return distribution
+> ### Aliases: AdjustedSharpeRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(AdjustedSharpeRatio(portfolio_bacon[,1])) #expected 0.81
+[1] 0.8084219
+>
+> data(managers)
+> print(AdjustedSharpeRatio(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+Adjusted Sharpe ratio (Risk free = 0) 2.040073 10.85643 1.110574 1.857069 NA
+ HAM6 EDHEC LS EQ SP500 TR US 10Y TR
+Adjusted Sharpe ratio (Risk free = 0) NA NA 1.938178 0.03978634
+ US 3m TR
+Adjusted Sharpe ratio (Risk free = 0) -606.3258
+> print(AdjustedSharpeRatio(managers['1996',1]))
+[1] 2.040073
+>
+>
+>
+> cleanEx()
+> nameEx("AppraisalRatio")
+> ### * AppraisalRatio
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: AppraisalRatio
+> ### Title: Appraisal ratio of the return distribution
+> ### Aliases: AppraisalRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="appraisal")) #expected -0.430
+[1] -0.4302756
+> print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="modified"))
+[1] -0.01418576
+> print(AppraisalRatio(portfolio_bacon[,1], portfolio_bacon[,2], method="alternative"))
+[1] -0.1089875
+>
+> data(managers)
+> print(AppraisalRatio(managers['1996',1], managers['1996',8]))
+[1] 1.623025
+> print(AppraisalRatio(managers['1996',1:5], managers['1996',8]))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+Appraisal ratio (Risk free = 0) 1.623025 NA 3.527723 0.7070483 NA
+>
+>
+>
+> cleanEx()
+> nameEx("BernardoLedoitRatio")
+> ### * BernardoLedoitRatio
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: BernardoLedoitRatio
+> ### Title: Bernardo and Ledoit ratio of the return distribution
+> ### Aliases: BernardoLedoitRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(BernardoLedoitRatio(portfolio_bacon[,1])) #expected 1.78
+[1] 1.779783
+>
+> data(managers)
+> print(BernardoLedoitRatio(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6 EDHEC LS EQ
+Bernardo and Ledoit ratio 4.598338 2375 6.482812 3.615074 NaN NaN NaN
+ SP500 TR US 10Y TR US 3m TR
+Bernardo and Ledoit ratio 4.340625 1.028277 -Inf
+> print(BernardoLedoitRatio(managers['1996',1])) #expected 4.598
+[1] 4.598338
+>
+>
+>
+> cleanEx()
+> nameEx("BetaCoMoments")
+> ### * BetaCoMoments
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: BetaCoMoments
> ### Title: Functions to calculate systematic or beta co-moments of return
> ### series
-> ### Aliases: BetaCoMoments BetaCoVariance BetaCoSkewness BetaCoKurtosis
-> ### SystematicSkewness SystematicKurtosis
-> ### Keywords: ts multivariate distribution models
+> ### Aliases: BetaCoKurtosis BetaCoMoments BetaCoSkewness BetaCoVariance
+> ### SystematicKurtosis SystematicSkewness
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
@@ -111,18 +199,54 @@
>
>
>
+> cleanEx()
+> nameEx("BurkeRatio")
+> ### * BurkeRatio
>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: BurkeRatio
+> ### Title: Burke ratio of the return distribution
+> ### Aliases: BurkeRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(BurkeRatio(portfolio_bacon[,1])) #expected 0.74
+[1] 0.7447309
+> print(BurkeRatio(portfolio_bacon[,1], modified = TRUE)) #expected 3.65
+[1] 3.648421
+>
+> data(managers)
+> print(BurkeRatio(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6
+Burke ratio (Risk free = 0) 4.779747 Inf 6.340485 4.048153 NA NA
+ EDHEC LS EQ SP500 TR US 10Y TR US 3m TR
+Burke ratio (Risk free = 0) NA 4.739828 0.006137083 Inf
+> print(BurkeRatio(managers['1996',1]))
+[1] 4.779747
+> print(BurkeRatio(managers['1996'], modified = TRUE))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6
+Modified Burke ratio (Risk free = 0) 16.55753 Inf 21.96408 14.02321 NA NA
+ EDHEC LS EQ SP500 TR US 10Y TR US 3m TR
+Modified Burke ratio (Risk free = 0) NA 16.41925 0.02125948 Inf
+> print(BurkeRatio(managers['1996',1], modified = TRUE))
+[1] 16.55753
+>
+>
+>
> cleanEx()
> nameEx("CAPM.RiskPremium")
> ### * CAPM.RiskPremium
>
> flush(stderr()); flush(stdout())
>
-> ### Name: CAPM.utils
+> ### Name: CAPM.CML.slope
> ### Title: utility functions for CAPM CML, SML, and RiskPremium
-> ### Aliases: CAPM.utils CAPM.RiskPremium CAPM.CML CAPM.CML.slope
-> ### CAPM.SML.slope
-> ### Keywords: ts multivariate distribution models
+> ### Aliases: CAPM.CML CAPM.CML.slope CAPM.RiskPremium CAPM.SML.slope
+> ### CAPM.utils
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
@@ -145,7 +269,6 @@
>
>
>
->
> cleanEx()
> nameEx("CAPM.alpha")
> ### * CAPM.alpha
@@ -155,34 +278,46 @@
> ### Name: CAPM.alpha
> ### Title: calculate CAPM alpha
> ### Aliases: CAPM.alpha
-> ### Keywords: ts multivariate distribution models
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
> # First we load the data
> data(managers)
-> CAPM.alpha(managers[,1,drop=FALSE], managers[,8,drop=FALSE], Rf=.035/12)
+> CAPM.alpha(managers[,1,drop=FALSE],
++ managers[,8,drop=FALSE],
++ Rf=.035/12)
[1] 0.005960609
-> CAPM.alpha(managers[,1,drop=FALSE], managers[,8,drop=FALSE], Rf = managers[,10,drop=FALSE])
+> CAPM.alpha(managers[,1,drop=FALSE],
++ managers[,8,drop=FALSE],
++ Rf = managers[,10,drop=FALSE])
[1] 0.005774729
-> CAPM.alpha(managers[,1:6], managers[,8,drop=FALSE], Rf=.035/12)
+> CAPM.alpha(managers[,1:6],
++ managers[,8,drop=FALSE],
++ Rf=.035/12)
HAM1 HAM2 HAM3 HAM4 HAM5
Alpha: SP500 TR 0.005960609 0.009232784 0.006327417 0.004144392 0.001425414
HAM6
Alpha: SP500 TR 0.007244216
-> CAPM.alpha(managers[,1:6], managers[,8,drop=FALSE], Rf = managers[,10,drop=FALSE])
+> CAPM.alpha(managers[,1:6],
++ managers[,8,drop=FALSE],
++ Rf = managers[,10,drop=FALSE])
HAM1 HAM2 HAM3 HAM4 HAM5
Alpha: SP500 TR 0.005774729 0.009092773 0.006216498 0.004029731 0.001733199
HAM6
Alpha: SP500 TR 0.007837454
-> CAPM.alpha(managers[,1:6], managers[,8:7,drop=FALSE], Rf=.035/12)
+> CAPM.alpha(managers[,1:6],
++ managers[,8:7,drop=FALSE],
++ Rf=.035/12)
HAM1 HAM2 HAM3 HAM4
Alpha: SP500 TR 0.005960609 0.009232784 0.006327417 0.004144392
Alpha: EDHEC LS EQ 0.003190734 0.001627709 -0.001716897 -0.003357739
HAM5 HAM6
Alpha: SP500 TR 0.001425414 0.007244216
Alpha: EDHEC LS EQ -0.002185688 0.004197041
-> CAPM.alpha(managers[,1:6], managers[,8:7,drop=FALSE], Rf = managers[,10,drop=FALSE])
+> CAPM.alpha(managers[,1:6],
++ managers[,8:7,drop=FALSE],
++ Rf = managers[,10,drop=FALSE])
HAM1 HAM2 HAM3 HAM4
Alpha: SP500 TR 0.005774729 0.009092773 0.006216498 0.004029731
Alpha: EDHEC LS EQ 0.003134750 0.001732335 -0.001563904 -0.003406683
@@ -192,7 +327,6 @@
>
>
>
->
> cleanEx()
> nameEx("CAPM.beta")
> ### * CAPM.beta
@@ -201,54 +335,135 @@
>
> ### Name: CAPM.beta
> ### Title: calculate CAPM beta
-> ### Aliases: CAPM.beta CAPM.beta.bull CAPM.beta.bear TimingRatio
-> ### Keywords: ts multivariate distribution models
+> ### Aliases: CAPM.beta CAPM.beta.bear CAPM.beta.bull TimingRatio
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
> data(managers)
-> CAPM.alpha(managers[,1,drop=FALSE], managers[,8,drop=FALSE], Rf=.035/12)
+> CAPM.alpha(managers[,1,drop=FALSE],
++ managers[,8,drop=FALSE],
++ Rf=.035/12)
[1] 0.005960609
-> CAPM.alpha(managers[,1,drop=FALSE], managers[,8,drop=FALSE], Rf = managers[,10,drop=FALSE])
+> CAPM.alpha(managers[,1,drop=FALSE],
++ managers[,8,drop=FALSE],
++ Rf = managers[,10,drop=FALSE])
[1] 0.005774729
-> CAPM.alpha(managers[,1:6], managers[,8,drop=FALSE], Rf=.035/12)
+> CAPM.alpha(managers[,1:6],
++ managers[,8,drop=FALSE],
++ Rf=.035/12)
HAM1 HAM2 HAM3 HAM4 HAM5
Alpha: SP500 TR 0.005960609 0.009232784 0.006327417 0.004144392 0.001425414
HAM6
Alpha: SP500 TR 0.007244216
-> CAPM.alpha(managers[,1:6], managers[,8,drop=FALSE], Rf = managers[,10,drop=FALSE])
+> CAPM.alpha(managers[,1:6],
++ managers[,8,drop=FALSE],
++ Rf = managers[,10,drop=FALSE])
HAM1 HAM2 HAM3 HAM4 HAM5
Alpha: SP500 TR 0.005774729 0.009092773 0.006216498 0.004029731 0.001733199
HAM6
Alpha: SP500 TR 0.007837454
-> CAPM.alpha(managers[,1:6], managers[,8:7,drop=FALSE], Rf=.035/12)
+> CAPM.alpha(managers[,1:6],
++ managers[,8:7,drop=FALSE],
++ Rf=.035/12)
HAM1 HAM2 HAM3 HAM4
Alpha: SP500 TR 0.005960609 0.009232784 0.006327417 0.004144392
Alpha: EDHEC LS EQ 0.003190734 0.001627709 -0.001716897 -0.003357739
HAM5 HAM6
Alpha: SP500 TR 0.001425414 0.007244216
Alpha: EDHEC LS EQ -0.002185688 0.004197041
-> CAPM.alpha(managers[,1:6], managers[,8:7,drop=FALSE], Rf = managers[,10,drop=FALSE])
+> CAPM.alpha(managers[,1:6],
++ managers[,8:7,drop=FALSE],
++ Rf = managers[,10,drop=FALSE])
HAM1 HAM2 HAM3 HAM4
Alpha: SP500 TR 0.005774729 0.009092773 0.006216498 0.004029731
Alpha: EDHEC LS EQ 0.003134750 0.001732335 -0.001563904 -0.003406683
HAM5 HAM6
Alpha: SP500 TR 0.001733199 0.007837454
Alpha: EDHEC LS EQ -0.002255793 0.004212371
-> CAPM.beta(managers[, "HAM2", drop=FALSE], managers[, "SP500 TR", drop=FALSE], Rf = managers[, "US 3m TR", drop=FALSE])
+> CAPM.beta(managers[, "HAM2", drop=FALSE],
++ managers[, "SP500 TR", drop=FALSE],
++ Rf = managers[, "US 3m TR", drop=FALSE])
[1] 0.3383942
-> CAPM.beta.bull(managers[, "HAM2", drop=FALSE], managers[, "SP500 TR", drop=FALSE], Rf = managers[, "US 3m TR", drop=FALSE])
+> CAPM.beta.bull(managers[, "HAM2", drop=FALSE],
++ managers[, "SP500 TR", drop=FALSE],
++ Rf = managers[, "US 3m TR", drop=FALSE])
[1] 0.5226596
-> CAPM.beta.bear(managers[, "HAM2", drop=FALSE], managers[, "SP500 TR", drop=FALSE], Rf = managers[, "US 3m TR", drop=FALSE])
+> CAPM.beta.bear(managers[, "HAM2", drop=FALSE],
++ managers[, "SP500 TR", drop=FALSE],
++ Rf = managers[, "US 3m TR", drop=FALSE])
[1] 0.0698255
-> TimingRatio(managers[, "HAM2", drop=FALSE], managers[, "SP500 TR", drop=FALSE], Rf = managers[, "US 3m TR", drop=FALSE])
+> TimingRatio(managers[, "HAM2", drop=FALSE],
++ managers[, "SP500 TR", drop=FALSE],
++ Rf = managers[, "US 3m TR", drop=FALSE])
[1] 7.485224
-> chart.Regression(managers[, "HAM2", drop=FALSE], managers[, "SP500 TR", drop=FALSE], Rf = managers[, "US 3m TR", drop=FALSE], fit="conditional", main="Conditional Beta")
+> chart.Regression(managers[, "HAM2", drop=FALSE],
++ managers[, "SP500 TR", drop=FALSE],
++ Rf = managers[, "US 3m TR", drop=FALSE],
++ fit="conditional",
++ main="Conditional Beta")
>
>
>
+> cleanEx()
+> nameEx("CAPM.epsilon")
+> ### * CAPM.epsilon
>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: CAPM.epsilon
+> ### Title: Regression epsilon of the return distribution
+> ### Aliases: CAPM.epsilon epsilon Regression
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(CAPM.epsilon(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -0.013
+[1] -0.01313932
+>
+> data(managers)
+> print(CAPM.epsilon(managers['1996',1], managers['1996',8]))
+[1] 0.07425366
+> print(CAPM.epsilon(managers['1996',1:5], managers['1996',8]))
+Warning in cbind(xRa, xRb) :
+ number of rows of result is not a multiple of vector length (arg 1)
+Warning in cbind(xRa, xRb) :
+ number of rows of result is not a multiple of vector length (arg 1)
+ HAM1 HAM2 HAM3 HAM4
+Regression epsilon (Risk free = 0) 0.07425366 0.8386249 0.2048063 0.05570592
+ HAM5
+Regression epsilon (Risk free = 0) NA
+>
+>
+>
> cleanEx()
+> nameEx("CAPM.jensenAlpha")
+> ### * CAPM.jensenAlpha
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: CAPM.jensenAlpha
+> ### Title: Jensen's alpha of the return distribution
+> ### Aliases: CAPM.jensenAlpha Jensen'sAlpha
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(CAPM.jensenAlpha(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -0.014
+[1] -0.01416944
+>
+> data(managers)
+> print(CAPM.jensenAlpha(managers['1996',1], managers['1996',8]))
+[1] 0.08077871
+> print(CAPM.jensenAlpha(managers['1996',1:5], managers['1996',8]))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+Jensen's Alpha (Risk free = 0) 0.08077871 NA 0.2196026 0.06063837 NA
+>
+>
+>
+> cleanEx()
> nameEx("CDD")
> ### * CDD
>
@@ -257,8 +472,8 @@
> ### Name: CDD
> ### Title: Calculate Uryasev's proposed Conditional Drawdown at Risk (CDD
> ### or CDaR) measure
-> ### Aliases: CDD CDaR
-> ### Keywords: ts multivariate distribution models
+> ### Aliases: CDaR CDD
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
@@ -290,15 +505,15 @@
> ### Name: CalmarRatio
> ### Title: calculate a Calmar or Sterling reward/risk ratio
> ### Aliases: CalmarRatio SterlingRatio
-> ### Keywords: ts multivariate distribution models
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
-> data(managers)
+> data(managers)
> CalmarRatio(managers[,1,drop=FALSE])
HAM1
Calmar Ratio 0.9061697
-> CalmarRatio(managers[,1:6])
+> CalmarRatio(managers[,1:6])
HAM1 HAM2 HAM3 HAM4 HAM5 HAM6
Calmar Ratio 0.9061697 0.728094 0.5225829 0.4227315 0.1095909 1.742525
> SterlingRatio(managers[,1,drop=FALSE])
@@ -313,15 +528,15 @@
>
>
> cleanEx()
-> nameEx("CoVariance")
-> ### * CoVariance
+> nameEx("CoMoments")
+> ### * CoMoments
>
> flush(stderr()); flush(stdout())
>
-> ### Name: Co-Moments
+> ### Name: CoMoments
> ### Title: Functions for calculating comoments of financial time series
-> ### Aliases: CoMoments CoVariance CoSkewness CoKurtosis
-> ### Keywords: ts multivariate distribution models
+> ### Aliases: CoKurtosis CoMoments CoSkewness CoVariance
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
@@ -335,7 +550,34 @@
>
>
>
+> cleanEx()
+> nameEx("DRatio")
+> ### * DRatio
>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: DRatio
+> ### Title: d ratio of the return distribution
+> ### Aliases: DRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(DRatio(portfolio_bacon[,1])) #expected 0.401
+[1] 0.4013329
+>
+> data(managers)
+> print(DRatio(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6 EDHEC LS EQ
+d ratio 0.07248996 0.0001052632 0.03085081 0.1383098 NaN NaN NaN
+ SP500 TR US 10Y TR US 3m TR
+d ratio 0.04607631 1.361501 0
+> print(DRatio(managers['1996',1])) #expected 0.0725
+[1] 0.07248996
+>
+>
+>
> cleanEx()
> nameEx("DownsideDeviation")
> ### * DownsideDeviation
@@ -344,25 +586,36 @@
>
> ### Name: DownsideDeviation
> ### Title: downside risk (deviation, variance) of the return distribution
-> ### Aliases: DownsideDeviation SemiDeviation SemiVariance DownsidePotential
-> ### Keywords: ts multivariate distribution models
+> ### Aliases: DownsideDeviation DownsidePotential SemiDeviation SemiVariance
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
+> #with data used in Bacon 2008
+>
+> data(portfolio_bacon)
+> MAR = 0.5
+> DownsideDeviation(portfolio_bacon[,1], MAR) #expected 0.493
+[1] 0.492524
+> DownsidePotential(portfolio_bacon[,1], MAR) #expected 0.491
+[1] 0.491
+>
+> #with data of managers
+>
> data(managers)
> apply(managers[,1:6], 2, sd, na.rm=TRUE)
HAM1 HAM2 HAM3 HAM4 HAM5 HAM6
0.02562881 0.03671623 0.03651259 0.05319796 0.04573149 0.02381247
> DownsideDeviation(managers[,1:6]) # MAR 0%
- HAM1 HAM2 HAM3 HAM4
-Downside Deviation (MAR = 0%) 0.02908156 0.01713902 0.02908379 0.05480826
- HAM5 HAM6
-Downside Deviation (MAR = 0%) 0.04513572 0.02290039
+ HAM1 HAM2 HAM3 HAM4
+Downside Deviation (MAR = 0%) 0.01454078 0.0115736 0.01735454 0.03406781
+ HAM5 HAM6
+Downside Deviation (MAR = 0%) 0.0304305 0.01214476
> DownsideDeviation(managers[,1:6], MAR = .04/12) #MAR 4%
- HAM1 HAM2 HAM3 HAM4
-Downside Deviation (MAR = 0.3%) 0.02862983 0.01969741 0.02957347 0.05626418
- HAM5 HAM6
-Downside Deviation (MAR = 0.3%) 0.04563814 0.02385615
+ HAM1 HAM2 HAM3 HAM4
+Downside Deviation (MAR = 0%) 0.0157602 0.01341739 0.01891525 0.03565192
+ HAM5 HAM6
+Downside Deviation (MAR = 0%) 0.0320608 0.01366533
> SemiDeviation(managers[,1,drop=FALSE])
HAM1
Semi-Deviation 0.0190795
@@ -379,21 +632,50 @@
>
>
> cleanEx()
+> nameEx("DownsideFrequency")
+> ### * DownsideFrequency
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: DownsideFrequency
+> ### Title: downside frequency of the return distribution
+> ### Aliases: DownsideFrequency
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> MAR = 0.005
+> print(DownsideFrequency(portfolio_bacon[,1], MAR)) #expected 0.458
+[1] 0.4583333
+>
+> data(managers)
+> print(DownsideFrequency(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6
+Downside Frequency (MAR = 0%) 0.25 0.2 0.1666667 0.3333333 NaN NaN
+ EDHEC LS EQ SP500 TR US 10Y TR US 3m TR
+Downside Frequency (MAR = 0%) NaN 0.1666667 0.5833333 0
+> print(DownsideFrequency(managers['1996',1])) #expected 0.25
+[1] 0.25
+>
+>
+>
+> cleanEx()
> nameEx("ES")
> ### * ES
>
> flush(stderr()); flush(stdout())
>
-> ### Name: ES
+> ### Name: ETL
> ### Title: calculates Expected Shortfall(ES) (or Conditional
> ### Value-at-Risk(CVaR) for univariate and component, using a variety of
> ### analytical methods.
-> ### Aliases: ES CVaR ETL
-> ### Keywords: ts multivariate distribution models
+> ### Aliases: CVaR ES ETL
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
-> data(edhec)
+> data(edhec)
>
> # first do normal ES calc
> ES(edhec, p=.95, method="historical")
@@ -498,6 +780,57 @@
detaching ‘package:robustbase’
+> nameEx("FamaBeta")
+> ### * FamaBeta
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: FamaBeta
+> ### Title: Fama beta of the return distribution
+> ### Aliases: FamaBeta
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(FamaBeta(portfolio_bacon[,1], portfolio_bacon[,2])) #expected 1.03
+ portfolio.monthly.return....
+portfolio.monthly.return.... 1.030395
+>
+> data(managers)
+> print(FamaBeta(managers['1996',1], managers['1996',8]))
+ HAM1
+HAM1 0.5351217
+> print(FamaBeta(managers['1996',1:5], managers['1996',8]))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+Fama Beta 0.5351217 NA 1.007084 1.037632 NA
+>
+>
+>
+> cleanEx()
+> nameEx("Frequency")
+> ### * Frequency
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: Frequency
+> ### Title: Frequency of the return distribution
+> ### Aliases: Frequency
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(Frequency(portfolio_bacon[,1])) #expected 12
+[1] 12
+> data(managers)
+> print(Frequency(managers['1996',1:5]))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+Frequency 12 12 12 12 NA
+>
+>
+>
+> cleanEx()
> nameEx("InformationRatio")
> ### * InformationRatio
>
@@ -506,7 +839,7 @@
> ### Name: InformationRatio
> ### Title: InformationRatio = ActivePremium/TrackingError
> ### Aliases: InformationRatio
-> ### Keywords: ts multivariate distribution models
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
@@ -529,6 +862,38 @@
>
>
> cleanEx()
+> nameEx("Kappa")
+> ### * Kappa
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: Kappa
+> ### Title: Kappa of the return distribution
+> ### Aliases: Kappa
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> l = 2
+>
+> data(portfolio_bacon)
+> MAR = 0.005
+> print(Kappa(portfolio_bacon[,1], MAR, l)) #expected 0.157
+[1] 0.1566371
+>
+> data(managers)
+> MAR = 0
+> print(Kappa(managers['1996'], MAR, l))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6 EDHEC LS EQ
+kappa (MAR = 0%) 1.492063 1061.685 2.235197 1.14188 NaN NaN NaN
+ SP500 TR US 10Y TR US 3m TR
+kappa (MAR = 0%) 1.274332 0.01674457 Inf
+> print(Kappa(managers['1996',1], MAR, l)) #expected 1.493
+[1] 1.492063
+>
+>
+>
+> cleanEx()
> nameEx("KellyRatio")
> ### * KellyRatio
>
@@ -538,11 +903,11 @@
> ### Title: calculate Kelly criterion ratio (leverage or bet size) for a
> ### strategy
> ### Aliases: KellyRatio
-> ### Keywords: ts multivariate distribution models
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
-> data(managers)
+> data(managers)
> KellyRatio(managers[,1,drop=FALSE], Rf=.04/12)
HAM1
Kelly Ratio 5.929483
@@ -556,6 +921,181 @@
>
>
> cleanEx()
+> nameEx("M2Sortino")
+> ### * M2Sortino
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: M2Sortino
+> ### Title: M squared for Sortino of the return distribution
+> ### Aliases: M2Sortino
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> MAR = 0.005
+> print(M2Sortino(portfolio_bacon[,1], portfolio_bacon[,2], MAR)) #expected 0.1035
+ portfolio.monthly.return....
+Sortino Ratio (MAR = 0.5%) 0.1034799
+>
+> data(managers)
+> MAR = 0
+> print(MSquaredExcess(managers['1996',1], managers['1996',8], MAR))
+ HAM1
+HAM1 -0.127433
+> print(MSquaredExcess(managers['1996',1:5], managers['1996',8], MAR))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+MSquaredExcess (Risk free = 0) -0.127433 NA 0.1456129 -0.01310258 NA
+>
+>
+>
+> cleanEx()
+> nameEx("MSquared")
+> ### * MSquared
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: MSquared
+> ### Title: M squared of the return distribution
+> ### Aliases: MSquared
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(MSquared(portfolio_bacon[,1], portfolio_bacon[,2])) #expected 0.1068
+ portfolio.monthly.return....
+portfolio.monthly.return.... 0.1068296
+>
+> data(managers)
+> print(MSquared(managers['1996',1], managers['1996',8]))
+ HAM1
+HAM1 0.07287385
+> print(MSquared(managers['1996',1:5], managers['1996',8]))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+MSquared (Risk free = 0) 0.07287385 NA 0.4086003 0.21345 NA
+>
+>
+>
+> cleanEx()
+> nameEx("MSquaredExcess")
+> ### * MSquaredExcess
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: MSquaredExcess
+> ### Title: M squared excess of the return distribution
+> ### Aliases: MSquaredExcess
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(MSquaredExcess(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -0.00998
+ portfolio.monthly.return....
+portfolio.monthly.return.... -0.009976721
+> print(MSquaredExcess(portfolio_bacon[,1], portfolio_bacon[,2], Method="arithmetic")) #expected -0.011
+ portfolio.monthly.return....
+portfolio.monthly.return.... -0.01115381
+>
+> data(managers)
+> print(MSquaredExcess(managers['1996',1], managers['1996',8]))
+ HAM1
+HAM1 -0.127433
+> print(MSquaredExcess(managers['1996',1:5], managers['1996',8]))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+MSquaredExcess (Risk free = 0) -0.127433 NA 0.1456129 -0.01310258 NA
+>
+>
+>
+> cleanEx()
+> nameEx("MartinRatio")
+> ### * MartinRatio
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: MartinRatio
+> ### Title: Martin ratio of the return distribution
+> ### Aliases: MartinRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(MartinRatio(portfolio_bacon[,1])) #expected 1.70
+ portfolio.monthly.return....
+Ulcer Index 1.70772
+>
+> data(managers)
+> print(MartinRatio(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6 EDHEC LS EQ
+Martin Ratio (Rf = 0) 15.49888 16390.63 19.24429 13.67313 NA NA NA
+ SP500 TR US 10Y TR US 3m TR
+Martin Ratio (Rf = 0) 14.81878 0.01003279 Inf
+> print(MartinRatio(managers['1996',1]))
+ HAM1
+Ulcer Index 15.49888
+>
+>
+>
+> cleanEx()
+> nameEx("MeanAbsoluteDeviation")
+> ### * MeanAbsoluteDeviation
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: MeanAbsoluteDeviation
+> ### Title: Mean absolute deviation of the return distribution
+> ### Aliases: MeanAbsoluteDeviation
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(MeanAbsoluteDeviation(portfolio_bacon[,1])) #expected 0.0310
+[1] 0.03108333
+>
+> data(managers)
+> print(MeanAbsoluteDeviation(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6
+Mean absolute deviation 0.0125375 0.031576 0.02229444 0.02540972 NaN NaN
+ EDHEC LS EQ SP500 TR US 10Y TR US 3m TR
+Mean absolute deviation NaN 0.02225 0.01611653 0.00021
+> print(MeanAbsoluteDeviation(managers['1996',1]))
+[1] 0.0125375
+>
+>
+>
+> cleanEx()
+> nameEx("NetSelectivity")
+> ### * NetSelectivity
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: NetSelectivity
+> ### Title: Net selectivity of the return distribution
+> ### Aliases: NetSelectivity
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(NetSelectivity(portfolio_bacon[,1], portfolio_bacon[,2])) #expected -0.017
+ portfolio.monthly.return....
+portfolio.monthly.return.... -0.0178912
+>
+> data(managers)
+> print(NetSelectivity(managers['1996',1], managers['1996',8]))
+ HAM1
+HAM1 0.01333906
+> print(NetSelectivity(managers['1996',1:5], managers['1996',8]))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+Net Selectivity (Risk free = 0) 0.01333906 NA 0.1745397 -0.03249043 NA
+>
+>
+>
+> cleanEx()
> nameEx("Omega")
> ### * Omega
>
@@ -564,11 +1104,11 @@
> ### Name: Omega
> ### Title: calculate Omega for a return series
> ### Aliases: Omega
-> ### Keywords: ts multivariate distribution models
+> ### Keywords: distribution models multivariate ts
>
> ### ** Examples
>
-> data(edhec)
+> data(edhec)
> Omega(edhec)
Convertible Arbitrage CTA Global Distressed Securities
Omega (L = 0%) 2.602138 1.936841 3.230443
@@ -728,6 +1268,154 @@
>
>
> cleanEx()
+> nameEx("OmegaExcessReturn")
+> ### * OmegaExcessReturn
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: OmegaExcessReturn
+> ### Title: Omega excess return of the return distribution
+> ### Aliases: OmegaExcessReturn OmegaExessReturn
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> MAR = 0.005
+> print(OmegaExcessReturn(portfolio_bacon[,1], portfolio_bacon[,2], MAR)) #expected 0.0805
+[1] 0.08053795
+>
+> data(managers)
+> MAR = 0
+> print(OmegaExcessReturn(managers['1996',1], managers['1996',8], MAR))
+[1] 0.1325302
+> print(OmegaExcessReturn(managers['1996',1:5], managers['1996',8], MAR))
+ HAM1 HAM2 HAM3 HAM4 HAM5
+Omega Excess Return (MAR = 0) 0.1325302 NA 0.3991416 0.1985718 NA
+>
+>
+>
+> cleanEx()
+> nameEx("OmegaSharpeRatio")
+> ### * OmegaSharpeRatio
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: OmegaSharpeRatio
+> ### Title: Omega-Sharpe ratio of the return distribution
+> ### Aliases: OmegaSharpeRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> MAR = 0.005
+> print(OmegaSharpeRatio(portfolio_bacon[,1], MAR)) #expected 0.29
+[1] 0.2917933
+>
+> MAR = 0
+> data(managers)
+> print(OmegaSharpeRatio(managers['1996'], MAR))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6
+OmegaSharpeRatio (MAR = 0%) 3.598338 2374 5.482813 2.615074 NA NA
+ EDHEC LS EQ SP500 TR US 10Y TR US 3m TR
+OmegaSharpeRatio (MAR = 0%) NA 3.340625 0.02827709 Inf
+> print(OmegaSharpeRatio(managers['1996',1], MAR)) #expected 3.60
+[1] 3.598338
+>
+>
+>
+> cleanEx()
+> nameEx("PainIndex")
+> ### * PainIndex
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: PainIndex
+> ### Title: Pain index of the return distribution
+> ### Aliases: PainIndex
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(PainIndex(portfolio_bacon[,1])) #expected 0.04
+ portfolio.monthly.return....
+Pain Index 0.0390113
+>
+> data(managers)
+> print(PainIndex(100*managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6 EDHEC LS EQ SP500 TR
+Pain Index 0.3714087 0.002 0.9421759 0.7421641 NaN NaN NaN 0.7336052
+ US 10Y TR US 3m TR
+Pain Index 3.697961 0
+> print(PainIndex(100*managers['1996',1]))
+ HAM1
+Pain Index 0.3714087
+>
+>
+>
+> cleanEx()
+> nameEx("PainRatio")
+> ### * PainRatio
+>
+> flush(stderr()); flush(stdout())
+>
+> ### Name: PainRatio
+> ### Title: Pain ratio of the return distribution
+> ### Aliases: PainRatio
+> ### Keywords: distribution models multivariate ts
+>
+> ### ** Examples
+>
+> data(portfolio_bacon)
+> print(PainRatio(portfolio_bacon[,1])) #expected 2.66
+ portfolio.monthly.return....
+Pain Index 2.657647
+>
+> data(managers)
+> print(PainRatio(managers['1996']))
+ HAM1 HAM2 HAM3 HAM4 HAM5 HAM6 EDHEC LS EQ
+Pain Ratio (Rf = 0) 36.7226 36650.56 43.38967 28.17458 NA NA NA
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/returnanalytics -r 2295
More information about the Returnanalytics-commits
mailing list