<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I explicitly wanted to combine both at the same time, that was what I read in the study and what I was so far not able to code myself. But I do not know, whether the authors used R or some other software, so it might very well be possible that this cannot be implemented simultaneously with R/PortfolioAnalytics. I will continue to try it, or just use the risk aversion coefficient to distinguish between investor types. </div>

<div> </div>

<div>Nevertheless, I want to thank you again!<br/>
Jarno</div>

<div>
<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Donnerstag, 03. Februar 2022 um 15:59 Uhr<br/>
<b>Von:</b> "Brian G. Peterson" <brian@braverock.com><br/>
<b>An:</b> "Jarno Bergmeier" <jarno.bergmeier@web.de><br/>
<b>Cc:</b> r-sig-finance@r-project.org<br/>
<b>Betreff:</b> Re: Aw: Re: [R-SIG-Finance] PortfolioAnalytics: "Upper volatility bound"-constraint</div>

<div name="quoted-content">
<div>I think you might want:<br/>
<br/>
<font face="Calibri, sans-serif"><span style="font-size: 11.0pt;">port <- add.objective(port, type = "risk", name = "StdDev",  max = 0.0225)<br/>
<br/>
I'm not sure that you'll be able to combine risk_aversion and a max bound.</span></font></div>

<div> </div>

<div><font face="Calibri, sans-serif"><span style="font-size: 11.0pt;">Brian</span></font></div>

<div> </div>

<div>
<pre><span>--
</span></pre>

<div><span>Brian G. Peterson</span></div>

<div><span>ph: +1.773.459.4973</span></div>

<div><span>im: bgpbraverock</span></div>
</div>

<div> </div>

<div>On Thu, 2022-02-03 at 15:33 +0100, Jarno Bergmeier wrote:</div>

<blockquote style="margin: 0 0 0 0.8ex;border-left: 2.0px rgb(114,159,207) solid;padding-left: 1.0ex;">
<div style="font-family: Verdana;font-size: 12.0px;">
<div><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">Hello Brian,</span></span></span></div>

<div>
<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">thank you so much for your response and for offering me to follow up on it. Setting an upper limit on the risk objective function is exactly what I want to do, you’re right. Basically, I would like to implement something like the “max_prisk”-argument from the risk budget constraint, but for the portfolio variance in the risk objective function. </span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">I tried to implement it, so that I could use it like this e.g., in the portfolio specification:</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;"><span style="color: black;">port <- add.objective(port, type = "risk", name = "var", risk_aversion = 2, max_portfvar = 0.0225)</span></span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;"><span style="color: black;">But so far I was not able to come up with a function like that, that I could still use to maximize quadratic utility and supply with a custom moment function in the optimize.portfolio/optimize.portfolio.rebalancing function. </span></span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;"><span style="color: black;">I would therefore be extremely appreciative if you would be able to provide me with a worked example.</span></span></span></span></p>

<p style="margin-bottom: 11.0px;"> </p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;"><span style="color: black;">Kind regards,</span></span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;"><span style="color: black;">Jarno</span></span></span></span></p>

<div> 
<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Mittwoch, 02. Februar 2022 um 16:57 Uhr<br/>
<b>Von:</b> "Brian G. Peterson" <brian@braverock.com><br/>
<b>An:</b> "Jarno Bergmeier" <jarno.bergmeier@web.de>, r-sig-finance@r-project.org<br/>
<b>Betreff:</b> Re: [R-SIG-Finance] PortfolioAnalytics: "Upper volatility bound"-constraint</div>

<div>
<div>You are correct that adding this type of constraint would break most convex solvers.</div>

<div> </div>

<div>You can do this today with any of the global solvers by setting an upper limit on the risk objective function.</div>

<div> </div>

<div>I believe that you could do this with a conical solver constraint as well.  You could access some conical solvers today via ROI in PortfolioAnalytics, and we hope to add explicit conical solver support via CVXR this summer in a Google Summer of Code project.  so maybe look into using ROI as well for now.</div>

<div> </div>

<div>Hopefully this helps.  Please follow up if you need a worked example and I'll try to find some time to put one together.</div>

<div> </div>

<div>Regards,</div>

<div> </div>

<div>Brian</div>

<div> </div>

<div>
<pre><span>--
</span></pre>

<div><span>Brian G. Peterson</span></div>

<div><span>ph: +1.773.459.4973</span></div>

<div><span>im: bgpbraverock</span></div>
</div>

<div> </div>

<div>On Wed, 2022-02-02 at 16:48 +0100, Jarno Bergmeier wrote:</div>

<blockquote style="margin: 0 0 0 0.8ex;border-left: 2.0px rgb(114,159,207) solid;padding-left: 1.0ex;">
<div style="font-family: Verdana;font-size: 12.0px;">
<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">Hello everyone,</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">I wanted to ask my first-ever question via R-SIG-Finance, with regard to portfolio constraints and the “PortfolioAnalytics”-package in R. </span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">When distinguishing between certain types of investors, the empirical literature often employs certain values for the risk aversion coefficient. I now read a study that additionally makes use of upper volatility bounds (“less than or equal to…”) and was asking myself whether it would be possible to implement something like that for out-of-sample portfolio optimization with PortfolioAnalytics. </span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">So, a code similar to this: </span></span></span></p>

<p style="margin-bottom: 11.0px;"> </p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">port <- portfolio.spec(assets = colnames(returns_monthly))</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">port <- add.constraint(port, "long_only")</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">port <- add.constraint(port, "weight_sum", min_weight = 0.99, max_weight = 1.01)</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">port <- add.objective(port, type = "risk", name = "var", risk_aversion = 2)</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">port <- add.objective(port, type = "return", name = "mean")</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">opt <- optimize.portfolio.rebalancing(R = returns_monthly, portfolio = port, optimize_method = "ROI", rebalance_on = "months", training_period = 60, rolling_window = 60)</span></span></span></p>

<p style="margin-bottom: 11.0px;"> </p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">that also includes another constraint, which gives an upper volatility bound for the portfolio? </span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">I recently read a dissertation, that stated that such a constraint would be a convex one, which could not be expressed linearly, and therefore not solvable for many packages/solvers.</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">Therefore, I wanted to ask if anyone here might have already implemented an upper volatility/variance constraint with PortfolioAnalytics or knows, whether it would be possible to successfully do this with the package?</span></span></span></p>

<p style="margin-bottom: 11.0px;"> </p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">Kind regards</span></span></span></p>

<p style="margin-bottom: 11.0px;"><span style="font-size: 11.0pt;"><span style="line-height: 107.0%;"><span style="font-family: Calibri , sans-serif;">Jarno</span></span></span></p>

<p style="margin-bottom: 11.0px;"> </p>
</div>

<div>_______________________________________________</div>

<div><a href="mailto:R-SIG-Finance@r-project.org" onclick="parent.window.location.href='mailto:R-SIG-Finance@r-project.org'; return false;" target="_blank">R-SIG-Finance@r-project.org</a> mailing list</div>

<div><a href="https://stat.ethz.ch/mailman/listinfo/r-sig-finance" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-finance</a></div>

<div>-- Subscriber-posting only. If you want to post, subscribe first.</div>

<div>-- Also note that this is not the r-help list where general R questions should go.</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div></div></body></html>