<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>-----Original Message-----<br>From: gsoc-porta-bounces@lists.r-forge.r-project.org [mailto:gsoc-porta-bounces@lists.r-forge.r-project.org] On Behalf Of Brian G. Peterson<br>Sent: Monday, July 08, 2013 10:54 AM<br>To: gsoc-porta@r-forge.wu-wien.ac.at<br>Subject: Re: [GSoC-PortA] mapping function</p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>On 07/08/2013 12:51 PM, Doug Martin wrote:<o:p></o:p></p><p class=MsoPlainText>> Brian,<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Thanks for your helpful comments below.  It is fortunate that we will <o:p></o:p></p><p class=MsoPlainText>> be meeting in a couple of weeks, and can discuss in more detail then.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Meanwhile, I am going to concentrate on the "standard" stuff that is <o:p></o:p></p><p class=MsoPlainText>> needed for the first few chapters of the 2nd edition.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>It would be helpful to have a list, especially of anything that differs from the first few chapters of the first edition.<o:p></o:p></p><p class=MsoPlainText><b><i>[Doug] The first few chapters will be quite different.  By Wed. I  will send a TOC with overview comments. </i></b><o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>> P.S. When do you head to Alaska?<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I fly to seattle on Saturday, and Will be essentially out of contact, except for occasional moments in a wifi coffee shop, from Sun-Sun.  I arrive back in Seattle Sunday the 21st in the AM.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Regards,<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Brian<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>> -----Original Message-----<o:p></o:p></p><p class=MsoPlainText>> From: <a href="mailto:gsoc-porta-bounces@lists.r-forge.r-project.org"><span style='color:windowtext;text-decoration:none'>gsoc-porta-bounces@lists.r-forge.r-project.org</span></a><o:p></o:p></p><p class=MsoPlainText>> [<a href="mailto:gsoc-porta-bounces@lists.r-forge.r-project.org"><span style='color:windowtext;text-decoration:none'>mailto:gsoc-porta-bounces@lists.r-forge.r-project.org</span></a>] On Behalf Of <o:p></o:p></p><p class=MsoPlainText>> Brian G. Peterson<o:p></o:p></p><p class=MsoPlainText>> Sent: Monday, July 08, 2013 5:00 AM<o:p></o:p></p><p class=MsoPlainText>> To: <a href="mailto:gsoc-porta@r-forge.wu-wien.ac.at"><span style='color:windowtext;text-decoration:none'>gsoc-porta@r-forge.wu-wien.ac.at</span></a><o:p></o:p></p><p class=MsoPlainText>> Subject: Re: [GSoC-PortA] mapping function<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> On 07/06/2013 03:27 PM, Ross Bennett wrote:<o:p></o:p></p><p class=MsoPlainText>>> I'm sure Brian will provide more detail, but hopefully this will <o:p></o:p></p><p class=MsoPlainText>>> provide some initial clarification about random portfolios and the <o:p></o:p></p><p class=MsoPlainText>>> logic I am using in rp_transform().<o:p></o:p></p><p class=MsoPlainText>>><o:p> </o:p></p><p class=MsoPlainText>>> The random portfolio weights are being generated with a user <o:p></o:p></p><p class=MsoPlainText>>> specified leverage constraint, min_sum and max_sum. One could <o:p></o:p></p><p class=MsoPlainText>>> generate a dollar neutral portfolio by specifying min_sum=-0.01 and <o:p></o:p></p><p class=MsoPlainText>>> max_sum=1.01 or a leveraged portfolio with min_sum=1.49 and <o:p></o:p></p><p class=MsoPlainText>>> max_sum=1.51. I think this gives more flexibility than the method proposed by Shaw.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>>> I need to spend some more time understanding the Shaw (2011) paper, <o:p></o:p></p><p class=MsoPlainText>>> but it is unclear to me if Shaw's method will work if we want to <o:p></o:p></p><p class=MsoPlainText>>> specify constraints such as min=c(0.05, 0.12, 0.15, 0.05, 0.08) and <o:p></o:p></p><p class=MsoPlainText>>> max=c(0.85, 0.92, 0.73, 0.75, 0.82) or if it only works for box <o:p></o:p></p><p class=MsoPlainText>>> constraints where all the values of min and max are equal.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Shaw's approach is quite interesting, but I think it is also rather <o:p></o:p></p><p class=MsoPlainText>> limited in the types of constraints he examines.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Also, the 'reject everything that doesn't meet the constraints' <o:p></o:p></p><p class=MsoPlainText>> approach isn't practical, in my opinion.  Perhaps in C/C++ code, but <o:p></o:p></p><p class=MsoPlainText>> even then, as the number of assets increases (all his examples are toy <o:p></o:p></p><p class=MsoPlainText>> ones), the number of non-conforming portfolios will also increase.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Doug asked elsewhere on this thread for a concise description of how <o:p></o:p></p><p class=MsoPlainText>> the random portfolios code worked before Ross started improving things <o:p></o:p></p><p class=MsoPlainText>> (and all his changes looks like an improvement to me so far).<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> ___________________________________________________________________<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> So, the original algorithm, developed by trial and error from my notes <o:p></o:p></p><p class=MsoPlainText>> of a private conversation with Pat:<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> - generate a uniform random draw satisfying box constraints<o:p></o:p></p><p class=MsoPlainText>>     for all assets<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> - check to see if it is feasible (leverage constraints)<o:p></o:p></p><p class=MsoPlainText>>     + assuming it is not feasible,<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>>       randomly choose one weight from the weights vector<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>>       do another random draw for that weight that is larger or smaller <o:p></o:p></p><p class=MsoPlainText>> than the original<o:p></o:p></p><p class=MsoPlainText>>       draw to move the portfolio closer to the leverage constraint<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> ^<o:p></o:p></p><p class=MsoPlainText>> \--return to check to see if the portfolio is feasible<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> The Burns-style method 'walks' the portfolio closer to the edges of <o:p></o:p></p><p class=MsoPlainText>> the feasible space, one weight at a time.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> It's obviously a bit more complicated than this, but not much.  I <o:p></o:p></p><p class=MsoPlainText>> think it would be good to add a complete outline of the modified <o:p></o:p></p><p class=MsoPlainText>> algorithm to the documentation once we're happy with the approach.<o:p></o:p></p><p class=MsoPlainText>> ______________________________________________________________________<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Also elsewhere in this thread was a discussion of transforming the <o:p></o:p></p><p class=MsoPlainText>> entire vector to meet the leverage constraint.  While this 'works', it <o:p></o:p></p><p class=MsoPlainText>> has two drawbacks.  The first is that you may then violate the box <o:p></o:p></p><p class=MsoPlainText>> constraints.  The second is that you will be further from the edges of <o:p></o:p></p><p class=MsoPlainText>> the feasible space.  It may make sense to write a simple test script  <o:p></o:p></p><p class=MsoPlainText>> on<o:p></o:p></p><p class=MsoPlainText>> 50,100,200,500 assets that either transforms one asset at a time, or<o:p></o:p></p><p class=MsoPlainText>> *first* transforms the entire vector, and then transforms individual <o:p></o:p></p><p class=MsoPlainText>> assets<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Shaw's reliance on vertex combinations between pairs of assets doesn't <o:p></o:p></p><p class=MsoPlainText>> seem as useful to me as the number of assets increases, but perhaps <o:p></o:p></p><p class=MsoPlainText>> it's only because it has been 20 years since I stared at Mathematica code.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Overall, I'd like to implement the Shaw methods, but I'd like that to <o:p></o:p></p><p class=MsoPlainText>> be secondary to getting something that works which has the flexibility <o:p></o:p></p><p class=MsoPlainText>> to handle all the constraint types we've identified.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> So far, I think the progress on fn_map has been phenomenal.  For <o:p></o:p></p><p class=MsoPlainText>> Random Portfolios or DEoptim, this should give us what we need to have <o:p></o:p></p><p class=MsoPlainText>> feasible portfolios with any sort of layered constraints.  We'll need <o:p></o:p></p><p class=MsoPlainText>> to integrate the use of fn_map into constrained_objective for solvers <o:p></o:p></p><p class=MsoPlainText>> that don't specify all the constraint types.  I'll try to spend some <o:p></o:p></p><p class=MsoPlainText>> time outlining that later today.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> Regards,<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>>     - Brian<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> --<o:p></o:p></p><p class=MsoPlainText>> Brian G. Peterson<o:p></o:p></p><p class=MsoPlainText>> <a href="http://braverock.com/brian/"><span style='color:windowtext;text-decoration:none'>http://braverock.com/brian/</span></a><o:p></o:p></p><p class=MsoPlainText>> Ph: 773-459-4973<o:p></o:p></p><p class=MsoPlainText>> IM: bgpbraverock<o:p></o:p></p><p class=MsoPlainText>> _______________________________________________<o:p></o:p></p><p class=MsoPlainText>> GSoC-PortA mailing list<o:p></o:p></p><p class=MsoPlainText>> <a href="mailto:GSoC-PortA@lists.r-forge.r-project.org"><span style='color:windowtext;text-decoration:none'>GSoC-PortA@lists.r-forge.r-project.org</span></a><o:p></o:p></p><p class=MsoPlainText>> <a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta"><span style='color:windowtext;text-decoration:none'>http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta</span></a><o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> _______________________________________________<o:p></o:p></p><p class=MsoPlainText>> GSoC-PortA mailing list<o:p></o:p></p><p class=MsoPlainText>> <a href="mailto:GSoC-PortA@lists.r-forge.r-project.org"><span style='color:windowtext;text-decoration:none'>GSoC-PortA@lists.r-forge.r-project.org</span></a><o:p></o:p></p><p class=MsoPlainText>> <a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta"><span style='color:windowtext;text-decoration:none'>http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta</span></a><o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>--<o:p></o:p></p><p class=MsoPlainText>Brian G. Peterson<o:p></o:p></p><p class=MsoPlainText><a href="http://braverock.com/brian/"><span style='color:windowtext;text-decoration:none'>http://braverock.com/brian/</span></a><o:p></o:p></p><p class=MsoPlainText>Ph: 773-459-4973<o:p></o:p></p><p class=MsoPlainText>IM: bgpbraverock<o:p></o:p></p><p class=MsoPlainText>_______________________________________________<o:p></o:p></p><p class=MsoPlainText>GSoC-PortA mailing list<o:p></o:p></p><p class=MsoPlainText><a href="mailto:GSoC-PortA@lists.r-forge.r-project.org"><span style='color:windowtext;text-decoration:none'>GSoC-PortA@lists.r-forge.r-project.org</span></a><o:p></o:p></p><p class=MsoPlainText><a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta"><span style='color:windowtext;text-decoration:none'>http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta</span></a><o:p></o:p></p></div></body></html>