[Returnanalytics-commits] r3108 - in pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm: . R man vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Sep 15 10:39:12 CEST 2013
Author: shubhanm
Date: 2013-09-15 10:39:12 +0200 (Sun, 15 Sep 2013)
New Revision: 3108
Added:
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/table.normDD.R
Modified:
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/DESCRIPTION
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/NAMESPACE
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/glmi.R
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/lmi.R
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/ACStdDev.annualized.Rd
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/EMaxDDGBM.Rd
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/glmi.Rd
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/lmi.Rd
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/table.EMaxDDGBM.Rd
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/vignettes/EmaxDDGBM.Rnw
pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/vignettes/EmaxDDGBM.pdf
Log:
Doc modification , addition of normDD
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/DESCRIPTION
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/DESCRIPTION 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/DESCRIPTION 2013-09-15 08:39:12 UTC (rev 3108)
@@ -9,7 +9,8 @@
xts,
PerformanceAnalytics,
tseries,
- stats
+ stats,
+ gld
Maintainer: Brian G. Peterson <brian at braverock.com>
Description: GSoC 2013 project to replicate literature on drawdowns and
non-i.i.d assumptions in finance.
@@ -38,3 +39,4 @@
'table.Sharpe.R'
'glmi.R'
'lmi.R'
+ 'table.normDD.R'
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/NAMESPACE
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/NAMESPACE 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/NAMESPACE 2013-09-15 08:39:12 UTC (rev 3108)
@@ -1,20 +1,21 @@
export(ACStdDev.annualized)
+export(CalmarRatio.Norm)
export(CDrawdown)
-export(CalmarRatio.Norm)
+export(chart.AcarSim)
+export(chart.Autocorrelation)
export(EmaxDDGBM)
+export(glmi)
export(GLMSmoothIndex)
+export(lmi)
export(LoSharpe)
export(QP.Norm)
export(Return.GLM)
export(Return.Okunev)
+export(se.LoSharpe)
export(SterlingRatio.Norm)
-export(UnsmoothReturn)
-export(chart.AcarSim)
-export(chart.Autocorrelation)
-export(glmi)
-export(lmi)
-export(se.LoSharpe)
export(table.ComparitiveReturn.GLM)
export(table.EMaxDDGBM)
+export(table.NormDD)
export(table.Sharpe)
export(table.UnsmoothReturn)
+export(UnsmoothReturn)
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/glmi.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/glmi.R 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/glmi.R 2013-09-15 08:39:12 UTC (rev 3108)
@@ -13,7 +13,7 @@
#'
#'@param vcov HC-HAC covariance estimation
#'@param weights
-#'an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector. If non-NULL, weighted least squares is used with weights weights (that is, minimizing sum(w*e^2)); otherwise ordinary least squares is used. See also ‘Details’,
+#'an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector. If non-NULL, weighted least squares is used with weights weights (that is, minimizing sum; otherwise ordinary least squares is used. See also ‘Details’,
#'@param subset
#'an optional vector specifying a subset of observations to be used in the fitting process.
#'
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/lmi.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/lmi.R 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/lmi.R 2013-09-15 08:39:12 UTC (rev 3108)
@@ -12,7 +12,7 @@
#'
#'@param vcov HC-HAC covariance estimation
#'@param weights
-#'an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector. If non-NULL, weighted least squares is used with weights weights (that is, minimizing sum(w*e^2)); otherwise ordinary least squares is used. See also ‘Details’,
+#'an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector. If non-NULL, weighted least squares is used with weights weights (that is, minimizing sum; otherwise ordinary least squares is used. See also ‘Details’,
#'
#'
#'@param subset
Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/table.normDD.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/table.normDD.R (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/R/table.normDD.R 2013-09-15 08:39:12 UTC (rev 3108)
@@ -0,0 +1,110 @@
+#'@title Generalised Lambda Distribution Simulated Drawdown
+#'@description When selecting a hedge fund manager, one risk measure investors often
+#' consider is drawdown. How should drawdown distributions look? Carr Futures'
+#' Galen Burghardt, Ryan Duncan and Lianyan Liu share some insights from their
+#'research to show investors how to begin to answer this tricky question
+#'@details To simulate net asset value (NAV) series where skewness and kurtosis are zero,
+#' we draw sample returns from a lognormal return distribution. To capture skewness
+#' and kurtosis, we sample returns from a \bold{generalised \eqn{\lambda} distribution}.The values of
+#' skewness and excess kurtosis used were roughly consistent with the range of values the paper
+#' observed for commodity trading advisers in our database. The NAV series is constructed
+#' from the return series. The simulated drawdowns are then derived and used to produce
+#' the theoretical drawdown distributions. A typical run usually requires \bold{10,000}
+#' iterations to produce a smooth distribution.
+#'
+#'
+#' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of
+#' asset returns
+#' @param digits number of rounding off digits.
+#' @references Burghardt, G., and L. Liu, \emph{ It's the Autocorrelation, Stupid (November 2012) Newedge
+#' working paper.}
+#' \code{\link[stats]{}} \cr
+#' \url{http://www.amfmblog.com/assets/Newedge-Autocorrelation.pdf}
+#' Burghardt, G., Duncan, R. and L. Liu, \emph{Deciphering drawdown}. Risk magazine, Risk management for investors, September, S16-S20, 2003. \url{http://www.risk.net/data/risk/pdf/investor/0903_risk.pdf}
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
+#' @keywords Simulated Drawdown Using Brownian Motion Assumptions
+#' @seealso Drawdowns.R
+#' @rdname table.normDD
+#' @export
+table.NormDD <-
+ function (R,digits =4)
+ {# @author
+
+ # DESCRIPTION:
+ # Downside Risk Summary: Statistics and Stylized Facts
+
+ # Inputs:
+ # R: a regular timeseries of returns (rather than prices)
+ # Output: Table of Estimated Drawdowns
+# library(gld)
+
+ y = checkData(R, method = "xts")
+ columns = ncol(y)
+ rows = nrow(y)
+ columnnames = colnames(y)
+ rownames = rownames(y)
+ T= nyears(y);
+ n <- 1000
+ dt <- 1/T;
+ r0 <- 0;
+ s0 <- 1;
+ # for each column, do the following:
+ for(column in 1:columns) {
+ x = y[,column]
+ mu = Return.annualized(x, scale = NA, geometric = TRUE)
+ sig=StdDev.annualized(x)
+ skew = skewness(x)
+ kurt = kurtosis(x)
+ r <- matrix(0,T+1,n) # matrix to hold short rate paths
+ s <- matrix(0,T+1,n)
+ r[1,] <- r0
+ s[1,] <- s0
+ drawdown <- matrix(0,n)
+ # return(Ed)
+
+ for(j in 1:n){
+ r[2:(T+1),j]= rgl(T,mu,sig,skew,kurt)
+ for(i in 2:(T+1)){
+
+ dr <- r[i,j]*dt
+ s[i,j] <- s[i-1,j] + (dr/100)
+ }
+
+
+ drawdown[j] = as.numeric(maxdrawdown(s[,j])[1])
+ }
+ z = c((mu*100),
+ (sig*100),
+ ((mean(drawdown))))
+ znames = c(
+ "Annual Returns in %",
+ "Std Devetions in %",
+ "Normalized Drawdown Drawdown in %"
+ )
+ if(column == 1) {
+ resultingtable = data.frame(Value = z, row.names = znames)
+ }
+ else {
+ nextcolumn = data.frame(Value = z, row.names = znames)
+ resultingtable = cbind(resultingtable, nextcolumn)
+ }
+ }
+ colnames(resultingtable) = columnnames
+ ans = base::round(resultingtable, digits)
+ ans
+ # t <- seq(0, T, dt)
+ # matplot(t, r[1,1:T], type="l", lty=1, main="Short Rate Paths", ylab="rt")
+
+ }
+
+###############################################################################
+# R (http://r-project.org/)
+#
+# Copyright (c) 2004-2013
+#
+# This R package is distributed under the terms of the GNU Public License (GPL)
+# for full details see the file COPYING
+#
+# $Id: table.normDD
+#
+###############################################################################
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/ACStdDev.annualized.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/ACStdDev.annualized.Rd 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/ACStdDev.annualized.Rd 2013-09-15 08:39:12 UTC (rev 3108)
@@ -1,8 +1,8 @@
\name{ACStdDev.annualized}
\alias{ACStdDev.annualized}
-\alias{StdDev.annualized}
\alias{sd.annualized}
\alias{sd.multiperiod}
+\alias{StdDev.annualized}
\title{Autocorrleation adjusted Standard Deviation}
\usage{
ACStdDev.annualized(R, lag = 6, scale = NA, ...)
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/EMaxDDGBM.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/EMaxDDGBM.Rd 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/EMaxDDGBM.Rd 2013-09-15 08:39:12 UTC (rev 3108)
@@ -51,7 +51,7 @@
\keyword{Brownian}
\keyword{Drawdown}
\keyword{Expected}
+\keyword{models}
\keyword{Motion}
\keyword{Using}
-\keyword{models}
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/glmi.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/glmi.Rd 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/glmi.Rd 2013-09-15 08:39:12 UTC (rev 3108)
@@ -31,9 +31,8 @@
\item{weights}{an optional vector of weights to be used
in the fitting process. Should be NULL or a numeric
vector. If non-NULL, weighted least squares is used with
- weights weights (that is, minimizing sum(w*e^2));
- otherwise ordinary least squares is used. See also
- ‘Details’,}
+ weights weights (that is, minimizing sum; otherwise
+ ordinary least squares is used. See also ‘Details’,}
\item{subset}{an optional vector specifying a subset of
observations to be used in the fitting process.}
@@ -104,11 +103,11 @@
the S function of the same name described in Hastie &
Pregibon (1992).
}
-\keyword{HAC}
-\keyword{HC}
\keyword{covariance}
\keyword{estimation}
\keyword{fitting}
+\keyword{HAC}
+\keyword{HC}
\keyword{model}
\keyword{regression}
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/lmi.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/lmi.Rd 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/lmi.Rd 2013-09-15 08:39:12 UTC (rev 3108)
@@ -24,9 +24,8 @@
\item{weights}{an optional vector of weights to be used
in the fitting process. Should be NULL or a numeric
vector. If non-NULL, weighted least squares is used with
- weights weights (that is, minimizing sum(w*e^2));
- otherwise ordinary least squares is used. See also
- ‘Details’,}
+ weights weights (that is, minimizing sum; otherwise
+ ordinary least squares is used. See also ‘Details’,}
\item{subset}{an optional vector specifying a subset of
observations to be used in the fitting process.}
@@ -92,11 +91,11 @@
the S function of the same name described in Hastie &
Pregibon (1992).
}
-\keyword{HAC}
-\keyword{HC}
\keyword{covariance}
\keyword{estimation}
\keyword{fitting}
+\keyword{HAC}
+\keyword{HC}
\keyword{model}
\keyword{regression}
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/table.EMaxDDGBM.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/table.EMaxDDGBM.Rd 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/man/table.EMaxDDGBM.Rd 2013-09-15 08:39:12 UTC (rev 3108)
@@ -51,7 +51,7 @@
\keyword{Brownian}
\keyword{Drawdown}
\keyword{Expected}
+\keyword{models}
\keyword{Motion}
\keyword{Using}
-\keyword{models}
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/vignettes/EmaxDDGBM.Rnw
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/vignettes/EmaxDDGBM.Rnw 2013-09-15 00:04:44 UTC (rev 3107)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/vignettes/EmaxDDGBM.Rnw 2013-09-15 08:39:12 UTC (rev 3108)
@@ -1,3 +1,5 @@
+%% no need for \DeclareGraphicsExtensions{.pdf,.eps}
+
\documentclass[12pt,letterpaper,english]{article}
\usepackage{times}
\usepackage[T1]{fontenc}
@@ -5,21 +7,38 @@
{\newcommand{\url}{\texttt}}
\usepackage{babel}
+%\usepackage{noweb}
\usepackage{Rd}
\usepackage{Sweave}
-\SweaveOpts{engine=R,eps = FALSE}
+\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{On the Maximum Drawdown of a Brownian Motion}
+\author{Shubhankit Mohan}
+
\begin{document}
\SweaveOpts{concordance=TRUE}
-\title{ On the Maximum Drawdown of a Brownian Motion }
-\author{Shubhankit}
-% \keywords{Lo Sharpe Ratio,GLM Smooth Index,GLM Return Table}
-
-\makeatletter
-\makeatother
\maketitle
+
\begin{abstract}
The maximum drawdown possible of an asset whose return series follows a Geometric Brownian Motion Process.
Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/noniid.sm/vignettes/EmaxDDGBM.pdf
===================================================================
(Binary files differ)
More information about the Returnanalytics-commits
mailing list