[Returnanalytics-commits] r2651 - in pkg/PerformanceAnalytics/sandbox/Shubhankit: Week1 Week1/Code Week1/Vignette Week4/Code Week5/Code

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 27 12:10:07 CEST 2013


Author: shubhanm
Date: 2013-07-27 12:10:07 +0200 (Sat, 27 Jul 2013)
New Revision: 2651

Added:
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Return.Okunev.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.tex
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio-concordance.tex
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.log
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/OkunevWhite-Graph1.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/OkunevWhite-Graph10.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/OkunevWhite-concordance.tex
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/OkunevWhite.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/OkunevWhite.log
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/OkunevWhite.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/OkunevWhite.tex
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/Rplots.pdf
Modified:
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/LoSharpe.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week4/Code/AcarSim.R.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week5/Code/CDrawdown.R
Log:
Modified : Week 5 and Week 1 Code
Final Vignette : Week 1

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/LoSharpe.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/LoSharpe.R	2013-07-26 19:45:12 UTC (rev 2650)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/LoSharpe.R	2013-07-27 10:10:07 UTC (rev 2651)
@@ -1,31 +1,31 @@
-#'@title Andrew Lo Sharpe Ratio
-#'@description
-#' Although the Sharpe ratio has become part of the canon of modern financial 
-#' analysis, its applications typically do not account for the fact that it is an
-#' estimated quantity, subject to estimation errors that can be substantial in 
-#' some cases.
-#' 
-#' Many studies have documented various violations of the assumption of 
-#' IID returns for financial securities.
-#' 
-#' Under the assumption of stationarity,a version of the Central Limit Theorem can 
-#' still be  applied to the estimator .
-#' @param Ra an xts, vector, matrix, data frame, timeSeries or zoo object of
-#' daily asset returns
-#' @param Rf an xts, vector, matrix, data frame, timeSeries or zoo object of
-#' annualized Risk Free Rate
-#' @param q Number of autocorrelated lag periods. Taken as 3 (Default)
-#' @param \dots any other passthru parameters
-#' @author R
-#' @references "The Statistics of Sharpe Ratios" Andrew. W. Lo
-#' 
-#' @keywords ts multivariate distribution models non-iid 
-#' @examples
-#' 
-#' data(edhec)
-#' head(LoSharpe(edhec,0,3)
-#' 
-#' @export
+##'@title Andrew Lo Sharpe Ratio
+##'@description
+##' Although the Sharpe ratio has become part of the canon of modern financial 
+##' analysis, its applications typically do not account for the fact that it is an
+##' estimated quantity, subject to estimation errors that can be substantial in 
+##' some cases.
+##' 
+##' Many studies have documented various violations of the assumption of 
+##' IID returns for financial securities.
+##' 
+##' Under the assumption of stationarity,a version of the Central Limit Theorem can 
+##' still be  applied to the estimator .
+##' @param Ra an xts, vector, matrix, data frame, timeSeries or zoo object of
+##' daily asset returns
+##' @param Rf an xts, vector, matrix, data frame, timeSeries or zoo object of
+##' annualized Risk Free Rate
+##' @param q Number of autocorrelated lag periods. Taken as 3 (Default)
+##' @param \dots any other passthru parameters
+##' @author R
+##' @references "The Statistics of Sharpe Ratios" Andrew. W. Lo
+##' 
+##' @keywords ts multivariate distribution models non-iid 
+##' @examples
+##' 
+##' data(edhec)
+##' head(LoSharpe(edhec,0,3)
+##' 
+##' @export
 LoSharpe <-
   function (Ra,Rf = 0,q = 3, ...)
   { # @author Brian G. Peterson, Peter Carl

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R	2013-07-26 19:45:12 UTC (rev 2650)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R	2013-07-27 10:10:07 UTC (rev 2651)
@@ -1,12 +1,3 @@
-quad <- function(R,d)
-{
-  coeff = as.numeric(acf(as.numeric(edhec[,1]), plot = FALSE)[1:2][[1]])
-b=-(1+coeff[2]-2*d*coeff[1])
-c=(coeff[1]-d)
-  ans= (-b-sqrt(b*b-4*c*c))/(2*c)
-  a <- a[!is.na(a)]
-  return(c(ans))               
-}
 Return.Okunev<-function(R,q=3)
 {
   column.okunev=R
@@ -18,3 +9,13 @@
   }
   return(c(column.okunev))
 }
