[Uwgarp-commits] r143 - in pkg/GARPFRM: data vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 27 20:40:24 CET 2014


Author: rossbennett34
Date: 2014-03-27 20:40:23 +0100 (Thu, 27 Mar 2014)
New Revision: 143

Added:
   pkg/GARPFRM/vignettes/GARPFRM.bib
   pkg/GARPFRM/vignettes/QuantitativeAnalysisBasics.pdf
Removed:
   pkg/GARPFRM/data/capm_data.rda
Modified:
   pkg/GARPFRM/vignettes/DelineatingEfficientPortfolios.Rnw
   pkg/GARPFRM/vignettes/DelineatingEfficientPortfolios.pdf
   pkg/GARPFRM/vignettes/EstimatingVolatilitiesCorrelation.Rnw
   pkg/GARPFRM/vignettes/EstimatingVolatilitiesCorrelation.pdf
   pkg/GARPFRM/vignettes/QuantifyingVolatilityVaRModels.Rnw
   pkg/GARPFRM/vignettes/QuantifyingVolatilityVaRModels.pdf
   pkg/GARPFRM/vignettes/QuantitativeAnalysisBasics.Rnw
Log:
Adding bib file and adding references to vignettes

Deleted: pkg/GARPFRM/data/capm_data.rda
===================================================================
(Binary files differ)

Modified: pkg/GARPFRM/vignettes/DelineatingEfficientPortfolios.Rnw
===================================================================
--- pkg/GARPFRM/vignettes/DelineatingEfficientPortfolios.Rnw	2014-03-27 16:19:03 UTC (rev 142)
+++ pkg/GARPFRM/vignettes/DelineatingEfficientPortfolios.Rnw	2014-03-27 19:40:23 UTC (rev 143)
@@ -2,7 +2,11 @@
 
 \usepackage{amsmath}
 \usepackage{Rd}
+\usepackage{verbatim}
 
+\usepackage[round]{natbib}
+\bibliographystyle{abbrvnat}
+
 \begin{document}
 
 <<echo=FALSE>>=
@@ -375,9 +379,8 @@
 @
 
 \section{Extended Examples for Portfolios with Multiple Assets}
-The previous sections all considered the case of a portfolios with two assets. Those assets, in general, could be portfolios or individual securities. The code used in this section depends on the PortfolioAnalytics (TODO citation) package. TODO add description of PortfolioAnalytics.
+The previous sections all considered the case of a portfolios with two assets. Those assets, in general, could be portfolios or individual securities. The code used in this section depends on the \verb"PortfolioAnalytics" package \citep{PortfolioAnalytics}. \verb"PortfolioAnalytics" is an R package designed to provide numerical solutions and visualizations for portfolio problems with complex constraints and objectives. 
 
-
 Load weekly returns data for a set of large cap, mid cap, and small cap stocks.
 <<>>=
 data(crsp_weekly)
@@ -428,4 +431,6 @@
 
 In this vignette, we have demonstrated the behavior of efficient frontiers of two assets as the correlation varies under the full investment constraint with and without short selling allowed. We have also presented the more general case for generating portfolios along an efficient frontier for more than 2 assets. We also demonstrated functionality to generate portfolios along the efficient frontier with box constraints as well as group constraints.
 
+\bibliography{GARPFRM}
+
 \end{document}

Modified: pkg/GARPFRM/vignettes/DelineatingEfficientPortfolios.pdf
===================================================================
(Binary files differ)

Modified: pkg/GARPFRM/vignettes/EstimatingVolatilitiesCorrelation.Rnw
===================================================================
--- pkg/GARPFRM/vignettes/EstimatingVolatilitiesCorrelation.Rnw	2014-03-27 16:19:03 UTC (rev 142)
+++ pkg/GARPFRM/vignettes/EstimatingVolatilitiesCorrelation.Rnw	2014-03-27 19:40:23 UTC (rev 143)
@@ -2,7 +2,11 @@
 
 \usepackage{amsmath}
 \usepackage{Rd}
+\usepackage{verbatim}
 
+\usepackage[round]{natbib}
+\bibliographystyle{abbrvnat}
+
 \begin{document}
 
 <<echo=FALSE>>=
@@ -266,7 +270,7 @@
 A key characteristic of the GARCH(1,1) model is mean reversion, i.e. the variance rate is pulled back to the long-run average variance rate over time. In contrast, the EWMA model is not mean reverting.
 
 \subsection{Estimating GARCH(1,1) Parameters}
