<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Quantivity</title>
	<atom:link href="http://quantivity.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://quantivity.wordpress.com</link>
	<description>Uncommon Returns through Quantitative and Algorithmic Trading</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:41:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='quantivity.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Quantivity</title>
		<link>http://quantivity.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://quantivity.wordpress.com/osd.xml" title="Quantivity" />
	<atom:link rel='hub' href='http://quantivity.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Direction of Change Forecasting</title>
		<link>http://quantivity.wordpress.com/2012/01/16/sign-direction-of-change-forecasting/</link>
		<comments>http://quantivity.wordpress.com/2012/01/16/sign-direction-of-change-forecasting/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 04:37:59 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=7655</guid>
		<description><![CDATA[Index Return Decomposition prompted several readers to inquire about forecasting the signs of returns, as implied by the decomposition variable. This is an interesting topic worth review, quick survey of intuition from the literature, and some R code for exploratory analysis. This topic is known as direction-of-change forecasting in the literature. Needless to say, successful [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=7655&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://quantivity.wordpress.com/2011/12/14/index-return-decomposition/">Index Return Decomposition</a> prompted several readers to inquire about <em>forecasting the signs of returns</em>, as implied by the <img src='http://s0.wp.com/latex.php?latex=s_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s_t' title='s_t' class='latex' /> decomposition variable. This is an interesting topic worth review, quick survey of intuition from the literature, and some R code for exploratory analysis.</p>
<p>This topic is known as <em>direction-of-change</em> forecasting in the literature. Needless to say, successful prediction of the sign for future returns is quite interesting from a trading perspective. Traditionally, only univariate return series were considered; <a href="http://www.nes.ru/~sanatoly/Papers/DepRatio.pdf">Anatolyev (2008)</a> is an exception, modeling two or more interrelated markets via dependence ratios. This literature tends to be a bit obtuse, due to commonly unstated stylistic assumptions regarding conditional return dynamics.</p>
<p><span id="more-7655"></span></p>
<p>The traditional formulation for this topic considers the estimation of the probabilities of returns exceeding an upper or lower threshold <img src='http://s0.wp.com/latex.php?latex=c&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c' title='c' class='latex' />, optionally conditioned on an information set <img src='http://s0.wp.com/latex.php?latex=I&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='I' title='I' class='latex' /> from the previous time step:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=U_t%28c%29+%3D+%5Ctext%7BPr%7D%28r_t+%3E+c+%7C+I_%7Bt-1%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U_t(c) = &#92;text{Pr}(r_t &gt; c | I_{t-1}) ' title='U_t(c) = &#92;text{Pr}(r_t &gt; c | I_{t-1}) ' class='latex' /><br />
&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=D_t%28c%29+%3D+%5Ctext%7BPr%7D%28r_t+%3C+-c+%7C+I_%7Bt-1%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='D_t(c) = &#92;text{Pr}(r_t &lt; -c | I_{t-1}) ' title='D_t(c) = &#92;text{Pr}(r_t &lt; -c | I_{t-1}) ' class='latex' /></p>
<p>If <img src='http://s0.wp.com/latex.php?latex=c+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c = 0' title='c = 0' class='latex' />, the probabilities reduce to forecasting positive or negative returns; for trading, a natural choice for <img src='http://s0.wp.com/latex.php?latex=c&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c' title='c' class='latex' /> is roundtrip transaction costs:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=U_t%28c%29+%3D+%5Ctext%7BPr%7D%28r_t+%3E+0+%7C+I_%7Bt-1%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U_t(c) = &#92;text{Pr}(r_t &gt; 0 | I_{t-1}) ' title='U_t(c) = &#92;text{Pr}(r_t &gt; 0 | I_{t-1}) ' class='latex' /><br />
&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=D_t%28c%29+%3D+%5Ctext%7BPr%7D%28r_t+%3C+0+%7C+I_%7Bt-1%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='D_t(c) = &#92;text{Pr}(r_t &lt; 0 | I_{t-1}) ' title='D_t(c) = &#92;text{Pr}(r_t &lt; 0 | I_{t-1}) ' class='latex' /></p>
<p>Estimating these probabilities can be undertaken via several techniques. One approach is to use a logit model, based upon the logistic function:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=U_t%28c%29+%3D+%5Cfrac%7B%5Cexp%28%5Cboldsymbol%7B%5Ctheta%7D_t%29%7D%7B1+%2B+%5Cexp%28%5Cboldsymbol%7B%5Ctheta%7D_t%29%7D+%3A+%5Cboldsymbol%7B%5Ctheta%7D_t+%3D+%5Chat%7B%5Cboldsymbol%7B%5Cbeta%7D%7D+%5Ctextbf%7BX%7D_t+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U_t(c) = &#92;frac{&#92;exp(&#92;boldsymbol{&#92;theta}_t)}{1 + &#92;exp(&#92;boldsymbol{&#92;theta}_t)} : &#92;boldsymbol{&#92;theta}_t = &#92;hat{&#92;boldsymbol{&#92;beta}} &#92;textbf{X}_t ' title='U_t(c) = &#92;frac{&#92;exp(&#92;boldsymbol{&#92;theta}_t)}{1 + &#92;exp(&#92;boldsymbol{&#92;theta}_t)} : &#92;boldsymbol{&#92;theta}_t = &#92;hat{&#92;boldsymbol{&#92;beta}} &#92;textbf{X}_t ' class='latex' /></p>
<p>Where <img src='http://s0.wp.com/latex.php?latex=%5Ctextbf%7BX%7D_t+%5Cin+I_%7Bt-1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;textbf{X}_t &#92;in I_{t-1}' title='&#92;textbf{X}_t &#92;in I_{t-1}' class='latex' /> are explanatory variables from the previous time step. Challenge of this model is proper selection of explanatory variables.</p>
<p>An alternative approach is to consider the following functional decomposition for univariate return series:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=r_t+%3D+%5Cmu_t+%2B+%5Csigma_t+%5Cepsilon_t+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r_t = &#92;mu_t + &#92;sigma_t &#92;epsilon_t ' title='r_t = &#92;mu_t + &#92;sigma_t &#92;epsilon_t ' class='latex' /></p>
<p>Where <img src='http://s0.wp.com/latex.php?latex=%5Cmu_t+%3D+%5Ctext%7BE%7D+%28Y_t+%7C+I_%7Bt-1%7D%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mu_t = &#92;text{E} (Y_t | I_{t-1})' title='&#92;mu_t = &#92;text{E} (Y_t | I_{t-1})' class='latex' /> is the conditional expected value, <img src='http://s0.wp.com/latex.php?latex=%5Csigma%5E2+%3D+%5Ctext%7BVar%7D%28Y_t+%7C+I_%7Bt-1%7D%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sigma^2 = &#92;text{Var}(Y_t | I_{t-1})' title='&#92;sigma^2 = &#92;text{Var}(Y_t | I_{t-1})' class='latex' /> is the conditional variance, and <img src='http://s0.wp.com/latex.php?latex=%5Cepsilon_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;epsilon_t' title='&#92;epsilon_t' class='latex' /> is a martingale with zero mean, unity variance, and conditional distribution function <img src='http://s0.wp.com/latex.php?latex=F_%7B%5Cepsilon%7D%28%5Ccdot+%7C+I_%7Bt-1%7D%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F_{&#92;epsilon}(&#92;cdot | I_{t-1})' title='F_{&#92;epsilon}(&#92;cdot | I_{t-1})' class='latex' />. From which the direction of change probabilities can be expressed:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=U_t%28c%29+%3D+%5Ctext%7BPr%7D+%5Cleft%5B+%28%5Cmu_t+%2B+%5Csigma_t+%5Cepsilon_t%29+%3E+c+%5Cright%5D+%3D+%5Ctext%7BPr%7D+%5Cleft%5B+%5Cepsilon_t+%3E+%5Cleft%28+%5Cfrac%7Bc+-+%5Cmu_t%7D%7B%5Csigma_t%7D+%5Cright%29+%5Cright%5D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U_t(c) = &#92;text{Pr} &#92;left[ (&#92;mu_t + &#92;sigma_t &#92;epsilon_t) &gt; c &#92;right] = &#92;text{Pr} &#92;left[ &#92;epsilon_t &gt; &#92;left( &#92;frac{c - &#92;mu_t}{&#92;sigma_t} &#92;right) &#92;right] ' title='U_t(c) = &#92;text{Pr} &#92;left[ (&#92;mu_t + &#92;sigma_t &#92;epsilon_t) &gt; c &#92;right] = &#92;text{Pr} &#92;left[ &#92;epsilon_t &gt; &#92;left( &#92;frac{c - &#92;mu_t}{&#92;sigma_t} &#92;right) &#92;right] ' class='latex' /></p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=D_t%28c%29+%3D+%5Ctext%7BPr%7D+%5Cleft%5B+%28%5Cmu_t+%2B+%5Csigma_t+%5Cepsilon_t%29+%3C+-c+%5Cright%5D+%3D+%5Ctext%7BPr%7D+%5Cleft%5B+%5Cepsilon_t+%3C+%5Cleft%28+%5Cfrac%7B-c+-+%5Cmu_t%7D%7B%5Csigma_t%7D+%5Cright%29+%5Cright%5D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='D_t(c) = &#92;text{Pr} &#92;left[ (&#92;mu_t + &#92;sigma_t &#92;epsilon_t) &lt; -c &#92;right] = &#92;text{Pr} &#92;left[ &#92;epsilon_t &lt; &#92;left( &#92;frac{-c - &#92;mu_t}{&#92;sigma_t} &#92;right) &#92;right] ' title='D_t(c) = &#92;text{Pr} &#92;left[ (&#92;mu_t + &#92;sigma_t &#92;epsilon_t) &lt; -c &#92;right] = &#92;text{Pr} &#92;left[ &#92;epsilon_t &lt; &#92;left( &#92;frac{-c - &#92;mu_t}{&#92;sigma_t} &#92;right) &#92;right] ' class='latex' /></p>
<p>With corresponding conditional expectations:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Ctext%7BE%7D+%5Cleft%5BU_t%28c%29+%7C+I_%7Bt-1%7D+%5Cright%5D+%3D+1+-+F_r%28c+%7C+I_%7Bt-1%7D%29+%3D+1+-+F_%7B%5Cepsilon%7D+%5Cleft%28+%5Cfrac%7Bc+-+%5Cmu_t%7D%7B%5Csigma_t%7D+%7C+I_%7Bt-1%7D+%5Cright%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;text{E} &#92;left[U_t(c) | I_{t-1} &#92;right] = 1 - F_r(c | I_{t-1}) = 1 - F_{&#92;epsilon} &#92;left( &#92;frac{c - &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' title='&#92;text{E} &#92;left[U_t(c) | I_{t-1} &#92;right] = 1 - F_r(c | I_{t-1}) = 1 - F_{&#92;epsilon} &#92;left( &#92;frac{c - &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' class='latex' /><br />
&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Ctext%7BE%7D+%5Cleft%5BD_t%28c%29+%7C+I_%7Bt-1%7D+%5Cright%5D+%3D+F_r%28c+%7C+I_%7Bt-1%7D%29+%3D+F_%7B%5Cepsilon%7D+%5Cleft%28+%5Cfrac%7B-c+-+%5Cmu_t%7D%7B%5Csigma_t%7D+%7C+I_%7Bt-1%7D+%5Cright%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;text{E} &#92;left[D_t(c) | I_{t-1} &#92;right] = F_r(c | I_{t-1}) = F_{&#92;epsilon} &#92;left( &#92;frac{-c - &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' title='&#92;text{E} &#92;left[D_t(c) | I_{t-1} &#92;right] = F_r(c | I_{t-1}) = F_{&#92;epsilon} &#92;left( &#92;frac{-c - &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' class='latex' /></p>
<p>These expectations simplify to the following when <img src='http://s0.wp.com/latex.php?latex=c+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='c = 0' title='c = 0' class='latex' />, assuming <img src='http://s0.wp.com/latex.php?latex=%5Cmu+%5Cne+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mu &#92;ne 0' title='&#92;mu &#92;ne 0' class='latex' /> (otherwise, expectation is constant and thus uninteresting):</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Ctext%7BE%7D+%5Cleft%5BU_t%28c%29+%7C+I_%7Bt-1%7D+%5Cright%5D+%3D+1+-+F_%7B%5Cepsilon%7D+%5Cleft%28+%5Cfrac%7B-+%5Cmu_t%7D%7B%5Csigma_t%7D+%7C+I_%7Bt-1%7D+%5Cright%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;text{E} &#92;left[U_t(c) | I_{t-1} &#92;right] = 1 - F_{&#92;epsilon} &#92;left( &#92;frac{- &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' title='&#92;text{E} &#92;left[U_t(c) | I_{t-1} &#92;right] = 1 - F_{&#92;epsilon} &#92;left( &#92;frac{- &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' class='latex' /><br />
&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Ctext%7BE%7D+%5Cleft%5BD_t%28c%29+%7C+I_%7Bt-1%7D+%5Cright%5D+%3D+F_%7B%5Cepsilon%7D+%5Cleft%28+%5Cfrac%7B-+%5Cmu_t%7D%7B%5Csigma_t%7D+%7C+I_%7Bt-1%7D+%5Cright%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;text{E} &#92;left[D_t(c) | I_{t-1} &#92;right] = F_{&#92;epsilon} &#92;left( &#92;frac{- &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' title='&#92;text{E} &#92;left[D_t(c) | I_{t-1} &#92;right] = F_{&#92;epsilon} &#92;left( &#92;frac{- &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) ' class='latex' /></p>
<p>These expectations can be evaluated explicitly via calculating the empirical distribution function <img src='http://s0.wp.com/latex.php?latex=%5Chat%7BF%7D_%7B%5Cepsilon%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;hat{F}_{&#92;epsilon}' title='&#92;hat{F}_{&#92;epsilon}' class='latex' /> (requiring assumption of a parametric distribution), where <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BI%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathbb{I}' title='&#92;mathbb{I}' class='latex' /> is the indicator function:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Chat%7BF%7D_%7B%5Cepsilon%7D+%5Cleft%28+%5Cfrac%7B-+%5Cmu_t%7D%7B%5Csigma_t%7D+%7C+I_%7Bt-1%7D+%5Cright%29+%3D+%5Cfrac%7B1%7D%7Bk%7D+%5Csum%5Climits_%7Bt%3D1%7D%5Ek+%5Cmathbb%7BI%7D+%5Cleft%28+%5Cfrac%7Br_t+-+%5Cmu_t%7D%7B%5Csigma_t%7D+%5Cle+%5Cfrac%7B-%5Cmu_k%7D%7B%5Csigma_k%7D+%5Cright%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;hat{F}_{&#92;epsilon} &#92;left( &#92;frac{- &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) = &#92;frac{1}{k} &#92;sum&#92;limits_{t=1}^k &#92;mathbb{I} &#92;left( &#92;frac{r_t - &#92;mu_t}{&#92;sigma_t} &#92;le &#92;frac{-&#92;mu_k}{&#92;sigma_k} &#92;right) ' title='&#92;hat{F}_{&#92;epsilon} &#92;left( &#92;frac{- &#92;mu_t}{&#92;sigma_t} | I_{t-1} &#92;right) = &#92;frac{1}{k} &#92;sum&#92;limits_{t=1}^k &#92;mathbb{I} &#92;left( &#92;frac{r_t - &#92;mu_t}{&#92;sigma_t} &#92;le &#92;frac{-&#92;mu_k}{&#92;sigma_k} &#92;right) ' class='latex' /></p>
<p>Alternatively, this decomposition suggests one potential formulation for the logit parameters <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Ctheta%7D_tt&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;theta}_tt' title='&#92;boldsymbol{&#92;theta}_tt' class='latex' /> from the above model, where <img src='http://s0.wp.com/latex.php?latex=%5Chat%7B%5Cmu_t%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;hat{&#92;mu_t}' title='&#92;hat{&#92;mu_t}' class='latex' /> is estimated by the logit and <img src='http://s0.wp.com/latex.php?latex=%5Csigma_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sigma_t' title='&#92;sigma_t' class='latex' /> are historical observations:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Ctheta%7D_t+%3D+%5Cfrac%7B%5Chat%7B%5Cmu_t%7D%7D%7B%5Chat%7B%5Csigma_t%7D%7D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;theta}_t = &#92;frac{&#92;hat{&#92;mu_t}}{&#92;hat{&#92;sigma_t}} ' title='&#92;boldsymbol{&#92;theta}_t = &#92;frac{&#92;hat{&#92;mu_t}}{&#92;hat{&#92;sigma_t}} ' class='latex' /></p>
<p>Of course, the non-trivial work is generating forecast estimates for next-step average conditional return <img src='http://s0.wp.com/latex.php?latex=%5Chat%7B%5Cmu_t%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;hat{&#92;mu_t}' title='&#92;hat{&#92;mu_t}' class='latex' /> and conditional variance <img src='http://s0.wp.com/latex.php?latex=%5Chat%7B%5Csigma_t%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;hat{&#92;sigma_t}' title='&#92;hat{&#92;sigma_t}' class='latex' />.</p>
<p>An alternative way to model the logit parameters <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Ctheta%7D_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;theta}_t' title='&#92;boldsymbol{&#92;theta}_t' class='latex' /> is to apply ARMA intuition with a binary autoregression (BARMA) due to <a href="papers.ssrn.com/sol3/papers.cfm?abstract_id=886092">Startz (2006)</a>, including lags for both autoregressive parameters and past indicator values, due to <a href="http://www.nes.ru/~sanatoly/Papers/DepRatio.pdf">Anatolyev (2008)</a>:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Ctheta%7D_t+%3D+w+%2B+%5Csum%5Climits_%7Bj%3D1%7D%5Ep+%5Calpha_j+%5Ctheta_%7Bt-j%7D+%2B+%5Csum%5Climits_%7Bj%3D1%7D%5Ep+%5Cbeta_j+I_%7Bt-j%7D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;theta}_t = w + &#92;sum&#92;limits_{j=1}^p &#92;alpha_j &#92;theta_{t-j} + &#92;sum&#92;limits_{j=1}^p &#92;beta_j I_{t-j} ' title='&#92;boldsymbol{&#92;theta}_t = w + &#92;sum&#92;limits_{j=1}^p &#92;alpha_j &#92;theta_{t-j} + &#92;sum&#92;limits_{j=1}^p &#92;beta_j I_{t-j} ' class='latex' /></p>
<p>A survey of estimation techniques may be considered in a subsequent post, depending on reader interest.</p>
<hr />
<p>One exploratory analysis technique relevant to sign forecasting is visualizing up/down runs, signed difference (<em>i.e.</em> up-down), and corresponding averages for a return series.</p>
<p><pre class="brush: r;">
returnRuns &lt;- function(r, bound=0, doPlot=TRUE, startAvg=5, avgLen=-1)
{
  # Generate up/down runs and average runs for a return series, optionally
  # plotting them.
  #
  # Args:
  #   r: return series
  #   bound: symmetric upper and lower bound, aka c
  #   doPlot: flag indicating whether plots should be generated for runs
  #   startAvg: Number of average runs which should be excluded for
  #             eliminating unstable average with few leading observations
  #   avgLen: number of periods over which to generate average; of -1 for
  #           entire period
  #
  # Returns: none
  
  up &lt;- cumsum(ifelse(r &gt; bound, 1, 0))
  down &lt;- cumsum(ifelse(r &lt; -bound, 1, 0))
  
  if (doPlot)
  {
    plot(up, main='Signed Runs: Up &amp; Down', ylim=range(up,down))
    lines(down, col='red')
    legend(&quot;topleft&quot;,legend=c(&quot;Up&quot;,&quot;Down&quot;), fill=colors, cex=0.5)
    
    plot(up-down, main=&quot;Signed Run Difference (up-down)&quot;)
  }
  
  if (avgLen == -1)
  {
    avgUp &lt;- xts(sapply(c(1:length(up)), function(i) {
      up[i]/i
    }), order.by=index(up))
    avgDown &lt;- xts(sapply(c(1:length(down)), function(i) {
      down[i]/i
    }), order.by=index(up))
  } else
  {
    avgUp &lt;- xts(sapply(c(avgLen:length(up)), function(i) {
      start &lt;- i - avgLen + 1
      last(cumsum(ifelse(r[start:i] &gt; bound, 1, 0))) / avgLen
    }), order.by=index(up[avgLen:length(up)]))
    avgDown &lt;- xts(sapply(c(avgLen:length(down)), function(i) {
      start &lt;- i - avgLen + 1
      last(cumsum(ifelse(r[start:i] &lt; bound, 1, 0))) / avgLen
    }), order.by=index(up[avgLen:length(up)]))
  }
  
  if (doPlot)
  {
    n &lt;- length(avgUp)
    plot(avgUp[startAvg:n], main=paste(&quot;Average Runs: Up &amp; Down (&quot;,avgLen,&quot; periods)&quot;,sep=&quot;&quot;), type='l', ylim=range(avgUp,avgDown))
    lines(avgDown[startAvg:n], col='red')
    legend(&quot;topleft&quot;,legend=c(&quot;Up&quot;,&quot;Down&quot;), fill=colors, cex=0.5)
  }
      
  return (list(up=up, down=down, avgUp=avgUp, avgDown=avgDown))
}
</pre></p>
<p>For example, the following plots illustrate CRM run dynamics from 2005 to present. First plot illustrates the running sums for both up and down returns, indicating negative returns are more prevalent:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/runs-signed.png"><img src="http://quantivity.files.wordpress.com/2011/10/runs-signed.png?w=600" alt="" title="runs-signed"   class="aligncenter size-full wp-image-9261" /></a></p>
<p>Second plot illustrates the difference in signed sums, showing time-dynamics for the difference in up and down returns. Not surprising, this difference mirrors the CRM price curve closely:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/runs-diff.png"><img src="http://quantivity.files.wordpress.com/2011/10/runs-diff.png?w=600&#038;h=624" alt="" title="runs-diff" width="600" height="624" class="aligncenter size-full wp-image-9262" /></a></p>
<p>Third plot illustrates the average probabilities for both up and down, running incrementally over the entire timeframe:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/runs-avg.png"><img src="http://quantivity.files.wordpress.com/2011/10/runs-avg.png?w=600" alt="" title="runs-avg"   class="aligncenter size-full wp-image-9263" /></a></p>
<hr />
<p>The following are representative papers from the direction-of-change literature, ignoring the early papers focused on evaluating market efficiency (<em>e.g.</em> run tests):</p>
<ul>
<li><a href="http://www.neurogest.com/papers/forecasting_stock_indices.pdf">Forecasting Stock Indices: A Comparison of Classification and Level Estimation Models</a>, by Leunga, Daoukb, and Chenc (2000)</li>
<li><a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=306127">Financial, Asset Returns, Market Timing, and Volatility Dynamics</a>, by Christoffersen and Diebold (2002)</li>
<li><a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=908317">Direction-of-Change Forecasts Based on Conditional Variance, Skewness and Kurtosis Dynamics: International Evidence</a>, by Christoffersen <em>et al</em> (2004)</li>
<li><a href="http://www.ims.nus.edu.sg/Programs/econometrics/files/ymh_paper.pdf">Are the Directions of Stock Price Changes Predictable? Statistical Theory and Evidence</a>, by Hong and Chung (2003)</li>
<li><a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=675623">Evaluating Direction-of-change Forecasting: Neurofuzzy Models vs. Neural Networks</a>, by Bekiros and Georgoutsos (2005)</li>
<li><a href="http://www.cefir.ru/papers/WP95Anatolyev.pdf">Modeling Financial Return Dynamics via Decomposition</a>, by Anatolyev and Gospodinov (2007)</li>
<li><a href="http://www.nes.ru/dataupload/files/programs/econ/preprints/2007/Deliya.pdf">Direction-of-change Forecasts and Trading Strategy Profitability at Intra-Day Horizons</a>, by Deliya (2007)</li>
<li><a href="http://www.nes.ru/~sanatoly/Papers/DepRatio.pdf">Multi-Market Direction-of-Change Modeling Using Dependence Ratios</a>, by Anatolyev (2008)</li>
<li><a href="http://ethesis.helsinki.fi/julkaisut/eri/hecer/disc/227/forecast.pdf">Forecasting the Direction of the U.S. Stock Market with Dynamic Binary Probit Models</a>, by Nyberg (2008)</li>
<li><a href="http://www.iaeng.org/publication/WCE2008/WCE2008_pp1160-1165.pdf">Direction-of-Change Financial Time Series Forecasting using Bayesian Learning for MLPs</a>, by Skabar (2008)</li>
<li><a href="http://www.springerlink.com/content/f53731054u1761w7/">A Kernel-Based Technique for Direction-of-Change Financial Time Series Forecasting</a>, by Skabar (2008)
<li>
<li><a href="http://econlab.uom.gr/econdep/images/stories/tpanag/Thomacos_seminar.pdf">Optimal Probabilistic and Directional Predictions of Financial Returns</a>, by Thomakos and Wang (2009)</li>
<li><a href="http://www.cefir.ru/papers/WP136.pdf">Directional Prediction of Returns under Asymmetric Loss: Direct and Indirect Approaches</a>, by Anatolyev and Kryzhanovskaya (2009)</li>
</ul>
<p>Finally, Kinlay briefly surveyed this topic in two posts on <a href="http://jonathankinlay.com/index.php/category/volatility-sign-prediction-forecasting-engle/">volatility sign prediction</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/7655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/7655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/7655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/7655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/7655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/7655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/7655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/7655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/7655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/7655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/7655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/7655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/7655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/7655/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=7655&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2012/01/16/sign-direction-of-change-forecasting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/runs-signed.png" medium="image">
			<media:title type="html">runs-signed</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/runs-diff.png" medium="image">
			<media:title type="html">runs-diff</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/runs-avg.png" medium="image">
			<media:title type="html">runs-avg</media:title>
		</media:content>
	</item>
		<item>
		<title>Physics, Biology, or Peltzman?</title>
		<link>http://quantivity.wordpress.com/2012/01/03/physics-biology-peltzman-finance/</link>
		<comments>http://quantivity.wordpress.com/2012/01/03/physics-biology-peltzman-finance/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 10:15:24 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=9021</guid>
		<description><![CDATA[Quantivity is fortunate to be acquainted with numerous folks who have earned consistent returns over multiple decades without significant drawdown. Although they have varying trading strategies, there is a common theme which unifies them: top-down systematic focus on the sociology of market participants. This focus is not behavioral finance, in search of anomalies driven by [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=9021&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quantivity is fortunate to be acquainted with numerous folks who have earned consistent returns over multiple decades without significant drawdown. Although they have varying trading strategies, there is a common theme which unifies them: top-down systematic focus on the <em>sociology of market participants</em>.</p>
<p>This focus is <em>not</em> behavioral finance, in search of anomalies driven by cognitive biases divergent from equilibrium (although majority do that too). Rather asking inferential sociological questions, such as: was the market &#8220;efficient&#8221;, in the <a href="http://en.wikipedia.org/wiki/Efficient-market_hypothesis">Fama</a> sense, during the post-war decades prior to 2000 <em>because people expected it to be</em> (blissfully ignoring a few <a href="http://en.wikipedia.org/wiki/Black_Monday_%281987%29">hiccups</a>); in contrast to how it is commonly understood and formalized, with reverse causality: market is assumed to be efficient, thus people understand it as such.</p>
<p>Similarly, have the past 15 years been &#8220;inefficient&#8221;, in the bubble and anomaly sense, <em>because</em> cultural faith among investors in such &#8220;efficiency&#8221; was lost; or, did they lose faith because the market became inefficient? Big difference.</p>
<p>In other words: <em>is finance governed by physics, biology, or Peltzman</em>?</p>
<p><span id="more-9021"></span></p>
<p>The traditional answer of <em>market hypothesis</em>, provided by financial economics via microeconomic principles of <a href="http://en.wikipedia.org/wiki/Market_equilibrium">equilibrium</a> and <a href="http://en.wikipedia.org/wiki/Economic_efficiency">efficiency</a>: causality flows from market to investor. This explanation comes in two variants, known by their colloquial analogical fields:</p>
<ul>
<li><strong>Physics</strong>: market is governed by <em>immutable mathematical principles</em> and can be formalized into coherent <em>predictive</em> models, either in favor or contradiction of excess returns; exemplified by classic weak/strong EMH theory</li>
<li><strong>Biology</strong>: market is governed by evolutionary principles ala Darwin, as exemplified by <a href="http://web.mit.edu/alo/www/Papers/JPM2004.pdf">Lo&#8217;s 2004 AMH</a> article: &#8220;Very existence of active liquid financial markets implies that profit opportunities must be present. As they are exploited, they disappear. But new opportunities are also constantly being created as certain species die out, as others are born, and as institutions and business conditions change.&#8221; (p. 24)</li>
</ul>
<p>Yet, both these explanations suffer from implicitly begging the question: conjure &#8220;a market&#8221; with desired attributes and then derive conclusions. The physics perspective assumes immutability, conceivability, and mathematical expressiveness for its hypothesized market. While the biology perspective endows the hypothesized market with even more sophisticated Darwinian traits, presumably driven by underlying physical principles so inscrutable as to defy mathematical formalization. </p>
<p>An alternative explanation is to apply the self-fulfilling <a href="http://en.wikipedia.org/wiki/Peltzman_effect">Peltzman effect</a> to financial markets, and reverse causality: <em>markets behave as they do because of investor sociology</em>, rather than arising emergent from implicit cooperation of equilibrium-seeking rational microeconomic agents.</p>
<p>In other words: when investors <em>believe</em> the market is rational (irrespective of whether that belief is well-founded), then they embody <a href="http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect">Dunning-Kruger</a> by <em>ex ante</em> faithfully dumping money into their 401K each month; in doing so collectively, the investment management industry undertakes its <a href="http://en.wikipedia.org/wiki/Rent-seeking">rent seeking</a> activity resulting in the market possessing <em>ex post</em> &#8220;efficient&#8221; characteristics. Conversely, when investors believe the market is irrational, they either: go to cash, pursue uninformed non-collective trading, or both. Both of which result in anomalous market behavior, uncontrollable by the industry, either due to decreased liquidity or absence of predictable momentum.</p>
<p>If the market is indeed Peltzmanian, then the real question is how to best quantify and model <em>primary and spillover effects</em> resulting from investor sociology as they unfold ephemerally.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/9021/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/9021/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/9021/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/9021/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/9021/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/9021/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/9021/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/9021/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/9021/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/9021/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/9021/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/9021/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/9021/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/9021/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=9021&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2012/01/03/physics-biology-peltzman-finance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>
	</item>
		<item>
		<title>Return Decomposition via Mixing</title>
		<link>http://quantivity.wordpress.com/2011/12/28/estimating-mixture-index-return-decomposition-via-maximum-likelihood/</link>
		<comments>http://quantivity.wordpress.com/2011/12/28/estimating-mixture-index-return-decomposition-via-maximum-likelihood/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 04:47:20 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=8887</guid>
		<description><![CDATA[A variety of techniques exist for estimating parameters of the return decomposition model, previously introduced in Index Return Decomposition. This post considers estimation of an independent mixture model via maximum likelihood (MLE), a workhorse of frequentist statistics and always a nice place to begin. Recall is unobserved, and thus the model cannot be directly estimated [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8887&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A variety of techniques exist for estimating parameters of the return decomposition model, previously introduced in <a href="http://quantivity.wordpress.com/2011/12/14/index-return-decomposition/">Index Return Decomposition</a>. This post considers estimation of an <em>independent mixture model</em> via maximum likelihood (MLE), a workhorse of frequentist statistics and always a nice place to begin.</p>
<p>Recall <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> is <em>unobserved</em>, and thus the model cannot be directly estimated via MLE. Thus, need to decide how to approach estimation for this latent variable. One way is to be naive, and simply assume <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> is the deterministic difference in return between stock and index (technically, this generates a <a href="http://en.wikipedia.org/wiki/Likelihood_function#Profile_likelihood">profile likelihood</a> as formalized by <a href="http://people.csail.mit.edu/~jrennie/trg/papers/severini-conditionally-92.pdf">Severini and Wong [1992]</a>, which <a href="http://www.jstor.org/pss/2669386">Murphy and Van Der Vaart [2000]</a> verify is well-behaved consistent with exact likelihood):</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=z_t+%3D+r_t+-+i_t+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_t = r_t - i_t ' title='z_t = r_t - i_t ' class='latex' /></p>
<p>This assumption permits focus on estimating <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' />, providing insight into the <em>mixing behavior</em> of the return being decomposed: if a stock return behaves like its index, then mixing is low with small <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' /> (in the limit, <img src='http://s0.wp.com/latex.php?latex=%5Calpha+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha = 0' title='&#92;alpha = 0' class='latex' /> when a stock behaves identical to its index, as no mixing is required); in contrast, the stock return behaves independent from its index on a regular basis, then mixing is high with a large <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' />.</p>
<p><span id="more-8887"></span></p>
<p>Autocorrelation of <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> is worth consideration, as that helps determine whether time indexing is required for <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' />. For returns with insignificant autocorrelation (common for <em>signed</em> equity returns), the time index is dropped and a single <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' /> is estimated. Yet, <em>conditional dependence</em> often exists between <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' />, consistent with previous posts in the <a href="http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging/">Proxy / Cross Hedging</a> series  (illustrating r-z copula for CRM / QQQ example below):</p>
<p><a href="http://quantivity.files.wordpress.com/2011/12/z-r-empirical-copula.png"><img src="http://quantivity.files.wordpress.com/2011/12/z-r-empirical-copula.png?w=600&#038;h=536" alt="" title="z-r-empirical-copula" width="600" height="536" class="aligncenter size-full wp-image-8914" /></a></p>
<p>Use of this identity for <img src='http://s0.wp.com/latex.php?latex=z_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_i' title='z_i' class='latex' /> transforms the decomposition model into:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=r_t+%3D+s_t+%5Cleft%5B+%5Calpha_t+%7C+%28r_t+-+i_t%29+%7C+%2B+%281+-+%5Calpha_t%29+%5Cbeta+%7C+i_t+%7C+%5Cright%5D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r_t = s_t &#92;left[ &#92;alpha_t | (r_t - i_t) | + (1 - &#92;alpha_t) &#92;beta | i_t | &#92;right] ' title='r_t = s_t &#92;left[ &#92;alpha_t | (r_t - i_t) | + (1 - &#92;alpha_t) &#92;beta | i_t | &#92;right] ' class='latex' /></p>
<p>The model is further simplified into a familiar <em>independent mixture model</em> by dropping sign <img src='http://s0.wp.com/latex.php?latex=s_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s_t' title='s_t' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%5Cbeta&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;beta' title='&#92;beta' class='latex' />, and estimating via MLE using density <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> and return distribution functions <img src='http://s0.wp.com/latex.php?latex=%5Cphi_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_i' title='&#92;phi_i' class='latex' />:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=f%28r_t%3B+%5Cboldsymbol%7B%5Ctheta%7D%29+%3D+%5Calpha+%5Cphi_1%28r_t+-+i_t%29+%2B+%281+-+%5Calpha%29+%5Cphi_2%28i_t%29++&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f(r_t; &#92;boldsymbol{&#92;theta}) = &#92;alpha &#92;phi_1(r_t - i_t) + (1 - &#92;alpha) &#92;phi_2(i_t)  ' title='f(r_t; &#92;boldsymbol{&#92;theta}) = &#92;alpha &#92;phi_1(r_t - i_t) + (1 - &#92;alpha) &#92;phi_2(i_t)  ' class='latex' /></p>
<p>MLE estimation requires assumption of parametric distributions for <img src='http://s0.wp.com/latex.php?latex=%5Cphi_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_i' title='&#92;phi_i' class='latex' />, of which common choices from the literature are normal, student-t, skew-t, or skew hyperbolic student-t (<a href="http://www.econ.ku.dk/fru/conference/Programme/Sunday/F4/Aas_226.pdf">Aas and Haff [2006]</a>). Next question is how to estimate the <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Ctheta%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;theta}' title='&#92;boldsymbol{&#92;theta}' class='latex' /> parameters: <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' /> and family of <img src='http://s0.wp.com/latex.php?latex=%5Cphi_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_i' title='&#92;phi_i' class='latex' /> parameters (<em>e.g.</em> <img src='http://s0.wp.com/latex.php?latex=%5Cmu_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mu_i' title='&#92;mu_i' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%5Csigma_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sigma_i' title='&#92;sigma_i' class='latex' /> if <img src='http://s0.wp.com/latex.php?latex=%5Cphi_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_i' title='&#92;phi_i' class='latex' /> is assumed to be normal). As <img src='http://s0.wp.com/latex.php?latex=i_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i_t' title='i_t' class='latex' /> is observed, one way to proceed is via two-step estimation:</p>
<ol>
<li>Estimate <img src='http://s0.wp.com/latex.php?latex=%5Cphi_2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_2' title='&#92;phi_2' class='latex' /> parameters via MLE from <img src='http://s0.wp.com/latex.php?latex=i_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i_t' title='i_t' class='latex' /></li>
<li>Jointly estimate <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%5Cphi_1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_1' title='&#92;phi_1' class='latex' /> parameters via MLE on the mixture, holding <img src='http://s0.wp.com/latex.php?latex=%5Cphi_2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_2' title='&#92;phi_2' class='latex' /> parameters constant</li>
</ol>
<p>For both, recall the likelihood <img src='http://s0.wp.com/latex.php?latex=%5Cmathcal%7BL%7D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathcal{L} ' title='&#92;mathcal{L} ' class='latex' />, and log likelihood <img src='http://s0.wp.com/latex.php?latex=ln+%5Cmathcal%7BL%7D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='ln &#92;mathcal{L} ' title='ln &#92;mathcal{L} ' class='latex' />, are defined as:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Cmathcal%7BL%7D+%3D+%5Cprod%5Climits_%7Bt%3D1%7D%5ET+f%28r_t%3B+%5Cboldsymbol%7B%5Ctheta%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathcal{L} = &#92;prod&#92;limits_{t=1}^T f(r_t; &#92;boldsymbol{&#92;theta}) ' title='&#92;mathcal{L} = &#92;prod&#92;limits_{t=1}^T f(r_t; &#92;boldsymbol{&#92;theta}) ' class='latex' /></p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Cln+%5Cmathcal%7BL%7D+%3D+%5Csum%5Climits_%7Bt%3D1%7D%5ET+%5Cln+f%28r_t%3B+%5Cboldsymbol%7B%5Ctheta%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;ln &#92;mathcal{L} = &#92;sum&#92;limits_{t=1}^T &#92;ln f(r_t; &#92;boldsymbol{&#92;theta}) ' title='&#92;ln &#92;mathcal{L} = &#92;sum&#92;limits_{t=1}^T &#92;ln f(r_t; &#92;boldsymbol{&#92;theta}) ' class='latex' /></p>
<p>From which MLE of the mixture is maximization of the likelihood over <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Ctheta%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;theta}' title='&#92;boldsymbol{&#92;theta}' class='latex' />, where log is chosen for numeric stability:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%5Cmax_%7B%5Cboldsymbol%7B%5Ctheta%7D%7D+%5Cln+%5Cmathcal%7BL%7D+%3D+%5Cmax_%7B%5Cboldsymbol%7B%5Ctheta%7D%7D+%5Csum%5Climits_%7Bt%3D1%7D%5ET+%5Cleft%28+%5Cln+%5Cleft%5B+%5Calpha+%28r_t+-+i_t%29+%2B+%281+-+%5Calpha%29+i_t+%5Cright%5D+%5Cright%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;displaystyle &#92;max_{&#92;boldsymbol{&#92;theta}} &#92;ln &#92;mathcal{L} = &#92;max_{&#92;boldsymbol{&#92;theta}} &#92;sum&#92;limits_{t=1}^T &#92;left( &#92;ln &#92;left[ &#92;alpha (r_t - i_t) + (1 - &#92;alpha) i_t &#92;right] &#92;right)' title='&#92;displaystyle &#92;max_{&#92;boldsymbol{&#92;theta}} &#92;ln &#92;mathcal{L} = &#92;max_{&#92;boldsymbol{&#92;theta}} &#92;sum&#92;limits_{t=1}^T &#92;left( &#92;ln &#92;left[ &#92;alpha (r_t - i_t) + (1 - &#92;alpha) i_t &#92;right] &#92;right)' class='latex' /></p>
<p>This optimization can be performed numerically in R via minimization using <code>DEoptim</code> of the negative log likelihood <code>negLogLikeFun</code> (negative is due to minimization in <code>DEoptim</code> versus maximization of <img src='http://s0.wp.com/latex.php?latex=%5Cln+%5Cmathcal%7BL%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;ln &#92;mathcal{L}' title='&#92;ln &#92;mathcal{L}' class='latex' />). <code>DEoptim</code> is chosen due to rapid convergence on non-smooth global optimizations.</p>
<p>For example, continuing the example of CRM / QQQ introduced in the previous posts on <a href="http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging/">Proxy / Cross Hedging</a> generates the results:</p>
<p><pre class="brush: r;">
&gt; symbols &lt;- c(&quot;CRM&quot;, &quot;QQQ&quot;)
&gt; endDate &lt;- Sys.Date()
&gt; startDate &lt;- endDate - as.difftime(52*5, unit=&quot;weeks&quot;)
&gt; quoteType &lt;- &quot;Close&quot;
&gt; p &lt;- do.call(cbind, lapply(symbols, get.hist.quote, start=startDate, end=endDate,  quote=quoteType))
&gt; colnames(p) &lt;- symbols
&gt; doReturnDecomp(p)
normal mix likelihood: -3485.55 phi1 params: 0.0003471366 0.01673634 params 0.2546208 -0.001208877 0.0113988
skew-t mix likelihood: -3566.512 phi1 params: 0.003844969 0.01079941 -0.3252923 2.893228 params 0.2357737 -0.004188977 0.01099266 0.4157174 26.5643
skew-hyp-t likelihood: -3083.700 phi1 params: 0.01051675 0.1485529 -3.945452 10.10836 params 0.8295289 -0.0003636940 0.03071332 -0.5 5
</pre></p>
<p>These results correspond to the following density functions for the skew-t mixture:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/12/return-decomp-mixture-densities-skewt2.png"><img src="http://quantivity.files.wordpress.com/2011/12/return-decomp-mixture-densities-skewt2.png?w=600&#038;h=610" alt="" title="return-decomp-mixture-densities-skewt" width="600" height="610" class="aligncenter size-full wp-image-8927" /></a></p>
<p>One interesting observation of these densities is their location parameters are on opposing side of zero: <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> has positive location, while <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' /> has negative location. One interpretation of this is positive returns from CRM disproportionately originate from the idiosyncratic <img src='http://s0.wp.com/latex.php?latex=z_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_t' title='z_t' class='latex' />, while negative returns originate from the index <img src='http://s0.wp.com/latex.php?latex=i_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i_t' title='i_t' class='latex' />. Economically, this is plausible: positive news is often idiosyncratic, while negative news is often market-wide.</p>
<p>Several additional inferences can be drawn from these results:</p>
<ul>
<li>Model selection: likelihood suggests skew-t is the preferred model, indicating long tails and skewness (matching stylized facts)</li>
<li>Mixing: <img src='http://s0.wp.com/latex.php?latex=%5Calpha+%3D+0.24&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha = 0.24' title='&#92;alpha = 0.24' class='latex' /> indicating that over 75% of CRM returns are determined by the corresponding QQQ index; remaining 25% are determined by the unobserved <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> return series</li>
<li>Tails: CRM <img src='http://s0.wp.com/latex.php?latex=%5Cphi_1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_1' title='&#92;phi_1' class='latex' /> df = 2.89 which indicates significantly thicker tails than QQQ <img src='http://s0.wp.com/latex.php?latex=%5Cphi_2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_2' title='&#92;phi_2' class='latex' /> df = 26.56 (matching stylized facts for individual stocks versus indices)</li>
</ul>
<p>Subsequent posts may consider alternative estimation techniques for this model.</p>
<hr />
R code for generating two-stage MLE estimation of return decomposition via mixing:</p>
<p><pre class="brush: r;">
library(&quot;MASS&quot;)
library(&quot;stats&quot;)
library(&quot;DEoptim&quot;)
library(&quot;sn&quot;)
library(&quot;SkewHyperbolic&quot;)

normalMixtureIndexDecomp &lt;- function(r, i)
{
  # Two-step MLE estimation of return decomposition model, assuming both
  # return distributions are normal.
  #
  # Args:
  #   r: return series being decomposed
  #   i: index series used for decomposition
  #
  # Return value: MLE parameter estimates
  
  z &lt;- r - i
  id &lt;- fitdistr(i, &quot;normal&quot;)$estimate
  negLogLikeFun &lt;- function(p) {
    a &lt;- p[1]; mu1 &lt;- p[2]; s1 &lt;- p[3];
    ll &lt;- (-sum(log(a * dnorm(z,mu1,s1) + (1 - a) * dnorm(i, id[1], id[2]))));
    return (ll); 
  }
  mle &lt;- DEoptim(negLogLikeFun, c(0, -0.5, 0), c(1, .5, .5), control=list(trace=FALSE))
  
  cat(&quot;normal mix likelihood:&quot;, last(mle$member$bestvalit), &quot;phi1 params:&quot;,id, &quot;params&quot;, last(mle$member$bestmemit),&quot;\n&quot;)
  mle &lt;- last(mle$member$bestmemit)
  
  x &lt;- seq(-.25,.25,length.out=500)
  dnorm1 &lt;- dnorm(x, id[1], id[2])
  dnorm2 &lt;- dst(x, mle[2], mle[3])
  plot(x, dnorm1, type='l', ylim=c(0, max(dnorm1,dnorm2)), ylab=&quot;Density&quot;, main=&quot;Normal Mixture&quot;)
  lines(x, dnorm2, col='red')
  abline(v=id[1], lty=2)
  abline(v=mle[2], col='red', lty=2)
  legend(&quot;topleft&quot;,legend=c(&quot;phi1&quot;, &quot;phi2&quot;), fill=colors, cex=0.5)
    
  return (mle)
}

mixtureSkewTIndexDecomp &lt;- function(r, i)
{
  # Two-step MLE estimation of return decomposition model, assuming both
  # return distributions are skew-t.
  #
  # Args:
  #   r: return series being decomposed
  #   i: index series used for decomposition
  #
  # Return value: MLE parameter estimates

  z &lt;- r - i
  idp &lt;- st.mle(y=i)$dp
  negLogLikeFun &lt;- function(p) {
    a &lt;- p[1]; mu1 &lt;- p[2]; s1 &lt;- p[3]; s2 &lt;- p[4]; df1 &lt;- p[5]
    ll &lt;- (-sum(log(a * dst(z,location=mu1,scale=s1,shape=s2,df=df1) + (1 - a) * dst(i, dp=idp))));
    return (ll); 
  }
  mle &lt;- DEoptim(negLogLikeFun, c(0, -0.5, 0, 0, 2), c(1, .5, .5, 5, 50), control=list(trace=FALSE))
  
  cat(&quot;skew-t mix likelihood:&quot;, last(mle$member$bestvalit), &quot;phi1 params:&quot;, idp, &quot;params&quot;, last(mle$member$bestmemit),&quot;\n&quot;)
  mle &lt;- last(mle$member$bestmemit)

  
  x &lt;- seq(-.25,.25,length.out=500)
  dst1 &lt;- dst(x, dp=idp)
  dst2 &lt;- dst(x, dp=mle[2:5])
  plot(x, dst1, type='l', ylim=c(0, max(dst1,dst2)), ylab=&quot;Density&quot;, main=&quot;Skew T Mixture&quot;)
  lines(x, dst2, col='red')
  abline(v=idp[1], lty=2)
  abline(v=mle[2], col='red', lty=2)
  legend(&quot;topleft&quot;,legend=c(&quot;phi1&quot;, &quot;phi2&quot;), fill=colors, cex=0.5)
  
  return (mle)
}

mixtureSkewHypTIndexDecomp &lt;- function(r, i)
{
  # Two-step MLE estimation of return decomposition model, assuming both
  # return distributions are skew hyperbolic student-t.
  #
  # Args:
  #   r: return series being decomposed
  #   i: index series used for decomposition
  #
  # Return value: MLE parameter estimates

  z &lt;- r - i
  iparam &lt;- skewhypFit(i,plots=FALSE,printOut=FALSE)$param
  negLogLikeFun &lt;- function(p) {
    a &lt;- p[1];
    ll &lt;- (-sum(log(a * dskewhyp(z,param=p[2:5]) + (1 - a) * dskewhyp(i, param=iparam))));
    return (ll); 
  }
  mle &lt;- DEoptim(negLogLikeFun, c(0, -5, 0, -0.5, 0), c(1, 5, .5, -0.5, 5), control=list(trace=FALSE))
  
  cat(&quot;skew-hyp-t likelihood:&quot;, last(mle$member$bestvalit), &quot;phi1 params:&quot;,iparam,&quot;params&quot;, last(mle$member$bestmemit),&quot;\n&quot;)
  mle &lt;- last(mle$member$bestmemit)

  
  x &lt;- seq(-.25,.25,length.out=500)
  dskewhyp1 &lt;- dskewhyp(x, param=iparam)
  dskewhyp2 &lt;- dskewhyp(x, param=mle[2:5])
  plot(x, dskewhyp1, type='l', ylim=c(0, max(dskewhyp1,dskewhyp2)), ylab=&quot;Density&quot;, main=&quot;Skew Hyperbolic Student-T&quot;)
  lines(x, dskewhyp2, col='red')
  abline(v=iparam[1], lty=2)
  abline(v=mle[2], col='red', lty=2)
  legend(&quot;topleft&quot;,legend=c(&quot;phi1&quot;, &quot;phi2&quot;), fill=colors, cex=0.5)

  return (mle)
}

doReturnDecomp &lt;- function(p)
{
  # Decompose return of two series, using several parametric distributions.
  #
  # Args:
  #   p: p[,1] is return being decomposed; p[,2] is index returns
  #
  # Return value: none

  r &lt;- ROC(p[,1], type=&quot;discrete&quot;, na.pad=FALSE)
  i &lt;- ROC(p[,2], type=&quot;discrete&quot;, na.pad=FALSE)
  
  normalMixtureIndexDecomp(r, i)
  mixtureSkewTIndexDecomp(r,i)
  mixtureSkewHypTIndexDecomp(r,i)
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/8887/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/8887/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/8887/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/8887/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/8887/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/8887/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/8887/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/8887/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/8887/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/8887/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/8887/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/8887/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/8887/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/8887/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8887&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/12/28/estimating-mixture-index-return-decomposition-via-maximum-likelihood/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/12/z-r-empirical-copula.png" medium="image">
			<media:title type="html">z-r-empirical-copula</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/12/return-decomp-mixture-densities-skewt2.png" medium="image">
			<media:title type="html">return-decomp-mixture-densities-skewt</media:title>
		</media:content>
	</item>
		<item>
		<title>Risk Pragmatics</title>
		<link>http://quantivity.wordpress.com/2011/12/17/risk-pragmatics/</link>
		<comments>http://quantivity.wordpress.com/2011/12/17/risk-pragmatics/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 06:30:42 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=8737</guid>
		<description><![CDATA[Risk is deeply underappreciated. Moreover, it is misunderstood&#8212;even by many who have smelled it up close personally via big trading loses on hedged positions. Aaron Brown&#8217;s most recent text, Red-Blooded Risk, explains why. In doing so, it is simultaneously brilliant and flawed. For the former, Brown deserves credit; for the latter, the publisher presumably deserves [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8737&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://quantivity.files.wordpress.com/2011/12/redblood.png"><img src="http://quantivity.files.wordpress.com/2011/12/redblood.png?w=196&#038;h=300" alt="" title="Red Blooded Risk" width="196" height="300" class="alignright size-medium wp-image-8738" /></a> Risk is <em>deeply</em> underappreciated.</p>
<p>Moreover, it is misunderstood&mdash;even by many who have smelled it up close personally via big trading loses on hedged positions. Aaron Brown&#8217;s most recent text, <a href="http://books.google.com/books?id=X3sGahpmkQ0C"><cite>Red-Blooded Risk</cite></a>, explains why.</p>
<p>In doing so, it is <em>simultaneously brilliant and flawed</em>. For the former, Brown deserves credit; for the latter, the publisher presumably deserves most of the blame.</p>
<p><span id="more-8737"></span></p>
<p>First, the brilliance; summarized in one word, with two intended meanings: <em>pragmatics</em>. Oh yeah, the book includes 漫画-style comic strips, helpfully provided as idiot self-detectors.</p>
<p>First, well-known meaning is the philosophical tradition linking practice and theory. Arguably unique for risk books, Brown builds deep intuition around the concept of risk and its manifestation from structural to marked positions to historical roots in tulips. Brown has clearly lived and breathed risk management for many years (self-proclaimed from its modern origin in the 1980s), and that wisdom shines through via first-person prose combining insight, intuition, arrogance, pride, greed, humility, regret, condescension, and insecurity. Perhaps the first book ever to make VaR sound geek-sexy&mdash;<em>with nary a technical definition</em>.</p>
<p>Second, lesser-known meaning is the subfield of linguistics which investigates ways in which context contributes to meaning. Unlike technical risk texts, Brown spends much of the book deep diving into context and letting meaning emanate from therein. As he states, &#8220;different aspects are easier to understand from different vantages&#8221; (p. 57). As a reader who never personally worked at a big bank, this is deeply informative for attuning mental models (akin to <a href="http://books.google.com/books?id=Rd9hDRR1Yx4C">Harris</a> for trading mechanics, <a href="http://books.google.com/books?id=HD9P6L2zX48C">Rebonato</a> for derivatives, and <a href="http://books.google.com/books?id=-5-OldaTjVQC">Taleb</a> for hedging). Explaining the lineage of quant hedge funds through the corresponding frequentist versus Bayesian disposition of their founders is fascinating, and indeed makes sense in retrospect. Slicing away the credibility mystique and exposing the raw underbelly of banks, down to explaining front, middle, and back office in depth. For readers familiar with disciplined metrics-driven tech companies, the apparent intellectual and technical sloppiness of big banks is simply jaw dropping.</p>
<p>One excerpt simply must be quoted, beginning of Chapter 4, as it is perhaps the most accurate and beautiful summary of self-entitlement believed by geeks with <img src='http://s0.wp.com/latex.php?latex=4%5Csigma&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='4&#92;sigma' title='4&#92;sigma' class='latex' />-IQ time immemorial:</p>
<blockquote><p>The rocket scientists came together on Wall Street in the 1980s and began the process that eventually explained the modern concept of probability and reconstructed the global financial system. We were not individually ambitious. All we wanted was to make more money than any rational person could spend, without ever putting on a tie or being polite to anyone we didn&#8217;t like. We didn&#8217;t have any use for the money, except for maybe some books and cool computer equipment. We didn&#8217;t want to throw (or go to) fancy parties or buy political power&mdash;and we didn&#8217;t spend it on cars, jewelry, or places to live, and least of all on clothes. We&#8217;d probably give the money away, but until then, it would give us the power to say &#8220;f- you&#8221; to anyone, except that we were mostly pretty soft-spoken and civil in our expressions</p></blockquote>
<p>Now, the flawed parts.</p>
<p>One reviewer caveat worth advance mention is 9 books out of 10 read by Quantivity have content dense with math, code, or both. On the positive side, reading of Brown&#8217;s book indicates positive noteworthiness due to its statistical abnormality (given it has neither); on the negative side, any review is biased through such lens.</p>
<p>First, <em>lots</em> of effort was expended by the publisher making this text appeal to a mass audience, clearly rushing to fill the void of perceived post-financial crisis publishing opportunity. From the ridiculous title (and cover) to the silly use of &#8220;secret history&#8221; meme to hilarious tongue-in-cheek back cover reviewer comments by Gatheral, Taleb, Wilmott, and Thorp. Parts of the book are prone to hyperbole, which read like they were edited in for sales effect. While these nuisances detract credibility, such can be ignored and arguably contributes the positive benefit of reducing its purchase price to mass market (<em>i.e.</em> under $25).</p>
<p>Second, the book lacks unifying organization. While Brown provides the following disclaimer for such, the editor equally deserves some blame (p. 57):</p>
<blockquote><p>If I had all the theory worked out, I could write a textbook organized in logical sequence. Instead, I&#8217;m going to intersperse theoretical discussions with accounts of the development of the ideas.</p></blockquote>
<p>While this makes sense, it is admittedly a bit jarring to see that disclaimer juxtaposed alongside supposition of having &#8220;explained the modern concept of probability&#8221;. Thus, the reader is left wondering whether perhaps either of the following may be true: </p>
<ul>
<li>Brown has a theory of risk, but was refused in editing due to overabundance of equations</li>
<li>Brown has a new theory of probability, but could not muster a theory of risk</li>
</ul>
<p>Either are intriguing, although perhaps the former seems more likely as Brown includes the following tongue-in-cheek disclaimer regarding use of a tiny bit of high school-level math included in Chapter 5 (p. 73):</p>
<blockquote><p>Warning, this chapter contains a little math. It&#8217;s nothing intimidating, mostly multiplication and some simple algebra, but I know a lot of people don&#8217;t like it. If that describes you, I urge you to read the chapter anyway. It&#8217;s one of the most important in the book. You can skip the math and get the ideas anyway.</p></blockquote>
<p>Having never met Brown and thus unfamiliar with his personality, cannot escape the sense that he is making gentle fun of readers which possess such bias. Either way, it&#8217;s amusing.</p>
<p>While modest disorganization is a textual flaw, astute readers may perhaps perceive it as <em>subtle financial opportunity</em>: if such theory was sufficiently well-defined to warrant standard textbook treatment, then there would undoubtedly be much less juice possible from doing it really well.</p>
<p>In either case, remedy for this shortcoming is to read the book in as few distinct sittings as possible. Having read it in two sittings, the wisdom was able to percolate together and expand personal mental models nicely. Well worth the read.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/8737/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8737&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/12/17/risk-pragmatics/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/12/redblood.png?w=196" medium="image">
			<media:title type="html">Red Blooded Risk</media:title>
		</media:content>
	</item>
		<item>
		<title>Index Return Decomposition</title>
		<link>http://quantivity.wordpress.com/2011/12/14/index-return-decomposition/</link>
		<comments>http://quantivity.wordpress.com/2011/12/14/index-return-decomposition/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 08:23:16 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=8678</guid>
		<description><![CDATA[Unmasking a phenomenon into its constituent parts , via functional decomposition , is one of the great beauties of mathematics: &#160;&#160;&#160; This technique finds surprisingly often use in quant models. Ongoing analysis and trading based on proxy hedging, exemplified by series beginning with Proxy / Cross Hedging, suggests potential for an equity decomposition model based [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8678&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Unmasking a phenomenon <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> into its constituent parts <img src='http://s0.wp.com/latex.php?latex=%5Ctextbf%7Bg%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;textbf{g}' title='&#92;textbf{g}' class='latex' />, via <em>functional decomposition</em> <img src='http://s0.wp.com/latex.php?latex=%5Cphi&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi' title='&#92;phi' class='latex' />, is one of the great beauties of mathematics:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=f%28%5Ctextbf%7Bx%7D%29+%3D+%5Cphi%28g_1%28%5Ctextbf%7Bx%7D%29%2C+g_2%28%5Ctextbf%7Bx%7D%29%2C+%5Cdots%2C+g_n%28%5Ctextbf%7Bx%7D%29%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f(&#92;textbf{x}) = &#92;phi(g_1(&#92;textbf{x}), g_2(&#92;textbf{x}), &#92;dots, g_n(&#92;textbf{x})) ' title='f(&#92;textbf{x}) = &#92;phi(g_1(&#92;textbf{x}), g_2(&#92;textbf{x}), &#92;dots, g_n(&#92;textbf{x})) ' class='latex' /></p>
<p>This technique finds surprisingly often use in quant models.</p>
<p>Ongoing analysis and trading based on proxy hedging, exemplified by series beginning with <a href="http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging/">Proxy / Cross Hedging</a>, suggests potential for an equity decomposition model based on the relationship between returns of a stock <img src='http://s0.wp.com/latex.php?latex=r_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r_t' title='r_t' class='latex' /> and its corresponding index <img src='http://s0.wp.com/latex.php?latex=i_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i_t' title='i_t' class='latex' />:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=r_t+%3D+s_t+%5Cleft%5B+%5Calpha_t+%7C+z_t+%7C+%2B+%281+-+%5Calpha_t%29+%5Cbeta+%7C+i_t+%7C+%5Cright%5D+%2B+%5Cepsilon_t+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r_t = s_t &#92;left[ &#92;alpha_t | z_t | + (1 - &#92;alpha_t) &#92;beta | i_t | &#92;right] + &#92;epsilon_t ' title='r_t = s_t &#92;left[ &#92;alpha_t | z_t | + (1 - &#92;alpha_t) &#92;beta | i_t | &#92;right] + &#92;epsilon_t ' class='latex' /></p>
<p>To explain this model, let&#8217;s build it up from intuition.</p>
<p><span id="more-8678"></span></p>
<p>To begin, consider a trading observation: interday returns of individual stocks have a subtle relationship with their corresponding index. On some days, return for a given stock follows its index; other days, returns of stock and index diverge strongly. This distinction in behavior is commonly attributed to stock-specific &#8220;news&#8221;, interpreted broadly&mdash;whether known publicly or only privately. </p>
<p>This intuition can be formalized into two-state regime:</p>
<ul>
<li><strong>Uninformed regime</strong>: stock return <img src='http://s0.wp.com/latex.php?latex=r_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r_t' title='r_t' class='latex' /> follows an index <img src='http://s0.wp.com/latex.php?latex=i_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i_t' title='i_t' class='latex' />, scaled by a proportional factor <img src='http://s0.wp.com/latex.php?latex=%5Cbeta&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;beta' title='&#92;beta' class='latex' /></li>
<li><strong>Informed regime</strong>: stock return <img src='http://s0.wp.com/latex.php?latex=r_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r_t' title='r_t' class='latex' /> follows an idiosyncratic path <img src='http://s0.wp.com/latex.php?latex=z_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_t' title='z_t' class='latex' />, conditionally independent of its index</li>
</ul>
<p>Relationship between regimes can be modeled in two ways via <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' />. A switching model arises when regimes are binary: <img src='http://s0.wp.com/latex.php?latex=%5Calpha+%5Cin+%5C%7B+0%2C+1+%5C%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha &#92;in &#92;{ 0, 1 &#92;}' title='&#92;alpha &#92;in &#92;{ 0, 1 &#92;}' class='latex' />. An ensemble model arises when regimes are smooth: <img src='http://s0.wp.com/latex.php?latex=%5Calpha+%5Cin+%5B+0%2C+1+%5D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha &#92;in [ 0, 1 ]' title='&#92;alpha &#92;in [ 0, 1 ]' class='latex' />. For the latter, <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' /> can be understood as proportional decomposition weighting of the respective return series, and thus can provide smooth mixing between the regimes. Finally, sign of returns are explicitly decomposed as <img src='http://s0.wp.com/latex.php?latex=s_t+%5Cin+%5C%7B+-1%2C+1+%5C%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='s_t &#92;in &#92;{ -1, 1 &#92;}' title='s_t &#92;in &#92;{ -1, 1 &#92;}' class='latex' />, acknowledging greater regularity of absolute-valued return series.</p>
<p>Worth noting is the following are <em>latent</em> variables: idiosyncratic path <img src='http://s0.wp.com/latex.php?latex=z_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z_t' title='z_t' class='latex' /> from the informed regime, proportional factor <img src='http://s0.wp.com/latex.php?latex=%5Cbeta&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;beta' title='&#92;beta' class='latex' />, and regime parameter <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' />. Obviously, challenge of this model lies in their estimation. One potential trick is to exploit triangular relationships, as described below.</p>
<p>One stylized fact <em>not</em> explicitly accommodated by this model is well-known <em>asymmetry of uninformed regimes</em>, arising from analysis of market breadth: stocks uniformly go down together (think big down days), but much less often uniformly go up together (majority of rallies). Unclear whether this fact naturally arises via <img src='http://s0.wp.com/latex.php?latex=%5Calpha&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;alpha' title='&#92;alpha' class='latex' /> or needs to be explicitly modeled.</p>
<p>Readers familiar with machine learning (ML) may recognize how to reformulate this as an <em>additive model</em>:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=r%28%5Ctextbf%7Bx%7D%29+%3D+%5Csum%5Climits_%7Bi%3D1%7D%5E2+w_i+f_i%28%5Ctextbf%7Bx%7D%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r(&#92;textbf{x}) = &#92;sum&#92;limits_{i=1}^2 w_i f_i(&#92;textbf{x}) ' title='r(&#92;textbf{x}) = &#92;sum&#92;limits_{i=1}^2 w_i f_i(&#92;textbf{x}) ' class='latex' /></p>
<p>Where <img src='http://s0.wp.com/latex.php?latex=%5Ctextbf%7Bx%7D+%5Cequiv+%5C%7B+z%2C+i%2C+%5Calpha%2C+%5Cbeta+%5C%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;textbf{x} &#92;equiv &#92;{ z, i, &#92;alpha, &#92;beta &#92;}' title='&#92;textbf{x} &#92;equiv &#92;{ z, i, &#92;alpha, &#92;beta &#92;}' class='latex' />.</p>
<p>This model can be interpreted in numerous ML ways, depending on the desired objective. For example, <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' /> can be interpreted as basis functions. Alternatively, boosting can be applied by interpreting them as weak classifiers. Graphical models can be applied by introducing conditional dependence between <img src='http://s0.wp.com/latex.php?latex=r&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r' title='r' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' />. Hierarchical models and decision trees naturally arise when <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' /> are further functionally decomposed.</p>
<p>Given this model, an interesting question is how to use it <em>predicatively</em>&mdash;whether directional or not. For example, combining models for two stocks which share a common index to introduce the notion of equity triangle arbitrage on the joint <img src='http://s0.wp.com/latex.php?latex=z&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='z' title='z' class='latex' />.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/8678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/8678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/8678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/8678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/8678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/8678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/8678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/8678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/8678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/8678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/8678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/8678/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/8678/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/8678/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8678&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/12/14/index-return-decomposition/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>
	</item>
		<item>
		<title>Update: Curated Quant Research Feed</title>
		<link>http://quantivity.wordpress.com/2011/11/04/update-curated-quant-research-feed/</link>
		<comments>http://quantivity.wordpress.com/2011/11/04/update-curated-quant-research-feed/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 13:47:09 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=8559</guid>
		<description><![CDATA[Quantivity is pleasantly surprised to discover an increasing number of folks are deriving value from the Curated Quant Research Feed on @Quantivity. Indeed, the combo of daily curated feed with single-source retrospective search has become indispensable for personal research. Towards understanding why, Kedrosky provides nice explanation in his Curation is the New Search is the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8559&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quantivity is pleasantly surprised to discover an increasing number of folks are deriving value from the <a href="http://quantivity.wordpress.com/2011/07/28/curated-research-feed/">Curated Quant Research Feed</a> on <a href="http://twitter.com/quantivity">@Quantivity</a>. Indeed, the combo of daily curated feed with <em>single-source</em> retrospective search has become indispensable for personal research. Towards understanding why, Kedrosky provides nice explanation in his <a href="http://paul.kedrosky.com/archives/2011/01/curation_is_the.html">Curation is the New Search is the New Curation</a> post earlier this year:</p>
<blockquote><p>Head back to curation and watch new algos emerge on top of that next-gen curation again. Think of Twitter as a new stab at curation. Curated sites will re-seed a new generation of algorithmic search sites. In short, curation is the new search.</p></blockquote>
<p>Indeed, intent of curation here is to maintain <em>high signal-to-noise ratio</em> for a mix of preprint and classics in a <em>highly-specialized</em> literature (<em>i.e.</em> combo of retail <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BP%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathbb{P}' title='&#92;mathbb{P}' class='latex' /> and prop <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BQ%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathbb{Q}' title='&#92;mathbb{Q}' class='latex' />) for which strong motivation exists elsewhere to obfuscate; and search over the stream provides ability to both rewind time and to integrate <em>conceptual connectivity</em> spanning time.</p>
<p><span id="more-8559"></span></p>
<p>One addition being contemplated is keyword search over all literature cited in feed, providing <em>deep content search</em> over the feed. Although, unclear yet what is the best technical avenue to implement this (please comment, if you have suggestions).</p>
<p>So, with this positive start, curation input set is being modestly expanded to coincide with increased personal research activity and availability of several new quant sources&mdash;<em>while maintaining the same focus and high signal-to-noise goal</em>. Specifically, curation is expanding to include the following SSRN working papers: <a href="http://papers.ssrn.com/sol3/JELJOUR_Results.cfm?form_name=journalbrowse&amp;journal_id=1681611">ARPM Series</a> and <a href="http://www.aeaweb.org/jel/jel_class_system.php">JEL Codes</a> G11 (Portfolio Choice), G12 (Asset Pricing), G13 (Contingent Pricing; Futures Pricing), G14 (Information and Market Efficiency), C21 (Cross-Sectional Models), C22 (Time-Series Models), C51 (Model Construction and Estimation), and C53 (Forecasting and Other Model Applications). Selection of JEL codes is data-driven: feed links were ranked by JEL classification and most cited classifications were chosen.</p>
<p>Authors are encouraged to ensure correct use of JEL codes, to ensure your articles are picked up.</p>
<p>Curious what readers think? Are there other high-value sources worth adding to curation input set? What else could make this more useful?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/8559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/8559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/8559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/8559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/8559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/8559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/8559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/8559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/8559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/8559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/8559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/8559/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/8559/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/8559/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8559&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/11/04/update-curated-quant-research-feed/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>
	</item>
		<item>
		<title>Inquiry: Algebraic Geometry and Topology</title>
		<link>http://quantivity.wordpress.com/2011/10/31/algebraic-geometry-and-topology-inquiry/</link>
		<comments>http://quantivity.wordpress.com/2011/10/31/algebraic-geometry-and-topology-inquiry/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 08:17:59 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=8462</guid>
		<description><![CDATA[Algebraic geometry and topology traditionally focused on fairly pure math considerations. With the rise of high-dimensional machine learning, these fields are increasing being pulled into interesting computational applications such as manifold learning. Algebraic statistics and information geometry offer potential to help bridge these fields with modern statistics, especially time-series and random matrices. Early evidence suggests [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8462&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Algebraic geometry and topology traditionally focused on fairly pure math considerations. With the rise of high-dimensional machine learning, these fields are increasing being pulled into interesting computational applications such as <a href="http://quantivity.wordpress.com/2011/05/08/manifold-learning-differential-geometry-machine-learning">manifold learning</a>. Algebraic statistics and information geometry offer potential to help bridge these fields with modern statistics, especially time-series and random matrices.</p>
<p>Early evidence suggests potential for <em>significant</em> intellectual cross-fertilization with finance, both mathematical and computational. Geometrically, richer modeling and analysis of latent geometric structure than available from classic linear algebraic decomposition (<em>e.g.</em> PCA, one of the main workhorses of modern <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BP%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathbb{P}' title='&#92;mathbb{P}' class='latex' /> finance); for example, cumulant component analysis. Topologically, more effective qualitative analysis of data sampled from manifolds or singular algebraic varieties; for example, persistent homology (see <a href="http://comptop.stanford.edu/">CompTop</a>).</p>
<p><span id="more-8462"></span></p>
<p>As evidence by Twitter followers, numerous Quantivity readers are familiar with these fields. Thus, perhaps the best way to explore is to seek insight from readers.</p>
<p><strong>Readers</strong>: <em>please use comments or twitter to suggest applied literature from these fields</em>; ideally, although not required, that of potential relevance to finance modeling. All types of literature are requested, from intro texts to survey articles to preprint working papers on specific applications.</p>
<p>These suggestions will be synthesized into one or more subsequent posts, along with appropriate additions to <a href="http://quantivity.wordpress.com/2011/03/06/people-of-quant-research/">People of Quant Research</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/8462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/8462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/8462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/8462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/8462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/8462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/8462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/8462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/8462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/8462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/8462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/8462/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/8462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/8462/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8462&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/10/31/algebraic-geometry-and-topology-inquiry/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>
	</item>
		<item>
		<title>Proxy Conditional Model Selection</title>
		<link>http://quantivity.wordpress.com/2011/10/30/proxy-cross-hedge-conditional-model-selection/</link>
		<comments>http://quantivity.wordpress.com/2011/10/30/proxy-cross-hedge-conditional-model-selection/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 08:05:01 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=8309</guid>
		<description><![CDATA[Lag Dynamics with Autocopulas investigated autocopulas for underlying and hedge instruments as applied to proxy / cross hedging, concluding the existence of large-magnitude temporal volatility clustering. This is indeed a known stylized fact of financial returns (see Tsay 2010, Chapters 2 and 3). The classic discrete-time models for capturing such statistical conditionality are ARMA (see [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8309&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://quantivity.wordpress.com/2011/10/16/lag-dynamics-with-autocopulas">Lag Dynamics with Autocopulas</a> investigated autocopulas for underlying and hedge instruments as applied to <a href="http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging">proxy / cross hedging</a>, concluding the existence of <em>large-magnitude temporal volatility clustering</em>. This is indeed a known stylized fact of financial returns (see <a href="http://books.google.com/books?id=OKUGARAXKMwC">Tsay 2010</a>, Chapters 2 and 3).</p>
<p>The classic <em>discrete-time</em> models for capturing such <em>statistical conditionality</em> are <a href="http://en.wikipedia.org/wiki/Autoregressive%E2%80%93moving-average_model">ARMA</a> (see <a href="http://books.google.com/books?id=lJnnPQAACAAJ">Box <em>et. al</em> (1994)</a>) and <a href="http://en.wikipedia.org/wiki/Autoregressive_conditional_heteroskedasticity#GARCH">GARCH</a> (see <a href="http://www.jstor.org/pss/1912773">Engle (1982)</a> and <a href="http://www.sciencedirect.com/science/article/pii/0304407686900631">Bollerslev (1986)</a>), for returns and volatility respectively. Yet, therein lies a practical problem faced by hedge analysis: <em>necessity to select a model with optimal parameters and error distribution for underlying and hedge</em>. This post describes and implements such <a href="http://en.wikipedia.org/wiki/Model_selection">model selection</a> for choosing a model from the universe of standard parameters and non-normal error distributions.</p>
<p><span id="more-8309"></span></p>
<p>To illustrate this methodology for proxy hedging, begin by reviewing required statistical machinery. Next, illustrate results and graphical visualization with ongoing example of a well-known equity and QQQ. Finally, finish with R code.</p>
<p><strong>Statistical Models</strong></p>
<p>Three pieces of statistical machinery are required, briefly reviewed here: ARMA, GARCH, and BIC. </p>
<p>Conditional returns can be described by the ARMA(<em>p</em>, <em>q</em>) model:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=r_t+%3D+%5Cleft%5B+%5Cphi_0+%2B+%5Csum%5Climits_%7Bi%3D1%7D%5Ep+%5Cphi_i+r_%7Bt-i%7D+%5Cright%5D+%2B+%5Cleft%5B+a_t+%2B+%5Csum%5Climits_%7Bj%3D1%7D%5Eq+%5Ctheta_j+a_%7Bt-j%7D+%5Cright%5D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='r_t = &#92;left[ &#92;phi_0 + &#92;sum&#92;limits_{i=1}^p &#92;phi_i r_{t-i} &#92;right] + &#92;left[ a_t + &#92;sum&#92;limits_{j=1}^q &#92;theta_j a_{t-j} &#92;right] ' title='r_t = &#92;left[ &#92;phi_0 + &#92;sum&#92;limits_{i=1}^p &#92;phi_i r_{t-i} &#92;right] + &#92;left[ a_t + &#92;sum&#92;limits_{j=1}^q &#92;theta_j a_{t-j} &#92;right] ' class='latex' /></p>
<p>The <img src='http://s0.wp.com/latex.php?latex=%5Cphi_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;phi_i' title='&#92;phi_i' class='latex' /> are autoregressive polynomial and <img src='http://s0.wp.com/latex.php?latex=%5Ctheta_i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;theta_i' title='&#92;theta_i' class='latex' /> is moving average polynomial. Recall from <a href="http://quantivity.wordpress.com/2010/01/08/why-moving-averages/">Why Moving Averages</a> that any <em>stationary</em> stochastic process can be represented by an <img src='http://s0.wp.com/latex.php?latex=%5Ctext%7BARMA%7D%280%2C%5Cinfty%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;text{ARMA}(0,&#92;infty)' title='&#92;text{ARMA}(0,&#92;infty)' class='latex' />, due to <a href="http://en.wikipedia.org/wiki/Wold%27s_theorem">Wold decomposition</a>. Worth recalling is any model whose absolute parameter values are less than 1 is weakly stationary.</p>
<p>Conditional volatility can be described by the GARCH(<em>m</em>, <em>s</em>) model:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Csigma_t%5E2+%3D+%5Comega+%2B+%5Csum%5Climits_%7Bj%3D1%7D%5Es+%5Cbeta_j+%5Csigma%5E2_%7Bt-j%7D+%2B+%5Csum%5Climits_%7Bi%3D1%7D%5Em+%5Calpha_i+a%5E2_%7Bt-i%7D+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sigma_t^2 = &#92;omega + &#92;sum&#92;limits_{j=1}^s &#92;beta_j &#92;sigma^2_{t-j} + &#92;sum&#92;limits_{i=1}^m &#92;alpha_i a^2_{t-i} ' title='&#92;sigma_t^2 = &#92;omega + &#92;sum&#92;limits_{j=1}^s &#92;beta_j &#92;sigma^2_{t-j} + &#92;sum&#92;limits_{i=1}^m &#92;alpha_i a^2_{t-i} ' class='latex' /><br />
&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=a_t+%3D+r_t+-+%5Cmu_t+%3D+%5Csigma_t+%5Cepsilon_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a_t = r_t - &#92;mu_t = &#92;sigma_t &#92;epsilon_t' title='a_t = r_t - &#92;mu_t = &#92;sigma_t &#92;epsilon_t' class='latex' /></p>
<p>From this formulation, GARCH is nicely illustrated as ARMA applied to the squared series <img src='http://s0.wp.com/latex.php?latex=a%5E2_t&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a^2_t' title='a^2_t' class='latex' />. The <img src='http://s0.wp.com/latex.php?latex=%5Cepsilon&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;epsilon' title='&#92;epsilon' class='latex' /> is sequence of iid variables, drawn from one of the following distributions: student-t, skew-t, or skew normal. Choice of student-t and skew are motivated by previous posts (and voluminous literature), which illustrate residuals following such distributions. Readers may wish to note relationship between this squared series and previous autocopula post.</p>
<p>Finally, the <a href="http://en.wikipedia.org/wiki/Bayesian_information_criterion">Bayesian Information Criteria (BIC)</a> provides the statistic for ranking comparative model fitness of two more ARMA+GARCH models:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=BIC+%3D+-2+%5Ctimes+%5Ctext%7Bln%7D+%28L%29+%2B+k+%5Ctimes+%5Ctext%7Bln%7D+%28n%29+&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='BIC = -2 &#92;times &#92;text{ln} (L) + k &#92;times &#92;text{ln} (n) ' title='BIC = -2 &#92;times &#92;text{ln} (L) + k &#92;times &#92;text{ln} (n) ' class='latex' /></p>
<p>where <img src='http://s0.wp.com/latex.php?latex=L&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='L' title='L' class='latex' /> is model-maximized likelihood value, <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> is number of observations, and <img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k' title='k' class='latex' /> is number of free parameters. Thus, the best model is that with the highest log likelihood penalized by number of estimated parameters (<em>i.e.</em> <img src='http://s0.wp.com/latex.php?latex=n+-+k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n - k' title='n - k' class='latex' />).</p>
<p><strong>Proxy Models</strong></p>
<p>The following performs model selection for CRM and QQQ, over the 5-year observation period:</p>
<p><pre class="brush: r;">
crmModel &lt;- selectProxyModel(ROC(p[,1], type=&quot;discrete&quot;, na.pad=FALSE))
qqqModel &lt;- selectProxyModel(ROC(p[,2], type=&quot;discrete&quot;, na.pad=FALSE))
</pre></p>
<p>CRM is fitted as <em>GARCH(1,1) with student-t errors</em>:</p>
<pre>
       Estimate  Std. Error  t value Pr(&gt;|t|)
omega  1.219e-05   5.781e-06    2.108    0.035 *
alpha1 3.552e-02   9.004e-03    3.945 8.00e-05 ***
beta1  9.544e-01   1.115e-02   85.600  &lt; 2e-16 ***
shape  4.247e+00   5.227e-01    8.124 4.44e-16 ***
</pre>
<p>Thus, autoregressive coefficient is order-1, significant, and equal to 0.0355; variance coefficient is order-1, significant, and equal to 0.9544. Sum of coefficients is 0.9899, thus model possesses either IGARCH unit root or long-memory (<em>e.g.</em> <a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1298332">Andersen (1999)</a>). The residuals are student-t with 4.25 df, which is broadly consistent with the previous distribution fit undertaken in <a href="http://quantivity.wordpress.com/2011/10/10/empirical-copulas-and-proxy-cross-hedge-basis-risk">Empirical Copulas and Hedge Basis Risk</a>.</p>
<p>QQQ is fitted as <em>GARCH(1,1) with skew-t errors</em>:</p>
<pre>
        Estimate  Std. Error  t value Pr(&gt;|t|)
omega  2.833e-06   1.238e-06    2.288   0.0222 *
alpha1 1.005e-01   1.840e-02    5.464 4.64e-08 ***
beta1  8.956e-01   1.748e-02   51.228  &lt; 2e-16 ***
skew   8.516e-01   2.971e-02   28.669  &lt; 2e-16 ***
shape  6.620e+00   1.410e+00    4.694 2.68e-06 ***
</pre>
<p>Thus, autoregressive coefficient is order-1, significant, and equal to 0.1; variance coefficient is order-1, significant, and equal to 0.8956. The residuals are skew-t with df = 6.62 and skew = 0.852 (recall student-t is limit of skew-t with skew=0; see <a href="http://books.google.com/books?id=vgy98mM9zQUC">McNeil, Frey, and Embrechts [2005]</a>). Note autoregression coefficient is nearly 3x larger for QQQ than CRM. Sum of coefficients is 0.9956, thus also possesses either IGARCH unit root or long-memory.</p>
<p>The preceding models can be visualized in several ways. To begin, visualize the conditional volatility for both instruments:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-garch-vol.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-garch-vol.png?w=600&#038;h=610#038;h=610" alt="" title="" width="600" height="610" class="aligncenter size-full wp-image-8230" /></a></p>
<p>Volatility broadly matches intuition and plots from previous posts, with significant spikes during the financial crisis. As observed in previous posts, CRM volatility is significantly larger than QQQ. Note CRM has numerous significant volatility spikes not experienced by QQQ in 2009 and 2010, which correspond to earnings announcements (late-August and mid-November). Kendall correlation of conditional volatility between CRM and QQQ is 0.529, thus there exists a modest volatility dependence relationship:</p>
<p><pre class="brush: r;">
cor(crmModel[3][[1]]@h.t, qqqModel[3][[1]]@h.t, method=&quot;kendall&quot;)
</pre></p>
<p>The copula of the GARCH volatility dependence exhibits large probability of absolute changes conditional on previous large changes, consistent with <a href="http://quantivity.wordpress.com/2011/10/16/lag-dynamics-with-autocopulas">Lag Dynamics with Autocopulas</a>:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-garch-vol-copula.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-garch-vol-copula.png?w=600&#038;h=610#038;h=610" alt="" title="" width="600" height="610" class="aligncenter size-full wp-image-8230" /></a></p>
<p>Next, GARCH residuals exhibit some shortcoming in model fitness, given they retain modest heteroskedasticity:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-garch-residuals.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-garch-residuals.png?w=600&#038;h=610#038;h=610" alt="" title="" width="600" height="610" class="aligncenter size-full wp-image-8230" /></a></p>
<p>Finally, consider plot of fitted GARCH residual distributions:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-garch-error-dist.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-garch-error-dist.png?w=600&#038;h=610#038;h=610" alt="" title="" width="600" height="610" class="aligncenter size-full wp-image-8230" /></a></p>
<p>Which illustrates the significant difference in distribution, both versus each other and normality. Large positive skew for QQQ is particularly interesting. This plot is generated by, where <code>p</code> is the price matrix:</p>
<p><pre class="brush: r;">
pROC &lt;- ROC(p, type=&quot;discrete&quot;, na.pad=FALSE)
x &lt;- seq(-6, 6, length=100)
cnames &lt;- colnames(pROC)
x1 &lt;- dnorm(x)
x2 &lt;- dt(x,df=4.25)
x3 &lt;- dst(x,df=6.62,shape=0.852)
plot(x, x1, type='l',lty=2, ylim=c(0,max(x1,x2,x3)), ylab=&quot;&quot;, main=&quot;GARCH Residual Distributions&quot;)
lines(x, x2, col=colors[2])
lines(x, x3, col=colors[3])
legend(&quot;topleft&quot;,legend=c(&quot;Normal&quot;,cnames[1],cnames[2]), fill=colors, cex=0.5)
</pre></p>
<hr />
R code for proxy hedging model selection:</p>
<p><pre class="brush: r;">
library(&quot;fGarch&quot;)

selectProxyModel &lt;- function(p, useMean=FALSE)
{
  # ARMA+GARCH model selection based on BIC, using the following error
  # distributions: student-t, skew-t, and skew normal. ARMA
  # may be either (1,1) or (2,2); GARCH is only (1,1).
  #
  # Args:
  #   p: single vector of instrument price data
  #   useMean: flag indicating whether mean should be fitted in GARCH
  #
  # Returns: selected GARCH model
  
  g11Std &lt;- garchFit(~ garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;std&quot;, include.mean=useMean)
  g11SStd &lt;- garchFit(~ garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;sstd&quot;, include.mean=useMean)
  g11SNorm &lt;- garchFit(~ garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;snorm&quot;, include.mean=useMean)
  
  g11A11Std &lt;- garchFit(~ arma(1,1) + garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;std&quot;, include.mean=useMean)
  g11A11SStd &lt;- garchFit(~ arma(1,1) + garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;sstd&quot;, include.mean=useMean)
  g11A11SNorm &lt;- garchFit(~ arma(1,1) + garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;snorm&quot;, include.mean=useMean)

  g11A22Std &lt;- garchFit(~ arma(2,2) + garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;std&quot;, include.mean=useMean)
  g11A22SStd &lt;- garchFit(~ arma(2,2) + garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;sstd&quot;, include.mean=useMean)
  g11A22SNorm &lt;- garchFit(~ arma(2,2) + garch(1,1), data = coredata(p), trace = FALSE, cond.dist=&quot;snorm&quot;, include.mean=useMean)
  
  gModel &lt;- list(g11Std, g11SStd, g11SNorm, g11A11Std, g11A11SStd, g11A11SNorm, g11A22Std, g11A22SStd, g11A22SNorm)
  gBIC &lt;- data.frame(g11Std@fit$ics[2], g11SStd@fit$ics[2], g11SNorm@fit$ics[2], g11A11Std@fit$ics[2], g11A11SStd@fit$ics[2], g11A11SNorm@fit$ics[2], g11A22Std@fit$ics[2], g11A22SStd@fit$ics[2], g11A22SNorm@fit$ics[2])
  colnames(gBIC) &lt;- c(&quot;g11Std-BIC&quot;, &quot;g11SStd-BIC&quot;, &quot;g11SNorm-BIC&quot;, &quot;g11A11Std-BIC&quot;, &quot;g11A11SStd-BIC&quot;, &quot;g11A11SNorm-BIC&quot;, &quot;g11A22Std-BIC&quot;, &quot;g11A22SStd-BIC&quot;, &quot;g11A22SNorm-BIC&quot;)
  
  minBIC &lt;- order(gBIC,decreasing=FALSE)[1]
  
  return (list(gBIC, colnames(gBIC)[minBIC], gModel[[minBIC]]))
}

visualizeGarchModels &lt;- function (p, m1, m2, cnames)
{
  # Visualize two garch models in overlapping plots
  #
  # Args:
  #   p: matrix of instrument price data, including valid colnames
  #   m1: first GARCH model to visualize
  #   m2: second GARCH model to visualize
  #   cnames: list of column names
  #
  # Returns: none
  
  t &lt;- index(p)[2:nrow(p)]
  
  plot(xts(m1[3][[1]]@h.t, order.by=t), main=&quot;GARCH Conditional Volatility&quot;, type='l', ylab=&quot;Volatility&quot;, ylim=c(min(crmModel[3][[1]]@h.t, qqqModel[3][[1]]@h.t),max(crmModel[3][[1]]@h.t, qqqModel[3][[1]]@h.t)))
  lines(xts(m2[3][[1]]@h.t, order.by=t), col=colors[2])
  legend(&quot;topleft&quot;,legend=c(cnames[1],cnames[2]), fill=colors, cex=0.5)
  
  plot(xts(m1[3][[1]]@residuals, order.by=t), main=&quot;GARCH Residuals&quot;, type='p', ylab=&quot;Residuals&quot;)
  points(xts(m2[3][[1]]@residuals, order.by=t), col=colors[2])
  legend(&quot;topleft&quot;,legend=c(cnames[1],cnames[2]), fill=colors, cex=0.5)
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/8309/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/8309/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/8309/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/8309/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/8309/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/8309/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/8309/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/8309/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/8309/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/8309/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/8309/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/8309/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/8309/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/8309/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8309&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/10/30/proxy-cross-hedge-conditional-model-selection/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-garch-vol.png?w=600&#38;h=610" medium="image" />

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-garch-vol-copula.png?w=600&#38;h=610" medium="image" />

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-garch-residuals.png?w=600&#38;h=610" medium="image" />

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-garch-error-dist.png?w=600&#38;h=610" medium="image" />
	</item>
		<item>
		<title>Proxy Hedging and Dependence</title>
		<link>http://quantivity.wordpress.com/2011/10/26/proxy-cross-hedge-correlation-dependence/</link>
		<comments>http://quantivity.wordpress.com/2011/10/26/proxy-cross-hedge-correlation-dependence/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 06:36:58 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=8126</guid>
		<description><![CDATA[When asked to summarize their approach to proxy / cross hedging, senior folks from numerous big banks reduced it to correlation: hedge using an instrument whose correlation is close to -1. This perspective matches the popular practitioner literature, such as recently published text Hedging Market Exposures (Bychuk and Haughey, 2011). Moreover, this perspective is at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8126&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When asked to summarize their approach to <a href="http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging">proxy / cross hedging</a>, senior folks from numerous big banks reduced it to correlation: hedge using an instrument whose correlation is close to -1. This perspective matches the popular practitioner literature, such as recently published text <cite><a href="http://books.google.com/books?id=CpSv76NCmJcC">Hedging Market Exposures</a></cite> (Bychuk and Haughey, 2011). Moreover, this perspective is at the heart of much of the research literature, going back to original definition of optimal hedge ratio <img src='http://s0.wp.com/latex.php?latex=%5Chat%7B%5Cbeta%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;hat{&#92;beta}' title='&#92;hat{&#92;beta}' class='latex' /> (<em>e.g.</em> <a href="http://books.google.com/books?id=sEmQZoHoJCcC">Hull</a>, p. 57):</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Chat%7B%5Cbeta%7D+%3D+%5Crho+%28+%5Cfrac%7B%5Csigma_u%7D%7B%5Csigma_h%7D+%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;hat{&#92;beta} = &#92;rho ( &#92;frac{&#92;sigma_u}{&#92;sigma_h} )' title='&#92;hat{&#92;beta} = &#92;rho ( &#92;frac{&#92;sigma_u}{&#92;sigma_h} )' class='latex' /></p>
<p>Yet, while indeed true, this wisdom is not terribly helpful in practice for hedging well-known equities, as described in previous posts&mdash;as no instrument exists with such high correlation. This motivated revisiting the role of dependence in hedging, uncovering what may perhaps be an interesting result: <em>multi-period asymptotically perfect hedges exist with <img src='http://s0.wp.com/latex.php?latex=%5Crho+%5Cll+-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;rho &#92;ll -1' title='&#92;rho &#92;ll -1' class='latex' /></em>.</p>
<p><span id="more-8126"></span></p>
<p>To derive this result, begin by asking a simple-sounding question: over what range of correlation between underlying and hedge can a perfect hedge conceivably be built? When evaluated for a <em>single period</em>, the answer is obviously a single value: <img src='http://s0.wp.com/latex.php?latex=%5Crho+%3D+-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;rho = -1' title='&#92;rho = -1' class='latex' />, as <img src='http://s0.wp.com/latex.php?latex=%5Cepsilon+%3E+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;epsilon &gt; 0' title='&#92;epsilon &gt; 0' class='latex' /> for any other correlation, given:</p>
<p>&nbsp;&nbsp;&nbsp;<img src='http://s0.wp.com/latex.php?latex=%5Crho+%5Cne+-1+%5Ciff+u+%5Cne+h&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;rho &#92;ne -1 &#92;iff u &#92;ne h' title='&#92;rho &#92;ne -1 &#92;iff u &#92;ne h' class='latex' />.</p>
<p>Yet, this question becomes more interesting when generalized to <em>multiple periods</em>. Specifically, consider the temporal series of proxy errors over multiple contiguous periods:</p>
<p>&nbsp;&nbsp;&nbsp; <img src='http://s0.wp.com/latex.php?latex=%5C%7B+%5Cepsilon_%7Bt_1%7D%2C+%5Cepsilon_%7Bt_2%7D%2C+%5Cdots%2C+%5Cepsilon_%7Bt_n%7D+%5C%7D+%3D+%5Cboldsymbol%7B%5Cepsilon%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;{ &#92;epsilon_{t_1}, &#92;epsilon_{t_2}, &#92;dots, &#92;epsilon_{t_n} &#92;} = &#92;boldsymbol{&#92;epsilon}' title='&#92;{ &#92;epsilon_{t_1}, &#92;epsilon_{t_2}, &#92;dots, &#92;epsilon_{t_n} &#92;} = &#92;boldsymbol{&#92;epsilon}' class='latex' /></p>
<p>Can intuition be built by modeling the temporal evolution of <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Cepsilon%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;epsilon}' title='&#92;boldsymbol{&#92;epsilon}' class='latex' /> directly, rather than describing the characteristics of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=h&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='h' title='h' class='latex' />? Consider modeling <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Cepsilon%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;epsilon}' title='&#92;boldsymbol{&#92;epsilon}' class='latex' /> using elementary trigonometry, say a familiar sin curve:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-sin1.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-sin1.png?w=600" alt="" title="proxy-correlation-sin"   class="aligncenter size-full wp-image-8230" /></a></p>
<p>This model is interesting, as it captures the two desirable properties for optimal proxy hedging:</p>
<ul>
<li><strong>Zero crossings</strong>: error crosses zero a positive number of times during its path (determined by <code>zerocross</code> parameter below), providing frequent opportunity to exit hedge with zero loss (<em>i.e.</em> <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Cepsilon%7D+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;epsilon} = 0' title='&#92;boldsymbol{&#92;epsilon} = 0' class='latex' />)</li>
<li><strong>Absolute bounds</strong>: error is bounded, above and below, to not exceed some maximum threshold</li>
</ul>
<p>These two properties should be familiar to readers who trade relative value strategies.</p>
<p>Given the above evolution of <img src='http://s0.wp.com/latex.php?latex=%5Cboldsymbol%7B%5Cepsilon%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;boldsymbol{&#92;epsilon}' title='&#92;boldsymbol{&#92;epsilon}' class='latex' /> over time, next question is asking what range of <img src='http://s0.wp.com/latex.php?latex=%5Crho&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;rho' title='&#92;rho' class='latex' /> is possible given arbitrary paths of <img src='http://s0.wp.com/latex.php?latex=h&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='h' title='h' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />. As always, a picture is worth a thousand words.</p>
<p>Define <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> to follow a stochastic process of length <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />, whose value is drawn from Gaussian (given <img src='http://s0.wp.com/latex.php?latex=%5Cmu&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mu' title='&#92;mu' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%5Csigma&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sigma' title='&#92;sigma' class='latex' /> parameters):</p>
<p><pre class="brush: r;">
u &lt;- rnorm(n, mu, sd);
</pre></p>
<p>In other words, the underlying follows a random process, which seems reasonable. Given that, <img src='http://s0.wp.com/latex.php?latex=h&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='h' title='h' class='latex' /> is determined as the arithmetic difference, given discrete differential of <img src='http://s0.wp.com/latex.php?latex=%5Cepsilon&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;epsilon' title='&#92;epsilon' class='latex' /> and desired number of zero crosses for sin curve:</p>
<p><pre class="brush: r;">
e &lt;- (sin(seq(-zerocross*pi, zerocross*pi, len = n)) + 0.01) / 10
de &lt;- diff(e)
h &lt;- de - u
</pre></p>
<p>The following plots illustrates one sample path of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />, with corresponding <img src='http://s0.wp.com/latex.php?latex=h&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='h' title='h' class='latex' />, over the multiple periods (parameters <code>n=200; zerocross=1; mu=0; sd=0.05</code>):</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-1-returns.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-1-returns.png?w=600&#038;h=610" alt="" title="proxy-correlation-1-returns" width="600" height="610" class="aligncenter size-full wp-image-8232" /></a></p>
<p>These returns look fairly normal, albeit obviously sampled from a distribution which has neither long tails nor memory.</p>
<p>Given underlying and hedge, the correlation density can be generated by sampling <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />: </p>
<p><pre class="brush: r;">
cor(h, u, method=&quot;kendall&quot;)
</pre></p>
<p>The following plots illustrate the simulated scatter and empirical density for <img src='http://s0.wp.com/latex.php?latex=%5Crho&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;rho' title='&#92;rho' class='latex' />, given 1000 iterations (parameters <code>n=200; zerocross=1; mu=0; sd=0.05</code>):</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-1-mc.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-1-mc.png?w=600&#038;h=610" alt="" title="proxy-correlation-1-mc" width="600" height="610" class="aligncenter size-full wp-image-8237" /></a></p>
<p>With a single zero cross, this model recovers the classic one-period optimal hedge result: <img src='http://s0.wp.com/latex.php?latex=%5Crho+%5Capprox+-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;rho &#92;approx -1' title='&#92;rho &#92;approx -1' class='latex' />. </p>
<p>Where this model becomes interesting is when number of zero crosses is increased above 1. Doing so diverges the model from classical single period, conceptually extending time over multiple periods. The following plots illustrate returns when zero cross is 10:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-10-returns.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-10-returns.png?w=600&#038;h=610" alt="" title="proxy-correlation-10-returns" width="600" height="610" class="aligncenter size-full wp-image-8239" /></a></p>
<p>Visual inspection of the cumulative returns plot makes clear something different is afoot. Clearly the underlying and hedge are not behaving as perfect inverses, when there are more zero crosses. There is something deeper at work. To illustrate further, consider the corresponding sampled correlation plots:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-10-mc.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-10-mc.png?w=600&#038;h=610" alt="" title="proxy-correlation-10-mc" width="600" height="610" class="aligncenter size-full wp-image-8240" /></a></p>
<p>Illustrating correlation diverging from -1, peaking near -0.73. Recall this is correlation of underlying and hedge, which is providing <em>asymptotic optimality</em> at a finite number of points in time. Is this an accident, or does it represent a more general principle at work? Consider the following return plots for proxy error with 50 zero crosses:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-50-returns.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-50-returns.png?w=600&#038;h=610" alt="" title="proxy-correlation-50-returns" width="600" height="610" class="aligncenter size-full wp-image-8242" /></a></p>
<p>Now the underlying and hedge look nothing like each other, except their broad directions are consistently inverted. Again, consider the corresponding correlation plots, which illustrate sampled correlation decreasing to density peak near -0.30.</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-50-mc.png"><img src="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-50-mc.png?w=600&#038;h=610" alt="" title="proxy-correlation-50-mc" width="600" height="610" class="aligncenter size-full wp-image-8243" /></a></p>
<p>This illustrates perhaps an interesting result demonstrating counterexample to the conventional wisdom of perfect negative correlation for proxy hedging, albeit only in theory.</p>
<hr />
R code to generate the above sampling and plots:</p>
<p><pre class="brush: r;">
proxyMultiPeriodCorrelation &lt;- function(i=100, zerocross=20, n=200, mu=0, 
                                        sd=0.05, doPlot=FALSE)
{
  # Monte carlo sampling for visualizing multi-period correlation dynamics.
  #
  # Args:
  #     i: number of sampling iterations
  #     zerocross: number of zero crosses for error
  #     n: number of iterations for error sin curve
  #     mu: mean of Gaussian samples for u
  #     sd: standard deviation of Gaussian samples for u
  #     doPlot: flag to indicate whether to plot returns
  #
  # Returns: vector of sampled correlations
  
  e &lt;- (sin(seq(-zerocross*pi, zerocross*pi, len = n)) + 0.01) / 10
  de &lt;- diff(e)
  
  cors &lt;- sapply(c(1:i), function(i){ 
    u &lt;- rnorm(length(de),mu,sd); 
    h &lt;- de - u;
    pair &lt;- u + h
    c &lt;- cor(h, u, method=&quot;kendall&quot;);
    
    if (doPlot)
    {
      oldpar &lt;- par(mfrow=c(2,1))
      plot(u, type='l', xlab=&quot;Time&quot;, ylab=&quot;Returns&quot;, main=&quot;Optimal Proxy Returns&quot;);
      lines(h, col=colors[2])
      legend(&quot;topleft&quot;,legend=c(&quot;Underlying&quot;, &quot;Hedge&quot;), fill=colors, cex=0.5)
    
      cumH &lt;- cumprod(1+h)-1
      cumU &lt;- cumprod(1+u)-1
        
      plot(cumU,ylim=c(min(cumH,cumU,e),max(cumH,cumU,e)), type='l', ylab=&quot;Cumulative Return&quot;, xlab=&quot;Time&quot;, main=&quot;Optimal Proxy Cumulative Returns&quot;)
      lines(cumH, col=colors[2])
      lines(e, col=colors[3]);
      legend(&quot;topleft&quot;,legend=c(&quot;Underlying&quot;, &quot;Hedge&quot;, &quot;Error&quot;), fill=colors, cex=0.5)
      par(oldpar)
    }
    
    return (c)
  })
  
  oldpar &lt;- par(mfrow=c(2,1))
  plot(cors, ylab=&quot;Correlation&quot;, main=&quot;Optimal Proxy Hedge Correlation Scatter&quot;)
  plot(density(cors), xlab=&quot;Correlation&quot;, main=&quot;Optimal Proxy Hedge Correlation Density&quot;)
  par(oldpar)
  
  return (cors)
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/8126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/8126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/8126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/8126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/8126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/8126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/8126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/8126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/8126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/8126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/8126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/8126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/8126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/8126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=8126&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/10/26/proxy-cross-hedge-correlation-dependence/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-sin1.png" medium="image">
			<media:title type="html">proxy-correlation-sin</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-1-returns.png" medium="image">
			<media:title type="html">proxy-correlation-1-returns</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-1-mc.png" medium="image">
			<media:title type="html">proxy-correlation-1-mc</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-10-returns.png" medium="image">
			<media:title type="html">proxy-correlation-10-returns</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-10-mc.png" medium="image">
			<media:title type="html">proxy-correlation-10-mc</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-50-returns.png" medium="image">
			<media:title type="html">proxy-correlation-50-returns</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/proxy-correlation-50-mc.png" medium="image">
			<media:title type="html">proxy-correlation-50-mc</media:title>
		</media:content>
	</item>
		<item>
		<title>Exploratory Hedge Analysis</title>
		<link>http://quantivity.wordpress.com/2011/10/22/exploratory-proxy-cross-hedge-analysis/</link>
		<comments>http://quantivity.wordpress.com/2011/10/22/exploratory-proxy-cross-hedge-analysis/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 08:38:36 +0000</pubDate>
		<dc:creator>quantivity</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quantivity.wordpress.com/?p=7402</guid>
		<description><![CDATA[Previous posts on empirical quantiles and copulas for proxy / cross hedge illustrate the potential insight from graphical visualization. This post continues the theme, illustrating exploratory data analysis for proxy hedging using classical statistical techniques. In a world awash with symbolic models, there is ample room for graphical exploratory analysis in finance&#8212;as the fine texture [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=7402&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Previous posts on empirical <a href="http://quantivity.wordpress.com/2011/10/03/empirical-quantiles-proxy-cross-hedging-selection">quantiles</a> and <a href="http://quantivity.wordpress.com/2011/10/10/empirical-copulas-and-proxy-cross-hedge-basis-risk/">copulas</a> for <a href="http://quantivity.wordpress.com/2011/10/02/proxy-cross-hedging">proxy / cross hedge</a> illustrate the potential insight from graphical visualization. This post continues the theme, illustrating <em>exploratory data analysis for proxy hedging</em> using classical statistical techniques.</p>
<p>In a world awash with symbolic models, there is ample room for graphical exploratory analysis in finance&mdash;as the fine texture of the real world differs from both mathematical formalisms and standard mental models. Indeed, alpha hides in the <em>divergence</em> between model and reality.</p>
<p><span id="more-7402"></span></p>
<p>Statistician <a href="http://en.wikipedia.org/wiki/John_Tukey">John Tukey</a> is one of the most well-known advocates of <a href="http://en.wikipedia.org/wiki/Exploratory_Data_Analysis">exploratory data analysis</a>, captured in his 1977 <a href="http://books.google.com/books?id=UT9dAAAAIAAJ&amp;q">book</a> of the same title. Tukey nicely captures the essence of exploratory analysis in the opening chapter of his book (p. 1):</p>
<blockquote><p>Exploratory data analysis is detective work&#8211;numerical detective work&#8211;or counting detective work&#8211;or graphical detective work.</p></blockquote>
<p>This post illustrates graphical exploratory analysis, using R, specifically for the proxy hedging of previous posts: well-known tech company and QQQ. Although focused on a particular stock, these analysis techniques are <em>applicable to other equities and higher frequencies</em>.</p>
<p>Begin with scatters for daily prices and returns sampled over the previous 5 years, overlaid with fitted OLS and dispersion ellipsoids:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/explore-proxy-scatters1.png"><img src="http://quantivity.files.wordpress.com/2011/10/explore-proxy-scatters1.png?w=600&#038;h=417" alt="" title="explore-proxy-scatters" width="600" height="417" class="aligncenter size-full wp-image-7870" /></a></p>
<p>Top left plot illustrates several distinct price regimes. Top right plot illustrates ample returns well outside the dispersion ellipsoids, consistent with previous posts. Bottom left plot illustrates returns split by sign, demonstrating divergence in fit between positive and non-negative returns. Bottom right plot illustrates divergence between returns under and over 0.5 standard deviations, whose fit is quite similar.</p>
<p>Next, lag scatters for CRM:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/explore-crm-return-lags.png"><img src="http://quantivity.files.wordpress.com/2011/10/explore-crm-return-lags.png?w=600&#038;h=610" alt="" title="explore-crm-return-lags" width="600" height="610" class="aligncenter size-full wp-image-7877" /></a></p>
<p>Illustrating moderately non-spherical returns in the tails at all lags, consistent with the quantiles discussed in previous post. QQQ exhibits similar non-spherical lag returns, although the shape is not consistent with CRM:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/explore-qqq-return-lags.png"><img src="http://quantivity.files.wordpress.com/2011/10/explore-qqq-return-lags.png?w=600&#038;h=610" alt="" title="explore-qqq-return-lags" width="600" height="610" class="aligncenter size-full wp-image-7876" /></a></p>
<p>To understand return dynamics in more depth, the following plots consider empirical density, absolute cross-correlation, difference ratios, and discrete rate of change:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/explore-proxy-returns1.png"><img src="http://quantivity.files.wordpress.com/2011/10/explore-proxy-returns1.png?w=600&#038;h=610" alt="Exploratory Proxy Returns" title="explore-proxy-returns" width="600" height="610" class="aligncenter size-full wp-image-8066" /></a></p>
<p>Top left plot is textbook-style illustration of comparative <em>excess kurtosis</em>, with CRM return tails going out to +/- 10%. Cross correlation in top right plot exemplifies both forward and backward linear dependence for absolute returns, consistent with previous post on autocopulas. Difference ratios in bottom left plot illustrate empirical beta ranges from 1 to <em>several hundred</em>, irrespective whether returns are measured daily, weekly, or monthly&mdash;<em>this corroborates difficulty of proxy hedging with linear instruments</em>. These ratios provide the first evidence that late-2010 was perhaps even more anomalous for this pair than 2008, which is quite remarkable. Finally, bottom right plot illustrating return ROC further juxtaposes the comparison, as the ROC of both CRM and QQQ was dramatically higher in 2008 than 2010.</p>
<p>Finally, visualize the <em>rolling</em> proxy variance ratio (not to be confused with the standard statistical variance ratio, explored below) and correlation over the sample period with different durations:</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/explore-proxy-rolling.png"><img src="http://quantivity.files.wordpress.com/2011/10/explore-proxy-rolling.png?w=600&#038;h=610" alt="Rolling Exploratory Proxy" title="explore-proxy-rolling" width="600" height="610" class="aligncenter size-full wp-image-8076" /></a></p>
<p>Perhaps most interesting is the top plot which exemplifies that variance ratios (VR) for all roll durations are maximized over the 12 months beginning in August 2010. Contrast those ratios with the <em>nearly flat VR, at all durations, during the financial crisis</em>. The bottom plot provides one dimension of insight into this comparative behavior, illustrating that proxy correlation behaved inversely during these two periods: correlation was maximized during the finance crisis and minimized during 2010/2011.</p>
<p>Another interesting effect illustrated by both plots is <em>temporal scaling behavior</em>: correlation exhibits <em>monotonic smoothing</em> as lag window increases (conceptually similar to low-pass filtering), as exemplified by correlation progressive decreasing with black (daily), red (bi-weekly), blue (monthly), and green (quarterly). In contrast, the roll variance ratio exhibits no such scaling (monotonic or not). For example, early 2007 exhibits 60-day VR <em>exceedingly</em> all period periods. Similarly, the monthly VR frequently exceeds the biweekly VR.</p>
<p>Finally, consider classic unstandardized variance ratios for both CRM (top plot) and QQQ (bottom plot), calculated using the <em>entire 5-year sample period</em>, which illustrates mean-reversion versus trending (due to <a href="http://press.princeton.edu/books/lo/chapt2.pdf">Lo and Mackinlay (1998)</a>):</p>
<p><a href="http://quantivity.files.wordpress.com/2011/10/explore-proxy-vr.png"><img src="http://quantivity.files.wordpress.com/2011/10/explore-proxy-vr.png?w=600&#038;h=610" alt="Exploratory Proxy Variance Ratios" title="explore-proxy-vr" width="600" height="610" class="aligncenter size-full wp-image-8103" /></a></p>
<p>Both exhibit similar qualitative behavior: strongly mean reverting for holding periods under 30 days, followed by weaker reverting for longer periods. Variance ratio analysis is worth further consideration, particularly more rich graphical techniques (<em>e.g.</em> <a href="http://www.ljmu.ac.uk/AFE/AFE_docs/VR_AND_REGR.PDF">Lindemann <em>et al.</em> (2004)</a>) and multivariate methods.</p>
<hr />
<p>R code to generate the preceding exploratory hedge analysis:</p>
<p><pre class="brush: r;">
require(&quot;tseries&quot;)
require(&quot;vrtest&quot;)
require(&quot;fSeries&quot;)

colors &lt;- c('black', 'red', 'blue', 'green', 'orange', 'purple', 'yellow', 'brown', 'pink', 'coral', 'cyan', 'darkgreen', 'darkred' ,'darkblue', 'darkgrey');

exploreProxyHedge &lt;- function(p, doMonthlyScatter=TRUE, freq=&quot;daily&quot;, doQuantilePlots=TRUE)
{
  # Plot various proxy hedge exploratory analysis.
  #
  # Args:
  #   p: matrix of instrument price data, including valid colnames
  #   doMonthlyScatter: flag indicating whether monthly scatter should
  #           be plotted
  #   freq: text string for frequency, used for graphing
  #   doQuantilePlots: flag indicating whether quantiles should be plotted
  #
  # Returns: None
  
  oldpar &lt;- par(mfrow=c(2,2))
  
  # discrete first differences (not logged)
  pROC &lt;- ROC(p, type=&quot;discrete&quot;, na.pad=FALSE)
  p1ROC &lt;- ROC(p[,1], type=&quot;discrete&quot;, na.pad=FALSE)
  p2ROC &lt;- ROC(p[,2], type=&quot;discrete&quot;, na.pad=FALSE)

  # scatter analysis
  plot(coredata(p[,2]), coredata(p[,1]), xlab=colnames(p)[2], ylab=colnames(p)[1], main=&quot;Prices&quot;)
  plm &lt;- lm(p[,1] ~ p[,2])
  abline(plm, col=colors[2], lty=2)
  mtext(text=paste(&quot;slope=&quot;,plm$coefficients[2]), side=3, cex=0.75, col=colors[2])
  
  plot(coredata(p1ROC), coredata(p2ROC), xlab=colnames(p)[2], ylab=colnames(p)[1], main=&quot;Returns&quot;)
  rlm &lt;- lm(p1ROC ~ p2ROC)
  abline(rlm, col=colors[2], lty=2)
    par(xpd=TRUE)
    d &lt;- dataEllipse(as.vector(coredata(p1ROC)),as.vector(coredata(p2ROC)),draw=FALSE)
    lines(d[[1]], col=colors[2], lty=3)
    lines(d[[2]], col=colors[3], lty=3)
    par(xpd=FALSE)
  mtext(text=paste(&quot;slope=&quot;,rlm$coefficients[2]), side=3, cex=0.75, col=colors[2])
  
  # split positive/negative scatter analysis
  plot(coredata(p2ROC[(coredata(p1ROC)&gt;0)]), coredata(p1ROC[(coredata(p1ROC)&gt;0)]), xlab=colnames(p)[2], ylab=paste(colnames(p)[1], &quot;(Positive Only)&quot;), xlim=c(min(p2ROC),max(p2ROC)), ylim=c(min(p1ROC),max(p1ROC)), main=&quot;Split Sign Return Scatter&quot;)
  prlm &lt;- lm(coredata(p1ROC[(coredata(p1ROC)&gt;0)]) ~ coredata(p2ROC[(coredata(p1ROC)&gt;0)]))
  abline(prlm, col=colors[1], lty=2)
  points(coredata(p2ROC[(coredata(p1ROC)&lt;0)]), coredata(p1ROC[(coredata(p1ROC)&lt;0)]), xlab=colnames(p)[2], ylab=paste(colnames(p)[1], &quot;(Negative Only)&quot;), col='red')
  nrlm &lt;- lm(coredata(p1ROC[(coredata(p1ROC)&lt;0)]) ~ coredata(p2ROC[(coredata(p1ROC)&lt;0)]))
  abline(nrlm, col=colors[2], lty=2)
  abline(rlm, col=colors[3], lty=2)
  legend(&quot;topleft&quot;,legend=c(&quot;Positive&quot;, &quot;Negative&quot;, &quot;Both&quot;), fill=colors, cex=0.5)
  
  # split magnitude scatter analysis
  magBound &lt;- sd(p1ROC) / 2
  plot(coredata(p2ROC[(abs(coredata(p2ROC))&gt;=magBound)]), coredata(p1ROC[(abs(coredata(p2ROC))&gt;=magBound)]), xlab=colnames(p)[2], ylab=paste(colnames(p)[1], &quot;(Positive Only)&quot;), xlim=c(min(p2ROC),max(p2ROC)), ylim=c(min(p1ROC),max(p1ROC)), main=&quot;Split Magnitude Return Scatter (0.5 SD)&quot;)
  orlm &lt;- lm(coredata(p1ROC[(abs(coredata(p2ROC))&gt;=magBound)]) ~ coredata(p2ROC[(abs(coredata(p2ROC))&gt;=magBound)]))
  abline(orlm, lty=2)
  points(coredata(p2ROC[(abs(coredata(p2ROC))&lt;magBound)]), coredata(p1ROC[(abs(coredata(p2ROC))&lt;magBound)]), xlab=colnames(p)[2], ylab=paste(colnames(p)[1], &quot;(Positive Only)&quot;), xlim=c(min(p2ROC),max(p2ROC)), ylim=c(min(p1ROC),max(p1ROC)), main=&quot;Split Magnitude Return Scatter&quot;, col=colors[2])
  irlm &lt;- lm(coredata(p1ROC[(abs(coredata(p2ROC))&lt;magBound)]) ~ coredata(p2ROC[(abs(coredata(p2ROC))&lt;magBound)]))
  abline(irlm, lty=2, col=colors[2])
  legend(&quot;topleft&quot;, legend=c(&quot;Outer&quot;, &quot;Inner (+/- 0.5 SD)&quot;), fill=colors, cex=0.5)

  # monthly scatter analysis
  if (doMonthlyScatter)
  {
    plot(coredata(xts(p)[&quot;2011-05&quot;][,2]), coredata(xts(p)[&quot;2011-05&quot;][,1]), ylim=c(min(p[,1]),max(p[,1])), xlim=c(min(p[,2]),max(p[,2])), col=colors[1], xlab=colnames(p)[2], ylab=colnames(p)[1], main=&quot;Prices by Month&quot;)
    points(coredata(xts(p)[&quot;2011-06&quot;][,2]), coredata(xts(p)[&quot;2011-06&quot;][,1]), col=colors[2])
    points(coredata(xts(p)[&quot;2011-07&quot;][,2]), coredata(xts(p)[&quot;2011-07&quot;][,1]), col=colors[3])
    points(coredata(xts(p)[&quot;2011-08&quot;][,2]), coredata(xts(p)[&quot;2011-08&quot;][,1]), col=colors[4])
    points(coredata(xts(p)[&quot;2011-09&quot;][,2]), coredata(xts(p)[&quot;2011-09&quot;][,1]), col=colors[5])
    points(coredata(xts(p)[&quot;2011-10&quot;][,2]), coredata(xts(p)[&quot;2011-10&quot;][,1]), col=colors[6])
    legend(&quot;topleft&quot;, legend=c(&quot;05&quot;, &quot;06&quot;, &quot;07&quot;, &quot;08&quot;, &quot;09&quot;, &quot;10&quot;), fill=colors, cex=0.5)
    abline(lm(coredata(xts(p)[&quot;2011-05&quot;][,1]) ~ coredata(xts(p)[&quot;2011-05&quot;][,2])), col=colors[1], lty=2)
    abline(lm(coredata(xts(p)[&quot;2011-06&quot;][,1]) ~ coredata(xts(p)[&quot;2011-06&quot;][,2])), col=colors[2], lty=2)
    abline(lm(coredata(xts(p)[&quot;2011-07&quot;][,1]) ~ coredata(xts(p)[&quot;2011-07&quot;][,2])), col=colors[3], lty=2)
    abline(lm(coredata(xts(p)[&quot;2011-08&quot;][,1]) ~ coredata(xts(p)[&quot;2011-08&quot;][,2])), col=colors[4], lty=2)
    abline(lm(coredata(xts(p)[&quot;2011-09&quot;][,1]) ~ coredata(xts(p)[&quot;2011-09&quot;][,2])), col=colors[5], lty=2)
  }
  
  # quantile plots
  if (doQuantilePlots)
  {
    qqplot(coredata(p2ROC), coredata(p1ROC), xlab=paste(colnames(p)[2], &quot;Returns Quantiles&quot;), ylab=paste(colnames(p)[1], &quot;Returns Quantiles&quot;), main=&quot;Empirical Returns QQ-Plot&quot;)
    abline(0,1,lty=2)
    grid(20)
    par(xpd=TRUE)
    d &lt;- dataEllipse(as.vector(coredata(p1ROC)),as.vector(coredata(p2ROC)),draw=FALSE)
    lines(d[[1]], col=colors[2], lty=3)
    lines(d[[2]], col=colors[3], lty=3)
    par(xpd=FALSE)
  }
  
  # Price lag dependence
  lag.plot(p1ROC, 9, do.lines=FALSE, main=paste(colnames(p)[1], &quot;Returns Lag Auto Dependence&quot;))
  
  lag.plot(p2ROC, 9, do.lines=FALSE, main=paste(colnames(p)[2], &quot;Returns Lag Auto Dependence&quot;))
  
  par(mfrow=c(2,2))
  
  # return distributions
  p1Density &lt;- density(p1ROC)
  p2Density &lt;- density(p2ROC)
  
  plot(p1Density, ylim=c(0, max(p1Density$y, p2Density$y)), main=&quot;Return Distribution With Median&quot;)
  lines(p2Density, col=colors[2])
  abline(v=median(p1ROC), lty=2)
  abline(v=median(p2ROC), col=colors[2], lty=2)
  legend(&quot;topleft&quot;, legend=colnames(p), fill=colors, cex=0.5)
  
  # cross correlation
  ccf(data.frame(abs(coredata(p1ROC))), data.frame(abs(coredata(p2ROC))), main=&quot;Absolute Return Cross Correlation&quot;)
  
  # diff ratio analysis (exclude periods with zero return QQQ)
  p1NoZeros &lt;- diff(p[(p[,2] != 0),])
  p5NoZeros &lt;- diff(p, lag=5)
  p5NoZeros &lt;- p5NoZeros[(p5NoZeros[,2] != 0),]
  p22NoZeros &lt;- diff(p, lag=22)
  p22NoZeros &lt;- p22NoZeros[(p22NoZeros[,2] != 0),]
  
  diff1Ratio &lt;- p1NoZeros[,1] / p1NoZeros[,2]
  diff5Ratio &lt;- p5NoZeros[,1] / p5NoZeros[,2]
  diff22Ratio &lt;- p22NoZeros[,1] / p22NoZeros[,2]
  
  plot(diff22Ratio, main=&quot;Difference Ratios&quot;, ylab=&quot;Diff Ratio&quot;, xlab=&quot;&quot;)
  lines(diff5Ratio, col=colors[2])
  lines(diff1Ratio, col=colors[3])            
  legend(&quot;topright&quot;, legend=c(&quot;lag-22&quot;, &quot;lag-5&quot;, &quot;lag-1&quot;), fill=colors, cex=0.5)

  # ROC analysis
  plot(xts(p1ROC), ylab=&quot;ROC&quot;, xlab=&quot;&quot;, main=&quot;Return Rate of Change&quot;)
  lines(xts(p2ROC), col=colors[2])
  legend(&quot;topleft&quot;, legend=colnames(p), fill=colors, cex=0.5)

  # variance ratio analysis
  vratio &lt;- sd(p[,1]) / sd(p[,2])
  cat(paste(&quot;variance ratio:&quot;, round(vratio,2)),&quot;\n&quot;)
  
  vRatio5 &lt;- rollingVarianceRatio(p,5)
  vRatio10 &lt;- rollingVarianceRatio(p,10)
  
  np &lt;- nrow(p)
  vRatio22 &lt;- c()
  vRatio60 &lt;- c()
  if (np &gt; 22)
  {
    vRatio22 &lt;- rollingVarianceRatio(p,22)
    if (np &gt; 60)
    {
      vRatio60 &lt;- rollingVarianceRatio(p,60)
    }
  }
  
  par(mfrow=c(2,1))
  plot(vRatio5, type='l', xlab=&quot;&quot;, ylab=&quot;VR&quot;, main=&quot;Rolling Variance Ratio&quot;, ylim=c(min(vRatio5, vRatio10,vRatio22,vRatio60), max(vRatio5, vRatio10,vRatio22,vRatio60)))
  lines(vRatio10, col=colors[2])
  
  if (np &gt; 22)
  {
    lines(vRatio22, col=colors[3])
    if(np &gt; 60)
    {
      lines(vRatio60, col=colors[4])
    }
  }
  legend(&quot;topleft&quot;, legend=c(&quot;5&quot;, &quot;10&quot;, &quot;22&quot;, &quot;60&quot;), fill=colors, cex=0.5)

  
  # correlation analysis
  vCorr5 &lt;- rollingCorrelation(pROC, 5)
  vCorr10 &lt;- rollingCorrelation(pROC, 10)
  
  vCorr22 &lt;- c()
  vCorr60 &lt;- c()
  if (np &gt; 22)
  {
    vCorr22 &lt;- rollingCorrelation(pROC, 22)
    if (np &gt; 60)
    {
      vCorr60 &lt;- rollingCorrelation(pROC, 60)
    }
  }
  
  plot(vCorr5, type='l', xlab=&quot;&quot;, ylab=&quot;Correlation&quot;, main=&quot;Rolling Correlation&quot;, ylim=c(min(vCorr5, vCorr10,vCorr22,vCorr60), max(vCorr5, vCorr10,vCorr22,vCorr60)))
  lines(vCorr10, col=colors[2])
  
  if (np &gt; 22)
  {
    lines(vCorr22, col=colors[3])
    if (np &gt; 60)
    {
      lines(vCorr60, col=colors[4])
    }
  }
  legend(&quot;topleft&quot;, legend=c(&quot;5&quot;, &quot;10&quot;, &quot;22&quot;, &quot;60&quot;), fill=colors, cex=0.5)

  # classic variance ratios (unstandardized)
  VR.plot(p1ROC,60)
  VR.plot(p2ROC,60)
      
  par(oldpar)
}

rollingVarianceRatio &lt;- function(p, winLen)
{
  # Calculate rolling variance ratio with a given window length
  #
  # Args:
  #   p: matrix of instrument price data, including valid colnames
  #   winLen: length of window over which to calculate variance
  #
  # Returns: xts of rolling variance ratio
  
  return (xts(sapply(c(1:(nrow(p)-winLen)), function(i) { sd(p[i:(i+winLen),1]) / sd(p[i:(i+winLen),2]) }), order.by=index(p[((winLen+1):nrow(p)),])))
}
    
rollingCorrelation &lt;- function(p, winLen)
{
  # Calculate rolling correlation with a given window length
  #
  # Args:
  #   p: matrix of instrument price data, including valid colnames
  #   winLen: length of window over which to calculate correlation
  #
  # Returns: xts of rolling correlation

  return (xts(sapply(c(1:(nrow(p)-winLen)), function(i) { cor(p[i:(i+winLen)], method=&quot;kendall&quot;)[2,1] }), order.by=index(p[((winLen+1):nrow(p)),])))
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/quantivity.wordpress.com/7402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/quantivity.wordpress.com/7402/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/quantivity.wordpress.com/7402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/quantivity.wordpress.com/7402/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/quantivity.wordpress.com/7402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/quantivity.wordpress.com/7402/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/quantivity.wordpress.com/7402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/quantivity.wordpress.com/7402/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/quantivity.wordpress.com/7402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/quantivity.wordpress.com/7402/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/quantivity.wordpress.com/7402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/quantivity.wordpress.com/7402/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/quantivity.wordpress.com/7402/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/quantivity.wordpress.com/7402/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=quantivity.wordpress.com&amp;blog=8547598&amp;post=7402&amp;subd=quantivity&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://quantivity.wordpress.com/2011/10/22/exploratory-proxy-cross-hedge-analysis/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7f67f1b2910b55a3f40a983ffa830357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">quantivity</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/explore-proxy-scatters1.png" medium="image">
			<media:title type="html">explore-proxy-scatters</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/explore-crm-return-lags.png" medium="image">
			<media:title type="html">explore-crm-return-lags</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/explore-qqq-return-lags.png" medium="image">
			<media:title type="html">explore-qqq-return-lags</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/explore-proxy-returns1.png" medium="image">
			<media:title type="html">explore-proxy-returns</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/explore-proxy-rolling.png" medium="image">
			<media:title type="html">explore-proxy-rolling</media:title>
		</media:content>

		<media:content url="http://quantivity.files.wordpress.com/2011/10/explore-proxy-vr.png" medium="image">
			<media:title type="html">explore-proxy-vr</media:title>
		</media:content>
	</item>
	</channel>
</rss>