+
+quad <- function(R,d)
+{
+  coeff = as.numeric(acf(as.numeric(edhec[,1]), plot = FALSE)[1:2][[1]])
+b=-(1+coeff[2]-2*d*coeff[1])
+c=(coeff[1]-d)
+  ans= (-b-sqrt(b*b-4*c*c))/(2*c)
+  #a <- a[!is.na(a)]
+  return(c(ans))               
+}

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Return.Okunev.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Return.Okunev.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Return.Okunev.R	2013-07-27 10:10:07 UTC (rev 2651)
@@ -0,0 +1,20 @@
+quad <- function(R,d)
+{
+  coeff = as.numeric(acf(as.numeric(edhec[,1]), plot = FALSE)[1:2][[1]])
+b=-(1+coeff[2]-2*d*coeff[1])
+c=(coeff[1]-d)
+  ans= (-b-sqrt(b*b-4*c*c))/(2*c)
+  a <- a[!is.na(a)]
+  return(c(ans))               
+}
+Return.Okunev<-function(R,q=3)
+{
+  column.okunev=R
+  column.okunev <- column.okunev[!is.na(column.okunev)]
+  for(i in 1:q)
+  {
+    lagR = lag(column.okunev, k=i)
+    column.okunev= (column.okunev-(lagR*quad(lagR,0)))/(1-quad(lagR,0))
+  }
+  return(c(column.okunev))
+}

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.Rnw
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.Rnw	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.Rnw	2013-07-27 10:10:07 UTC (rev 2651)
@@ -0,0 +1,107 @@
+%% no need for  \DeclareGraphicsExtensions{.pdf,.eps}
+
+\documentclass[12pt,letterpaper,english]{article}
+\usepackage{times}
+\usepackage[T1]{fontenc}
+\IfFileExists{url.sty}{\usepackage{url}}
+                      {\newcommand{\url}{\texttt}}
+
+\usepackage{babel}
+%\usepackage{noweb}
+\usepackage{Rd}
+
+\usepackage{Sweave}
+\SweaveOpts{engine=R,eps=FALSE}
+%\VignetteIndexEntry{Performance Attribution from Bacon}
+%\VignetteDepends{PerformanceAnalytics}
+%\VignetteKeywords{returns, performance, risk, benchmark, portfolio}
+%\VignettePackage{PerformanceAnalytics}
+
+%\documentclass[a4paper]{article}
+%\usepackage[noae]{Sweave}
+%\usepackage{ucs}
+%\usepackage[utf8x]{inputenc}
+%\usepackage{amsmath, amsthm, latexsym}
+%\usepackage[top=3cm, bottom=3cm, left=2.5cm]{geometry}
+%\usepackage{graphicx}
+%\usepackage{graphicx, verbatim}
+%\usepackage{ucs}
+%\usepackage[utf8x]{inputenc}
+%\usepackage{amsmath, amsthm, latexsym}
+%\usepackage{graphicx}
+
+\title{GLM Smoothing Index}
+\author{R Project for Statistical Computing}
+
+\begin{document}
+\SweaveOpts{concordance=TRUE}
+
+\maketitle
+
+
+\begin{abstract}
+The returns to hedge funds and other alternative investments are often highly serially correlated.Gemanstsy,Lo and Markov propose an econometric model of return smoothingand develop estimators for the smoothing profile.The magnitude of impact is measured by the smoothing index, which is a measure of concentration of weight in lagged terms.
+\end{abstract}
+
+<<echo=FALSE >>=
+library(PerformanceAnalytics)
+data(edhec)
+@
+
+<<echo=FALSE>>=
+source("../code/GLMSmoothIndex.R")
+@
+
+\section{Background}
+To quantify the impact of all of these possible sources of serial correlation, denote by \(R_t\),the true economic return of a hedge fund in period t; and let \(R_t\) satisfy the following linear single-factor model:
+
+\begin{equation}
+ R_t  =   \\ {\mu} + {\beta}{{\delta}}_t+ \xi_t
+\end{equation}
+
+Where $\xi_t,  \sim N(0,1)$
+and Var[\(R_t\)] = $\sigma$\ \(^2\)
+
+True returns represent the flow of information that would determine the equilibrium value of the fund's securities in a frictionless market. However, true economic returns are not observed. Instead, \(R_t^0\) denotes the reported or observed return in period t; and let
+%$Z = \sin(X)$. $\sqrt{X}$.
+  
+%$\hat{\mu}$ = $\displaystyle\frac{22}{7}$
+%e^{2 \mu} = 1
+%\begin{equation}
+%\left(\sum_{t=1}^{T} R_t/T\right) = \hat{\mu} \\
+%\end{equation}
+\begin{equation}
+ R_t^0  = \theta _0R_{t} + \theta _1R_{t-1}+\theta _2R_{t-2}  + \cdots +  \theta _kR_{t-k}\\
+\end{equation}
+\begin{equation}
+\theta _j \epsilon [0,1] where : j = 0,1, \cdots , k  \\
+\end{equation}
+
+and 
+%\left(\mu \right) =  \sum_{t=1}^{T} \(Ri)/T\ \\
+\begin{equation}
+\theta _1 + \theta _2 + \theta _3 \cdots + \theta _k = 1  \\
+\end{equation}
+
+which is a weighted average of the fund's true returns over the most recent k + 1
+periods, including the current period.
+
+\section{Smoothing Index}
+A useful summary statistic for measuringthe concentration of weights is :
+\begin{equation}
+\xi =   \sum_{j=0}^{k} \theta _j^2 \\
+\end{equation}
+
+This measure is well known in the industrial organization literature as the Herfindahl index, a measure of the concentration of firms in a given industry where $\theta$\(_j\) represents the market share of firm j. Becaus $\xi_t$\ is confined to the unit interval, and is minimized when all the $\theta$\(_j\) 's are identical, which implies a value of 1/k+1 for $\xi_i$\ ; and is maximized when one coefficient is 1 and the rest are 0. In the context of smoothed returns, a lower value of implies more smoothing, and the upper bound of 1 implies no smoothing, hence we shall refer to $\theta$\(_j\) as a ''\textbf{smoothingindex}''.
+
+\section{Usage}
+
+In this example we use edhec database, to compute Smoothing Index for Hedge Fund Returns.
+<<>>=
+library(PerformanceAnalytics)
+data(edhec)
+GLMSmoothIndex(edhec)
+@
+
+
+\end{document}
\ No newline at end of file

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.pdf
===================================================================
(Binary files differ)