-Estimating the parameters for the GARCH model requires an optimization routine to maximize the likelihood. The FRM text describes an example of using a spreadsheet and a solver, e.g. the Microsoft Excel Solver. The implementation of GARCH in the GARPFRM(citation) package utilizes the rugarch(citation) package. The rugarch package uses C code for a fast and efficient algorithm for the main part of the likelihood calculation.
+Estimating the parameters for the GARCH model requires an optimization routine to maximize the likelihood. The FRM text describes an example of using a spreadsheet and a solver, e.g. the Microsoft Excel Solver. The implementation of GARCH in the GARPFRM package \citep{GARPFRM} utilizes the rugarch package \citep{rugarch}. The implementation in the rugarch package uses C code for a fast and efficient algorithm for the main part of the likelihood calculation.
 
 Here we demonstrate how to specify and fit a GARCH(1,1) model using weekly returns for Microsoft.
 <<>>=
@@ -340,5 +344,6 @@
 plot(forecast2, which=4)
 @
 
+\bibliography{GARPFRM}
 
 \end{document}

Modified: pkg/GARPFRM/vignettes/EstimatingVolatilitiesCorrelation.pdf
===================================================================
(Binary files differ)

Added: pkg/GARPFRM/vignettes/GARPFRM.bib
===================================================================
--- pkg/GARPFRM/vignettes/GARPFRM.bib	                        (rev 0)
+++ pkg/GARPFRM/vignettes/GARPFRM.bib	2014-03-27 19:40:23 UTC (rev 143)
@@ -0,0 +1,46 @@
+ at Manual{rugarch,
+    title = {rugarch: Univariate GARCH models.},
+    author = {Alexios Ghalanos},
+    year = {2014},
+    note = {R package version 1.3-1.},
+  }
+  
+ at Manual{PerformanceAnalytics,
+    title = {PerformanceAnalytics: Econometric tools for performance and risk analysis.},
+    author = {Peter Carl and Brian G. Peterson},
+    year = {2013},
+    note = {R package version 1.1.1},
+    url = {http://r-forge.r-project.org/projects/returnanalytics/},
+  }
+  
+ at Manual{xts,
+    title = {xts: eXtensible Time Series},
+    author = {Jeffrey A. Ryan and Joshua M. Ulrich},
+    year = {2014},
+    note = {R package version 0.9-7},
+    url = {http://CRAN.R-project.org/package=xts},
+  }
+
+ at Manual{PortfolioAnalytics,
+    title = {PortfolioAnalytics: Portfolio Analysis, including Numerical Methods for Optimization of Portfolios},
+    author = {Brian G. Peterson and Peter Carl and Ross Bennett and Kris Boudt},
+    year = {2014},
+    note = {R package version 0.9.0},
+  }
+
+ at Manual{foreach,
+    title = {foreach: Foreach looping construct for R},
+    author = {Revolution Analytics and Steve Weston},
+    year = {2013},
+    note = {R package version 1.4.1},
+    url = {http://CRAN.R-project.org/package=foreach},
+  }
+
+ at Manual{GARPFRM,
+    title = {GARPFRM: Global Association of Risk Professionals: Financial Risk Manager},
+    author = {Ross Bennett and Thomas Fillebeen and Guy Yollin},
+    year = {2013},
+    note = {R package version 0.1.0},
+  }
+  
+  % need to add the GARP books to this

Modified: pkg/GARPFRM/vignettes/QuantifyingVolatilityVaRModels.Rnw
===================================================================
--- pkg/GARPFRM/vignettes/QuantifyingVolatilityVaRModels.Rnw	2014-03-27 16:19:03 UTC (rev 142)
+++ pkg/GARPFRM/vignettes/QuantifyingVolatilityVaRModels.Rnw	2014-03-27 19:40:23 UTC (rev 143)
@@ -248,7 +248,6 @@
 
 A key concern with the VarCov approach is the correlation estimate. As we saw with volatility in a previous section, correlation changes over time. For example, if correlations increase when markets fall, the VaR estimate of the position may be understated.
 
-
 The return aggregation approach is a "simulation" method where the returns are calculated using historical data, but the weights of each position today. For example, we calculate the returns we would have earned over the most recent $K$ periods by pretending the relative postions we hold today are the same positions we held $K$ days ago. This approach has the advantage that no parameters need to be estimated (not considering the $K$ lookback period). This means we do not have to estimate correlation. If markets fall and move together, this will be captured by the return aggregation approach. This approach will also capture fatter tails relative to a normal distribution.
 
 Suppose we have an equally weighted portfolio consisting of the first 10 assets in the largecap\_weekly dataset and use a lookback period of $K = 52$.
@@ -316,6 +315,33 @@
 portfVaR.ewmaCov <- sqrt(t(weights) %*% ewmaCov %*% weights) * qnorm(0.05)
 @
 
+As discussed earlier, the correlation and covariance between assets change over time. To demonstrate this, we plot the rolling correlation and rolling covariance estimates. For simplicity, we only consider the first 2 assets.
+<<>>=
+# Compute rolling correlation estimates
+cor13 <- rollCor(R[,1:2], 13)
+cor26 <- rollCor(R[,1:2], 26)
+
+# Compute rolling covariance estimates
+cov13 <- rollCov(R[,1:2], 13)
+cov26 <- rollCov(R[,1:2], 26)
+
+# Plot rolling correlation estimates
+plot(cor13, type="n", main="Rolling Correlation", 
+     ylab="correlation")
+lines(cor13, col="blue")
+lines(cor26, col="red")
+legend("topleft", legend=c("rollCor(13)", "rollCor(26)"), 
+       bty="n", lty=c(1, 1), col=c("blue", "red"), cex=0.8)
+
+# Plot rolling covariance estimates
+plot(cov13, type="n", main="Rolling Covariance", 
+     ylab="covariance")
+lines(cov13, col="blue")
+lines(cov26, col="red")
+legend("topleft", legend=c("rollCov(13)", "rollCov(26)"), 
+       bty="n", lty=c(1, 1), col=c("blue", "red"), cex=0.8)
+@
+
 Returning our focus back to the return aggregation approach. We can also compute the portfolio VaR using methods we covered earlier when computing the VaR estimate of Conoco Phillips (COP) returns.
 <<>>=
 # Portfolio VaR estimate with EWMA model

Modified: pkg/GARPFRM/vignettes/QuantifyingVolatilityVaRModels.pdf
===================================================================
(Binary files differ)

Modified: pkg/GARPFRM/vignettes/QuantitativeAnalysisBasics.Rnw
===================================================================
--- pkg/GARPFRM/vignettes/QuantitativeAnalysisBasics.Rnw	2014-03-27 16:19:03 UTC (rev 142)
+++ pkg/GARPFRM/vignettes/QuantitativeAnalysisBasics.Rnw	2014-03-27 19:40:23 UTC (rev 143)
@@ -1,38 +1,12 @@
-\documentclass[a4paper]{article}
-\usepackage[OT1]{fontenc}
-\usepackage{Sweave}
-\usepackage{Rd}
+\documentclass{article}
+
 \usepackage{amsmath}
-\usepackage{hyperref}
-\usepackage{url}
-\usepackage[round]{natbib}
-\usepackage{bm}
+\usepackage{Rd}
 \usepackage{verbatim}
-\usepackage[latin1]{inputenc}
+
+\usepackage[round]{natbib}
 \bibliographystyle{abbrvnat}
 
-\let\proglang=\textsf
-%\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}}
-%\newcommand{\R}[1]{{\fontseries{b}\selectfont #1}}
-%\newcommand{\email}[1]{\href{mailto:#1}{\normalfont\texttt{#1}}}
-%\newcommand{\E}{\mathsf{E}}
-%\newcommand{\VAR}{\mathsf{VAR}}
-%\newcommand{\COV}{\mathsf{COV}}
-%\newcommand{\Prob}{\mathsf{P}}
-
-\renewcommand{\topfraction}{0.85}
-\renewcommand{\textfraction}{0.1}
-\renewcommand{\baselinestretch}{1.5}
-\setlength{\textwidth}{15cm} \setlength{\textheight}{22cm} \topmargin-1cm \evensidemargin0.5cm \oddsidemargin0.5cm
-
-\usepackage[latin1]{inputenc}
-% or whatever
-
-\usepackage{lmodern}
-\usepackage[T1]{fontenc}
-% Or whatever. Note that the encoding and the font should match. If T1
-% does not look nice, try deleting the line with the fontenc.
-
 \begin{document}
 
 \title{Quantitative Analysis}
@@ -41,7 +15,7 @@
 \maketitle
 
 \begin{abstract}
-The goal of this vignette is to demonstrate key concepts in Financial Risk Manager (FRM \textsuperscript{\textregistered}) Part 1: Quantitative Analysis using R and the GARPFRM package. This vignette will cover exploratory data analysis, basic probability and statistics, and linear regression.
+The goal of this vignette is to demonstrate key concepts in Financial Risk Manager (FRM \textsuperscript{\textregistered}) Part 1: Quantitative Analysis using R and the GARPFRM package \citep{GARPFRM}. This vignette will cover exploratory data analysis, basic probability and statistics, and linear regression.
 \end{abstract}
 
 \tableofcontents
@@ -518,5 +492,6 @@
 summary(ff.fit)
 @
 
+\bibliography{GARPFRM}
 
 \end{document}
\ No newline at end of file

Added: pkg/GARPFRM/vignettes/QuantitativeAnalysisBasics.pdf
===================================================================
(Binary files differ)


Property changes on: pkg/GARPFRM/vignettes/QuantitativeAnalysisBasics.pdf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the Uwgarp-commits mailing list