[Uwgarp-commits] r169 - pkg/GARPFRM/demo
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Apr 16 07:48:49 CEST 2014
Author: tfillebeen
Date: 2014-04-16 07:48:48 +0200 (Wed, 16 Apr 2014)
New Revision: 169
Modified:
pkg/GARPFRM/demo/PerformanceMeasures.R
Log:
Small issue w/ Performance Demo
Modified: pkg/GARPFRM/demo/PerformanceMeasures.R
===================================================================
--- pkg/GARPFRM/demo/PerformanceMeasures.R 2014-04-16 05:47:38 UTC (rev 168)
+++ pkg/GARPFRM/demo/PerformanceMeasures.R 2014-04-16 05:48:48 UTC (rev 169)
@@ -1,10 +1,6 @@
-
-
library(knitr)
opts_chunk$set(cache=TRUE, tidy=FALSE, warning=FALSE, fig.width=5, fig.height=5)
-
-
# Load the GARPFRM package and the CRSP dataset.
suppressPackageStartupMessages(library(GARPFRM))
data(crsp.short)
@@ -23,8 +19,6 @@
R.Ex.portfolio <- R.portfolio - rf
R.Ex.market <- R.market - rf
-
-
# Compute portfolio beta using the covariance of the portfolio and benchmark
# portfolio returns divided by the variance of the market portfolio returns
cov(R.Ex.portfolio, R.Ex.market) / var(R.Ex.market)
@@ -36,8 +30,6 @@
# We can also directly use the CAPM.beta function from PerformanceAnalytics
CAPM.beta(R.portfolio, R.market, rf)
-
-
# Treynor ratio for portfolio and market
# Treynor Ratio for portfolio
@@ -46,8 +38,6 @@
# Treynor Ratio for market
TreynorRatio(R.market, R.market, rf)
-
-
# Compute Sharpe and annualized Sharpe Ratio
# Sub-period Sharpe Ratio
SharpeRatio(R.portfolio, rf, FUN="StdDev")
@@ -55,12 +45,8 @@
# Annualized Sharpe Ratio
SharpeRatio.annualized(R.portfolio, rf)
-
-
SharpeRatio(R.portfolio, rf, p=0.95, FUN=c("VaR", "ES"))
-
-
# Compute Jensen's alpha by carrying out a linear regression
fit <- lm(R.Ex.portfolio ~ R.Ex.market)
alpha <- coef(fit)[1]
@@ -80,16 +66,12 @@
# Jensen's alpha
R.P - mean(rf) - beta * (R.M - mean(rf))
-
-
# Compute Tracking Error
TrackingError(R.portfolio, R.market)
# Replicate TrackingError
sd(R.portfolio - R.market) * sqrt(12)
-
-
# Compute Information Ratio
# InformationRatio = ActivePremium / TrackingError
# Active Premium = Investment's annualized return - Benchmark's annualized return
@@ -100,17 +82,10 @@
trackingError <- TrackingError(R.portfolio, R.market)
activePremium / trackingError
-
-
-
# Compute Downside Deviation
MAR <- 0
# PA computation of Downside Deviation
DownsideDeviation(R.portfolio, MAR)
-
-
# Compute Sortino Ratio
-SortinoRatio(R.portfolio, MAR)
-
-
+SortinoRatio(R.portfolio, MAR)
\ No newline at end of file
More information about the Uwgarp-commits
mailing list