Property changes on: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.pdf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.tex
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.tex	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/GLMSmoothIndex.tex	2013-07-27 10:10:07 UTC (rev 2651)
@@ -0,0 +1,112 @@
+%% no need for  \DeclareGraphicsExtensions{.pdf,.eps}
+
+\documentclass[12pt,letterpaper,english]{article}
+\usepackage{times}
+\usepackage[T1]{fontenc}
+\IfFileExists{url.sty}{\usepackage{url}}
+                      {\newcommand{\url}{\texttt}}
+
+\usepackage{babel}
+%\usepackage{noweb}
+\usepackage{Rd}
+
+\usepackage{Sweave}
+
+%\VignetteIndexEntry{Performance Attribution from Bacon}
+%\VignetteDepends{PerformanceAnalytics}
+%\VignetteKeywords{returns, performance, risk, benchmark, portfolio}
+%\VignettePackage{PerformanceAnalytics}
+
+%\documentclass[a4paper]{article}
+%\usepackage[noae]{Sweave}
+%\usepackage{ucs}
+%\usepackage[utf8x]{inputenc}
+%\usepackage{amsmath, amsthm, latexsym}
+%\usepackage[top=3cm, bottom=3cm, left=2.5cm]{geometry}
+%\usepackage{graphicx}
+%\usepackage{graphicx, verbatim}
+%\usepackage{ucs}
+%\usepackage[utf8x]{inputenc}
+%\usepackage{amsmath, amsthm, latexsym}
+%\usepackage{graphicx}
+
+\title{GLM Smoothing Index}
+\author{R Project for Statistical Computing}
+
+\begin{document}
+\input{GLMSmoothIndex-concordance}
+
+\maketitle
+
+
+\begin{abstract}
+The returns to hedge funds and other alternative investments are often highly serially correlated.Gemanstsy,Lo and Markov propose an econometric model of return smoothingand develop estimators for the smoothing profile.The magnitude of impact is measured by the smoothing index, which is a measure of concentration of weight in lagged terms.
+\end{abstract}
+
+
+
+\section{Background}
+To quantify the impact of all of these possible sources of serial correlation, denote by \(R_t\),the true economic return of a hedge fund in period t; and let \(R_t\) satisfy the following linear single-factor model:
+
+\begin{equation}
+ R_t  =   \\ {\mu} + {\beta}{{\delta}}_t+ \xi_t
+\end{equation}
+
+Where $\xi_t,  \sim N(0,1)$
+and Var[\(R_t\)] = $\sigma$\ \(^2\)
+
+True returns represent the flow of information that would determine the equilibrium value of the fund's securities in a frictionless market. However, true economic returns are not observed. Instead, \(R_t^0\) denotes the reported or observed return in period t; and let
+%$Z = \sin(X)$. $\sqrt{X}$.
+  
+%$\hat{\mu}$ = $\displaystyle\frac{22}{7}$
+%e^{2 \mu} = 1
+%\begin{equation}
+%\left(\sum_{t=1}^{T} R_t/T\right) = \hat{\mu} \\
+%\end{equation}
+\begin{equation}
+ R_t^0  = \theta _0R_{t} + \theta _1R_{t-1}+\theta _2R_{t-2}  + \cdots +  \theta _kR_{t-k}\\
+\end{equation}
+\begin{equation}
+\theta _j \epsilon [0,1] where : j = 0,1, \cdots , k  \\
+\end{equation}
+
+and 
+%\left(\mu \right) =  \sum_{t=1}^{T} \(Ri)/T\ \\
+\begin{equation}
+\theta _1 + \theta _2 + \theta _3 \cdots + \theta _k = 1  \\
+\end{equation}
+
+which is a weighted average of the fund's true returns over the most recent k + 1
+periods, including the current period.
+
+\section{Smoothing Index}
+A useful summary statistic for measuringthe concentration of weights is :
+\begin{equation}
+\xi =   \sum_{j=0}^{k} \theta _j^2 \\
+\end{equation}
+
+This measure is well known in the industrial organization literature as the Herfindahl index, a measure of the concentration of firms in a given industry where $\theta$\(_j\) represents the market share of firm j. Becaus $\xi_t$\ is confined to the unit interval, and is minimized when all the $\theta$\(_j\) 's are identical, which implies a value of 1/k+1 for $\xi_i$\ ; and is maximized when one coefficient is 1 and the rest are 0. In the context of smoothed returns, a lower value of implies more smoothing, and the upper bound of 1 implies no smoothing, hence we shall refer to $\theta$\(_j\) as a ''\textbf{smoothingindex}''.
+
+\section{Usage}
+
+In this example we use edhec database, to compute Smoothing Index for Hedge Fund Returns.
+\begin{Schunk}
+\begin{Sinput}
+> library(PerformanceAnalytics)
+> data(edhec)
+> GLMSmoothIndex(edhec)
+\end{Sinput}
+\begin{Soutput}
+                 Convertible Arbitrage CTA Global Distressed Securities
+GLM Smooth Index             0.3487825  0.1866095             0.3187229
+                 Emerging Markets Equity Market Neutral Event Driven
+GLM Smooth Index        0.3022908             0.2046973    0.3580198
+                 Fixed Income Arbitrage Global Macro Long/Short Equity
+GLM Smooth Index              0.3090088     0.252546          0.277132
+                 Merger Arbitrage Relative Value Short Selling Funds of Funds
+GLM Smooth Index        0.2292355      0.2917355     0.2348319      0.2873716
+\end{Soutput}
+\end{Schunk}
+
+
+\end{document}

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio-concordance.tex
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio-concordance.tex	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio-concordance.tex	2013-07-27 10:10:07 UTC (rev 2651)
@@ -0,0 +1,2 @@
+\Sconcordance{concordance:LoSharpeRatio.tex:LoSharpeRatio.Rnw:%
+1 50 1 1 5 1 4 50 1 1 2 1 0 2 1 13 0 1 2 2 1}

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.Rnw
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.Rnw	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.Rnw	2013-07-27 10:10:07 UTC (rev 2651)
@@ -0,0 +1,118 @@
+%% no need for  \DeclareGraphicsExtensions{.pdf,.eps}
+
+\documentclass[12pt,letterpaper,english]{article}
+\usepackage{times}
+\usepackage[T1]{fontenc}
+\IfFileExists{url.sty}{\usepackage{url}}
+                      {\newcommand{\url}{\texttt}}
+
+\usepackage{babel}
+%\usepackage{noweb}
+\usepackage{Rd}
+
+\usepackage{Sweave}
+\SweaveOpts{engine=R,eps=FALSE}
+%\VignetteIndexEntry{Performance Attribution from Bacon}
+%\VignetteDepends{PerformanceAnalytics}
+%\VignetteKeywords{returns, performance, risk, benchmark, portfolio}
+%\VignettePackage{PerformanceAnalytics}
+
+%\documentclass[a4paper]{article}
+%\usepackage[noae]{Sweave}
+%\usepackage{ucs}
+%\usepackage[utf8x]{inputenc}
+%\usepackage{amsmath, amsthm, latexsym}
+%\usepackage[top=3cm, bottom=3cm, left=2.5cm]{geometry}
+%\usepackage{graphicx}
+%\usepackage{graphicx, verbatim}
+%\usepackage{ucs}
+%\usepackage[utf8x]{inputenc}
+%\usepackage{amsmath, amsthm, latexsym}
+%\usepackage{graphicx}
+
+\title{Lo Sharpe Ratio}
+\author{R Project for Statistical Computing}
+
+\begin{document}
+\SweaveOpts{concordance=TRUE}
+
+\maketitle
+
+
+\begin{abstract}
+The building blocks of the Sharpe ratio-expected returns and volatilities-
+are unknown quantities that must be estimated statistically and are,
+therefore, subject to estimation error.In an illustrative
+empirical example of mutual funds and hedge funds, Andrew Lo finds that the annual Sharpe ratio for a hedge fund can be overstated by as much as 65 percent
+because of the presence of serial correlation in monthly returns, and once
+this serial correlation is properly taken into account, the rankings of hedge
+funds based on Sharpe ratios can change dramatically.
+\end{abstract}
+
+<<echo=FALSE >>=
+library(PerformanceAnalytics)
+data(edhec)
+@
+
+<<echo=FALSE>>=
+source("../code/LoSharpe.R")
+@
+
+\section{Background}
+Given a sample of historical returns \((R_1,R_2, . . .,R_T)\), the standard estimators for these moments are the sample mean and variance:
+
+%Let $X \sim N(0,1)$ and $Y \sim \textrm{Exponential}(\mu)$.  Let
+%$Z = \sin(X)$. $\sqrt{X}$.
+  
+%$\hat{\mu}$ = $\displaystyle\frac{22}{7}$
+%e^{2 \mu} = 1
+%\begin{equation}
+%\left(\sum_{t=1}^{T} R_t/T\right) = \hat{\mu} \\
+%\end{equation}
+\begin{equation}
+ \hat{\mu}  =  \sum_{t=1}^{T} (R_t)/T\\
+\end{equation}
+\begin{equation}
+\hat{\sigma^2}  =  \sum_{t=1}^{T} (R_t-\hat{\mu})^2/T\\
+\end{equation}
+
+From which the estimator of the Sharpe ratio $\hat{SR}$ follows immediately:
+%\left(\mu \right) =  \sum_{t=1}^{T} \(Ri)/T\ \\
+\begin{equation}
+\hat{SR}  =  (\hat{\mu}- R_f)/\hat{\sigma} \\
+\end{equation}
+
+Using a set of techniques collectively known as "large-sample'' or "asymptotic'' statistical theory in which the Central Limit Theorem is applied to
+estimators such as and , the distribution of and other nonlinear functions of and can be easily derived.
+
+\section{Non-IID Returns}
+The relationship between SR and SR(q) is somewhat more involved for non-
+IID returns because the variance of Rt(q) is not just the sum of the variances of component returns but also includes all the covariances. Specifically, under
+the assumption that returns \(R_t\) are stationary,
+\begin{equation}
+Var[(R_t)] =   \sum_{i=0}^{q-1} \sum_{j=1}^{q-1} Cov(R(t-i),R(t-j)) = q\hat{\sigma^2} + 2\hat{\sigma^2} \sum_{k=1}^{q-1} (q-k)\rho_k \\
+\end{equation}
+
+Where  $\rho$\(_k\) = Cov(\(R(t)\),\(R(t-k\)))/Var[\(R_t\)] is the \(k^{th}\) order autocorrelation coefficient of the series of returns.This yields the following relationship between SR and SR(q):
+
+\begin{equation}
+\hat{SR}(q)  =  \eta(q) \\
+\end{equation}
+
+Where :
+
+\begin{equation}
+\eta(q)  =  \frac{q}{\sqrt{(q\hat{\sigma^2} + 2\hat{\sigma^2} \sum_{k=1}^{q-1} (q-k)\rho_k)}} \\
+\end{equation}
+
+\section{Usage}
+
+In this example we use edhec database, to compute Sharpe Ratio for Hedge Fund Returns.
+<<>>=
+library(PerformanceAnalytics)
+data(edhec)
+LoSharpe(edhec)
+@
+
+
+\end{document}
\ No newline at end of file

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.log
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.log	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Vignette/LoSharpeRatio.log	2013-07-27 10:10:07 UTC (rev 2651)
@@ -0,0 +1,354 @@
+This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9) (preloaded format=pdflatex 2013.7.14)  26 JUL 2013 23:22
+entering extended mode
+**LoSharpeRatio.tex
+
+("C:\Users\shubhankit\Desktop\New folder\pkg\PerformanceAnalytics\sandbox\Shubh
+ankit\Week1\Vignette\LoSharpeRatio.tex"
+LaTeX2e <2011/06/27>
+Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
+abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic, 
+croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
+lician, german, german-x-2012-05-30, greek, gujarati, hindi, hungarian, iceland
+ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
+ lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
+german-x-2012-05-30, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
+ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
+an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
+ishmax, welsh, loaded.
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
+Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size12.clo"
+File: size12.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
+)
+\c at part=\count79
+\c at section=\count80
+\c at subsection=\count81
+\c at subsubsection=\count82
+\c at paragraph=\count83
+\c at subparagraph=\count84
+\c at figure=\count85
+\c at table=\count86
+\abovecaptionskip=\skip41
+\belowcaptionskip=\skip42
+\bibindent=\dimen102
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\times.sty"
+Package: times 2005/04/12 PSNFSS-v9.2a (SPQR) 
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\fontenc.sty"
+Package: fontenc 2005/09/27 v1.99g Standard LaTeX package
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\t1enc.def"
+File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file
+LaTeX Font Info:    Redeclaring font encoding T1 on input line 43.
+))
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ltxmisc\url.sty"
+\Urlmuskip=\muskip10
+Package: url 2006/04/12  ver 3.3  Verb mode for urls, etc.
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\babel\babel.sty"
+Package: babel 2008/07/08 v3.8m The Babel package
+
+*************************************
+* Local config file bblopts.cfg used
+*
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\bblopts.cfg"
+File: bblopts.cfg 2006/07/31 v1.0 MiKTeX 'babel' configuration
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\babel\english.ldf"
+Language: english 2005/03/30 v3.3o English support from the babel system
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\babel\babel.def"
+File: babel.def 2008/07/08 v3.8m Babel common definitions
+\babel at savecnt=\count87
+\U at D=\dimen103
+)
+\l at canadian = a dialect from \language\l at american 
+\l at australian = a dialect from \language\l at british 
+\l at newzealand = a dialect from \language\l at british 
+))
+(C:/PROGRA~1/R/R-30~1.1/share/texmf/tex/latex\Rd.sty
+Package: Rd 
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ifthen.sty"
+Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\longtable.sty"
+Package: longtable 2004/02/01 v4.11 Multi-page Table package (DPC)
+\LTleft=\skip43
+\LTright=\skip44
+\LTpre=\skip45
+\LTpost=\skip46
+\LTchunksize=\count88
+\LTcapwidth=\dimen104
+\LT at head=\box26
+\LT at firsthead=\box27
+\LT at foot=\box28
+\LT at lastfoot=\box29
+\LT at cols=\count89
+\LT at rows=\count90
+\c at LT@tables=\count91
+\c at LT@chunks=\count92
+\LT at p@ftn=\toks14
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\bm.sty"
+Package: bm 2004/02/26 v1.1c Bold Symbol Support (DPC/FMi)
+\symboldoperators=\mathgroup4
+\symboldletters=\mathgroup5
+\symboldsymbols=\mathgroup6
+LaTeX Font Info:    Redeclaring math alphabet \mathbf on input line 138.
+LaTeX Info: Redefining \bm on input line 204.
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\alltt.sty"
+Package: alltt 1997/06/16 v2.0g defines alltt environment
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\verbatim.sty"
+Package: verbatim 2003/08/22 v1.5q LaTeX2e package for verbatim enhancements
+\every at verbatim=\toks15
+\verbatim at line=\toks16
+\verbatim at in@stream=\read1
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\upquote\upquote.sty"
+Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
+tim
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\textcomp.sty"
+Package: textcomp 2005/09/27 v1.99g Standard LaTeX package
+Package textcomp Info: Sub-encoding information:
+(textcomp)               5 = only ISO-Adobe without \textcurrency
+(textcomp)               4 = 5 + \texteuro
+(textcomp)               3 = 4 + \textohm
+(textcomp)               2 = 3 + \textestimated + \textcurrency
+(textcomp)               1 = TS1 - \textcircled - \t
+(textcomp)               0 = TS1 (full)
+(textcomp)             Font families with sub-encoding setting implement
+(textcomp)             only a restricted character set as indicated.
+(textcomp)             Family '?' is the default used for unknown fonts.
+(textcomp)             See the documentation for details.
+Package textcomp Info: Setting ? sub-encoding to TS1/1 on input line 71.
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ts1enc.def"
+File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
+)
+LaTeX Info: Redefining \oldstylenums on input line 266.
+Package textcomp Info: Setting cmr sub-encoding to TS1/0 on input line 281.
+Package textcomp Info: Setting cmss sub-encoding to TS1/0 on input line 282.
+Package textcomp Info: Setting cmtt sub-encoding to TS1/0 on input line 283.
+Package textcomp Info: Setting cmvtt sub-encoding to TS1/0 on input line 284.
+Package textcomp Info: Setting cmbr sub-encoding to TS1/0 on input line 285.
+Package textcomp Info: Setting cmtl sub-encoding to TS1/0 on input line 286.
+Package textcomp Info: Setting ccr sub-encoding to TS1/0 on input line 287.
+Package textcomp Info: Setting ptm sub-encoding to TS1/4 on input line 288.
+Package textcomp Info: Setting pcr sub-encoding to TS1/4 on input line 289.
+Package textcomp Info: Setting phv sub-encoding to TS1/4 on input line 290.
+Package textcomp Info: Setting ppl sub-encoding to TS1/3 on input line 291.
+Package textcomp Info: Setting pag sub-encoding to TS1/4 on input line 292.
+Package textcomp Info: Setting pbk sub-encoding to TS1/4 on input line 293.
+Package textcomp Info: Setting pnc sub-encoding to TS1/4 on input line 294.
+Package textcomp Info: Setting pzc sub-encoding to TS1/4 on input line 295.
+Package textcomp Info: Setting bch sub-encoding to TS1/4 on input line 296.
+Package textcomp Info: Setting put sub-encoding to TS1/5 on input line 297.
+Package textcomp Info: Setting uag sub-encoding to TS1/5 on input line 298.
+Package textcomp Info: Setting ugq sub-encoding to TS1/5 on input line 299.
+Package textcomp Info: Setting ul8 sub-encoding to TS1/4 on input line 300.
+Package textcomp Info: Setting ul9 sub-encoding to TS1/4 on input line 301.
+Package textcomp Info: Setting augie sub-encoding to TS1/5 on input line 302.
+Package textcomp Info: Setting dayrom sub-encoding to TS1/3 on input line 303.
+Package textcomp Info: Setting dayroms sub-encoding to TS1/3 on input line 304.
+
+Package textcomp Info: Setting pxr sub-encoding to TS1/0 on input line 305.
+Package textcomp Info: Setting pxss sub-encoding to TS1/0 on input line 306.
+Package textcomp Info: Setting pxtt sub-encoding to TS1/0 on input line 307.
+Package textcomp Info: Setting txr sub-encoding to TS1/0 on input line 308.
+Package textcomp Info: Setting txss sub-encoding to TS1/0 on input line 309.
+Package textcomp Info: Setting txtt sub-encoding to TS1/0 on input line 310.
+Package textcomp Info: Setting lmr sub-encoding to TS1/0 on input line 311.
+Package textcomp Info: Setting lmdh sub-encoding to TS1/0 on input line 312.
+Package textcomp Info: Setting lmss sub-encoding to TS1/0 on input line 313.
+Package textcomp Info: Setting lmssq sub-encoding to TS1/0 on input line 314.
+Package textcomp Info: Setting lmvtt sub-encoding to TS1/0 on input line 315.
+Package textcomp Info: Setting qhv sub-encoding to TS1/0 on input line 316.
+Package textcomp Info: Setting qag sub-encoding to TS1/0 on input line 317.
+Package textcomp Info: Setting qbk sub-encoding to TS1/0 on input line 318.
+Package textcomp Info: Setting qcr sub-encoding to TS1/0 on input line 319.
+Package textcomp Info: Setting qcs sub-encoding to TS1/0 on input line 320.
+Package textcomp Info: Setting qpl sub-encoding to TS1/0 on input line 321.
+Package textcomp Info: Setting qtm sub-encoding to TS1/0 on input line 322.
+Package textcomp Info: Setting qzc sub-encoding to TS1/0 on input line 323.
+Package textcomp Info: Setting qhvc sub-encoding to TS1/0 on input line 324.
+Package textcomp Info: Setting futs sub-encoding to TS1/4 on input line 325.
+Package textcomp Info: Setting futx sub-encoding to TS1/4 on input line 326.
+Package textcomp Info: Setting futj sub-encoding to TS1/4 on input line 327.
+Package textcomp Info: Setting hlh sub-encoding to TS1/3 on input line 328.
+Package textcomp Info: Setting hls sub-encoding to TS1/3 on input line 329.
+Package textcomp Info: Setting hlst sub-encoding to TS1/3 on input line 330.
+Package textcomp Info: Setting hlct sub-encoding to TS1/5 on input line 331.
+Package textcomp Info: Setting hlx sub-encoding to TS1/5 on input line 332.
+Package textcomp Info: Setting hlce sub-encoding to TS1/5 on input line 333.
+Package textcomp Info: Setting hlcn sub-encoding to TS1/5 on input line 334.
+Package textcomp Info: Setting hlcw sub-encoding to TS1/5 on input line 335.
+Package textcomp Info: Setting hlcf sub-encoding to TS1/5 on input line 336.
+Package textcomp Info: Setting pplx sub-encoding to TS1/3 on input line 337.
+Package textcomp Info: Setting pplj sub-encoding to TS1/3 on input line 338.
+Package textcomp Info: Setting ptmx sub-encoding to TS1/4 on input line 339.
+Package textcomp Info: Setting ptmj sub-encoding to TS1/4 on input line 340.
+))
+\ldescriptionwidth=\skip47
+
+NOT loading ae NOT loading times NOT loading lmodern)
+(C:/PROGRA~1/R/R-30~1.1/share/texmf/tex/latex\Sweave.sty
+Package: Sweave 
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
+Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
+Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
+\KV at toks@=\toks17
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
+Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
+Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
+File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
+)
+Package graphics Info: Driver file: pdftex.def on input line 91.
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
+File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
+Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
+Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
+)
+\Gread at gobject=\count93
+))
+\Gin at req@height=\dimen105
+\Gin at req@width=\dimen106
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\fancyvrb\fancyvrb.sty"
+Package: fancyvrb 2008/02/07
+
+Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
+<2008/02/07> (tvz)
+\FV at CodeLineNo=\count94
+\FV at InFile=\read2
+\FV at TabBox=\box30
+\c at FancyVerbLine=\count95
+\FV at StepNumber=\count96
+\FV at OutFile=\write3
+)
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\fontenc.sty"
+Package: fontenc 2005/09/27 v1.99g Standard LaTeX package
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\t1enc.def"
+File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file
+LaTeX Font Info:    Redeclaring font encoding T1 on input line 43.
+))
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ae\ae.sty"
+Package: ae 2001/02/12 1.3 Almost European Computer Modern
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\fontenc.sty"
+Package: fontenc 2005/09/27 v1.99g Standard LaTeX package
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\t1enc.def"
+File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file
+LaTeX Font Info:    Redeclaring font encoding T1 on input line 43.
+)
+LaTeX Font Info:    Try loading font information for T1+aer on input line 100.
+
+("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ae\t1aer.fd"
+File: t1aer.fd 1997/11/16 Font definitions for T1/aer.
+))))
+("C:\Users\shubhankit\Desktop\New folder\pkg\PerformanceAnalytics\sandbox\Shubh
+ankit\Week1\Vignette\LoSharpeRatio.aux")
+LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 36.
+LaTeX Font Info:    ... okay on input line 36.
+LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 36.
+LaTeX Font Info:    ... okay on input line 36.
+LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 36.
+LaTeX Font Info:    ... okay on input line 36.
+LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 36.
+LaTeX Font Info:    ... okay on input line 36.
+LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 36.
+LaTeX Font Info:    ... okay on input line 36.
+LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 36.
+LaTeX Font Info:    ... okay on input line 36.
+LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 36.
+LaTeX Font Info:    Try loading font information for TS1+cmr on input line 36.
+
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/returnanalytics -r 2651


More information about the Returnanalytics-commits mailing list