-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathslidy_presentation.html
797 lines (742 loc) · 46.4 KB
/
slidy_presentation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<meta name="author" content="Ross Bennett" />
<meta name="date" content="2014-05-16" />
<title>Complex Portfolio Optimization with PortfolioAnalytics</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style>
<link rel="stylesheet" type="text/css" media="screen, projection, print"
href="http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css" />
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
<script src="http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js"
charset="utf-8" type="text/javascript"></script>
</head>
<body>
<div class="slide titlepage">
<h1 class="title">Complex Portfolio Optimization with PortfolioAnalytics</h1>
<h1 class="subtitle">R/Finance 2014</h1>
<p class="author">
Ross Bennett
</p>
<p class="date">May 16, 2014</p>
</div>
<div id="overview" class="slide section level2">
<h1>Overview</h1>
<ul>
<li>Discuss Portfolio Optimization</li>
<li>Introduce PortfolioAnalytics</li>
<li>Demonstrate PortfolioAnalytics with Examples</li>
</ul>
<!---
Discuss Portfolio Optimization
- Some background and theory of portfolio theory
- challenges
Introduce PortfolioAnalytics
- What PortfolioAnalytics does and the problems it solves
Demonstrate PortfolioAnalytics with Examples
- Brief overview of the examples I will be giving
-->
</div>
<div id="modern-portfolio-theory" class="slide section level2">
<h1>Modern Portfolio Theory</h1>
<p>"Modern" Portfolio Theory (MPT) was introduced by Harry Markowitz in 1952.</p>
<p>In general, MPT states that an investor's objective is to maximize portfolio expected return for a given amount of risk.</p>
<p>General Objectives</p>
<ul>
<li>Maximize a measure of gain per unit measure of risk</li>
<li>Minimize a measure of risk</li>
</ul>
<p>How do we define risk? What about more complex objectives?</p>
<!---
Several approaches follow the Markowitz approach using mean return as a measure of gain and standard deviation of returns as a measure of risk.
-->
</div>
<div id="portfolio-optimization-objectives" class="slide section level2">
<h1>Portfolio Optimization Objectives</h1>
<ul>
<li>Minimize Risk
<ul>
<li>Volatility</li>
<li>Tail Loss (VaR, ES)</li>
<li>Other Downside Risk Measure</li>
</ul></li>
<li>Maximize Risk Adjusted Return
<ul>
<li>Sharpe Ratio, Modified Sharpe Ratio</li>
<li>Several Others</li>
</ul></li>
<li>Risk Budgets
<ul>
<li>Equal Component Contribution to Risk (i.e. Risk Parity)</li>
<li>Limits on Component Contribution</li>
</ul></li>
<li>Maximize a Utility Function
<ul>
<li>Quadratic, CRRA, CARA, etc.</li>
</ul></li>
</ul>
<!---
The challenge here is knowing what solver to use and the capabilities/limits of the chosen solver. Talk about pros/cons of closed-form solvers vs. global solvers and what objectives can be solved.
-->
</div>
<div id="portfolioanalytics-overview" class="slide section level2">
<h1>PortfolioAnalytics Overview</h1>
<p>PortfolioAnalytics is an R package designed to provide numerical solutions and visualizations for portfolio optimization problems with complex constraints and objectives.</p>
<ul>
<li>Support for multiple constraint and objective types</li>
<li>An objective function can be any valid R function</li>
<li>Modular constraints and objectives</li>
<li>Support for user defined moment functions</li>
<li>Visualizations</li>
<li>Solver agnostic</li>
<li>Support for parallel computing</li>
</ul>
<!---
The key points to make here are:
- Flexibility
- The multiple types and modularity of constraints and objectives allows us to add, remove, combine, etc. multiple constraint and objective types very easily.
- Define an objective as any valid R function
- Define a function to compute the moments (sample, robust, shrinkage, factor model, GARCH model, etc.)
- Estimation error is a significant concern with optimization. Having the ability to test different models with different parameters is critical.
- PortfolioAnalytics comes "pre-built" with several constraint types.
- Visualization helps to build intuition about the problem and understand the feasible space of portfolios
- Periodic rebalancing and analyzing out of sample performance will help refine objectives and constraints
-->
</div>
<div id="support-multiple-solvers" class="slide section level2">
<h1>Support Multiple Solvers</h1>
<p>Linear and Quadratic Programming Solvers</p>
<ul>
<li>R Optimization Infrastructure (ROI)
<ul>
<li>GLPK (Rglpk)</li>
<li>Symphony (Rsymphony)</li>
<li>Quadprog (quadprog)</li>
</ul></li>
</ul>
<p>Global (stochastic or continuous solvers)</p>
<ul>
<li>Random Portfolios</li>
<li>Differential Evolution (DEoptim)</li>
<li>Particle Swarm Optimization (pso)</li>
<li>Generalized Simulated Annealing (GenSA)</li>
</ul>
<!---
Brief explanation of each solver and what optimization problems (constraints and objectives) are supported
-->
</div>
<div id="random-portfolios" class="slide section level2">
<h1>Random Portfolios</h1>
<p>PortfolioAnalytics has three methods to generate random portfolios.</p>
<ol style="list-style-type: decimal">
<li>The <strong>sample</strong> method to generate random portfolios is based on an idea by Pat Burns.</li>
<li>The <strong>simplex</strong> method to generate random portfolios is based on a paper by W. T. Shaw.</li>
<li>The <strong>grid</strong> method to generate random portfolios is based on the <code>gridSearch</code> function in the NMOF package.</li>
</ol>
<!---
Random portfolios allow one to generate an arbitray number of portfolios based on given constraints. Will cover the edges as well as evenly cover the interior of the feasible space.
The sample method to generate random portfolios is based on an idea by Pat Burns. This is the most flexible method, but also the slowest, and can generate portfolios to satisfy leverage, box, group, and position limit constraints.
The simplex method to generate random portfolios is based on a paper by W. T. Shaw. The simplex method is useful to generate random portfolios with the full investment constraint, where the sum of the weights is equal to 1, and min box constraints. Values for min_sum and max_sum of the leverage constraint will be ignored, the sum of weights will equal 1. All other constraints such as the box constraint max, group and position limit constraints will be handled by elimination. If the constraints are very restrictive, this may result in very few feasible portfolios remaining. Another key point to note is that the solution may not be along the vertexes depending on the objective. For example, a risk budget objective will likely place the portfolio somewhere on the interior.
The grid method to generate random portfolios is based on the gridSearch function in NMOF package. The grid search method only satisfies the min and max box constraints. The min_sum and max_sum leverage constraint will likely be violated and the weights in the random portfolios should be normalized. Normalization may cause the box constraints to be violated and will be penalized in constrained_objective.
-->
</div>
<div id="comparison-of-random-portfolio-methods" class="slide section level2">
<h1>Comparison of Random Portfolio Methods</h1>
<div class="figure">
<img src="figures/rp_plot.png" />
</div>
<!---
This chart is a prime candidate for an interactive viz
-->
</div>
<div id="random-portfolios-simplex-method" class="slide section level2">
<h1>Random Portfolios: Simplex Method</h1>
<div class="figure">
<img src="figures/fev_plot.png" />
</div>
</div>
<div id="workflow" class="slide section level2">
<h1>Workflow</h1>
<div class="figure">
<img src="figures/workflow.png" />
</div>
<!---
Describe each function:
- portfolio.spec
- add.constraint
- add.objective
- optimize.portfolio and optimize.portfolio.rebalancing
Just give a general description of the functions to analyze results
-->
</div>
<div id="workflow-specify-portfolio" class="slide section level2">
<h1>Workflow: Specify Portfolio</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">args</span>(portfolio.spec)</code></pre>
<pre><code>## function (assets = NULL, category_labels = NULL, weight_seq = NULL,
## message = FALSE)
## NULL</code></pre>
</div>
<div id="workflow-add-constraints" class="slide section level2">
<h1>Workflow: Add Constraints</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">args</span>(add.constraint)</code></pre>
<pre><code>## function (portfolio, type, enabled = TRUE, message = FALSE, ...,
## indexnum = NULL)
## NULL</code></pre>
<p>Supported Constraint Types</p>
<ul>
<li>Sum of Weights</li>
<li>Box</li>
<li>Group</li>
<li>Turnover</li>
<li>Diversification</li>
<li>Position Limit</li>
<li>Return</li>
<li>Factor Exposure</li>
</ul>
</div>
<div id="workflow-add-objectives" class="slide section level2">
<h1>Workflow: Add Objectives</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">args</span>(add.objective)</code></pre>
<pre><code>## function (portfolio, constraints = NULL, type, name, arguments = NULL,
## enabled = TRUE, ..., indexnum = NULL)
## NULL</code></pre>
<p>Supported Objective types</p>
<ul>
<li>Return</li>
<li>Risk</li>
<li>Risk Budget</li>
<li>Weight Concentration</li>
</ul>
</div>
<div id="workflow-run-optimization" class="slide section level2">
<h1>Workflow: Run Optimization</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">args</span>(optimize.portfolio)</code></pre>
<pre><code>## function (R, portfolio = NULL, constraints = NULL, objectives = NULL,
## optimize_method = c("DEoptim", "random", "ROI", "pso", "GenSA"),
## search_size = 20000, trace = FALSE, ..., rp = NULL, momentFUN = "set.portfolio.moments",
## message = FALSE)
## NULL</code></pre>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">args</span>(optimize.portfolio.rebalancing)</code></pre>
<pre><code>## function (R, portfolio = NULL, constraints = NULL, objectives = NULL,
## optimize_method = c("DEoptim", "random", "ROI"), search_size = 20000,
## trace = FALSE, ..., rp = NULL, rebalance_on = NULL, training_period = NULL,
## trailing_periods = NULL)
## NULL</code></pre>
<p>Supported Optimization Methods</p>
<ul>
<li>ROI</li>
<li>random</li>
<li>DEoptim</li>
<li>pso</li>
<li>GenSA</li>
</ul>
</div>
<div id="workflow-analyze-results" class="slide section level2">
<h1>Workflow: Analyze Results</h1>
<p>*** =left</p>
<ul>
<li>plot</li>
<li>chart.Concentration</li>
<li>chart.EfficientFrontier</li>
<li>chart.RiskBudget</li>
<li>chart.RiskReward</li>
<li>chart.Weights</li>
</ul>
<p>***=right</p>
<ul>
<li>extractObjectiveMeasures</li>
<li>extractStats</li>
<li>extractWeights</li>
</ul>
<!---
I'd like to make this a two column slide if possible. Might have to try slidify.
-->
</div>
<div id="example-1-data-setup" class="slide section level2">
<h1>Example 1: Data Setup</h1>
<p>Here we will look at portfolio optimization in the context of stocks.</p>
<ul>
<li>Selection of large cap, mid cap, and small cap stocks from CRSP data</li>
<li>15 Large Cap</li>
<li>15 Mid Cap</li>
<li>5 Small Cap</li>
</ul>
<pre class="sourceCode r"><code class="sourceCode r">equity.data <-<span class="st"> </span><span class="kw">cbind</span>(largecap_weekly[,<span class="dv">1</span>:<span class="dv">15</span>],
midcap_weekly[,<span class="dv">1</span>:<span class="dv">15</span>],
smallcap_weekly[,<span class="dv">1</span>:<span class="dv">5</span>])</code></pre>
</div>
<div id="distribution-of-monthly-returns" class="slide section level2">
<h1>Distribution of Monthly Returns</h1>
<div class="figure">
<img src="figures/equity_box.png" />
</div>
</div>
<div id="minimum-variance-portfolio" class="slide section level2">
<h1>Minimum Variance Portfolio</h1>
<p>Here we consider a portfolio of stocks. Our objective is to minimize portfolio variance subect to full investment and box constraints. We will use out of sample backtesting to compare the sample covariance matrix estimate and a Ledoit-Wolf shinkage estimate.</p>
<p><span class="math">\[
\min_{w} w^{T} \Sigma w
\]</span></p>
<!---
Demonstrate a custom moments function to compare a sample covariance matrix estimate and a Ledoit-Wolf shrinkage covariance matrix estimate. An alternative is a robust (MCD, MVE, etc.) estimate, DCC GARCH model, factor model, etc.
-->
</div>
<div id="specify-portfolio" class="slide section level2">
<h1>Specify Portfolio</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Specify an initial portfolio</span>
stocks <-<span class="st"> </span><span class="kw">colnames</span>(equity.data)
portf.init <-<span class="st"> </span><span class="kw">portfolio.spec</span>(stocks)
<span class="co"># Add full investment constraint such that the weights sum to 1</span>
portf.minvar <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.init, <span class="dt">type =</span> <span class="st">"full_investment"</span>)
<span class="co"># Add box constraint such that no asset can have a weight of greater than</span>
<span class="co"># 45% or less than 1%</span>
portf.minvar <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.minvar, <span class="dt">type =</span> <span class="st">"box"</span>, <span class="dt">min =</span> <span class="fl">0.01</span>, <span class="dt">max =</span> <span class="fl">0.45</span>)
<span class="co"># Add objective to minimize portfolio variance</span>
portf.minvar <-<span class="st"> </span><span class="kw">add.objective</span>(portf.minvar, <span class="dt">type =</span> <span class="st">"risk"</span>, <span class="dt">name =</span> <span class="st">"var"</span>)</code></pre>
<!---
Talk a little about adding constraints and objectives
-->
</div>
<div id="ledoit-wolf-shrinkage-estimate" class="slide section level2">
<h1>Ledoit-Wolf Shrinkage Estimate</h1>
<p>The default function for <code>momentFUN</code> is <code>set.portfolio.moments</code>. We need to write our own function to estimate the covariance matrix.</p>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Function to estimate covariance matrix via Ledoit-Wolf shrinkage</span>
lw.sigma <-<span class="st"> </span>function(R, ...) {
out <-<span class="st"> </span><span class="kw">list</span>()
out$sigma <-<span class="st"> </span><span class="kw">lwShrink</span>(R)$cov
<span class="kw">return</span>(out)
}</code></pre>
</div>
<div id="run-optimization" class="slide section level2">
<h1>Run Optimization</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Backtest using sample covariance matrix estimate</span>
opt.minVarSample <-<span class="st"> </span><span class="kw">optimize.portfolio.rebalancing</span>(equity.data, portf.minvar,
<span class="dt">optimize_method=</span><span class="st">"ROI"</span>,
<span class="dt">rebalance_on=</span><span class="st">"quarters"</span>,
<span class="dt">training_period=</span><span class="dv">400</span>,
<span class="dt">trailing_periods=</span><span class="dv">250</span>)
<span class="co"># Backtest using Ledoit-Wolf shrinkage covariance matrix estimate</span>
opt.minVarLW <-<span class="st"> </span><span class="kw">optimize.portfolio.rebalancing</span>(equity.data, portf.minvar,
<span class="dt">optimize_method=</span><span class="st">"ROI"</span>,
<span class="dt">momentFUN=</span>lw.sigma,
<span class="dt">rebalance_on=</span><span class="st">"quarters"</span>,
<span class="dt">training_period=</span><span class="dv">400</span>,
<span class="dt">trailing_periods=</span><span class="dv">250</span>)</code></pre>
<!---
Explain each of the rebalancing parameters
-->
</div>
<div id="chart-weights-through-time" class="slide section level2">
<h1>Chart Weights Through Time</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">chart.Weights</span>(opt.minVarSample, <span class="dt">main =</span> <span class="st">"minVarSample Weights"</span>, <span class="dt">legend.loc =</span> <span class="ot">NULL</span>)
<span class="kw">chart.Weights</span>(opt.minVarLW, <span class="dt">main =</span> <span class="st">"minVarLW Weights"</span>, <span class="dt">legend.loc =</span> <span class="ot">NULL</span>)</code></pre>
<p><img src="figures/weights_minVarSample.png" /> <img src="figures/weights_minVarLW.png" /></p>
</div>
<div id="chart-weights-through-time-1" class="slide section level2">
<h1>Chart Weights Through Time</h1>
<pre><code>Error: could not find function "loadMethod"</code></pre>
</div>
<div id="returns" class="slide section level2">
<h1>Returns</h1>
<p>Compute the portfolio rebalancing returns and chart the performance.</p>
<pre class="sourceCode r"><code class="sourceCode r">ret.minVarSample <-<span class="st"> </span><span class="kw">summary</span>(opt.minVarSample)$portfolio_returns
ret.minVarRobust <-<span class="st"> </span><span class="kw">summary</span>(opt.minVarLW)$portfolio_returns
ret.minVar <-<span class="st"> </span><span class="kw">cbind</span>(ret.minVarSample, ret.minVarRobust)
<span class="kw">colnames</span>(ret.minVar) <-<span class="st"> </span><span class="kw">c</span>(<span class="st">"Sample"</span>, <span class="st">"LW"</span>)
<span class="kw">charts.PerformanceSummary</span>(ret.minVar)</code></pre>
<div class="figure">
<img src="figures/ret_minVar.png" />
</div>
</div>
<div id="example-2-market-neutral-portfolio" class="slide section level2">
<h1>Example 2: Market Neutral Portfolio</h1>
<p>Here we consider a portfolio of stocks. Our objective is to maximize portfolio return with a target of 0.0015 and minimize portfolio StdDev with a target of 0.02 subject to dollar neutral, beta, box, and position limit constraints. We will use the same data considered in Example 1.</p>
<!---
This involves combining several constraints. This is an MIQPQC problem that can't be solved by quadprog so we will use random portfolios.
-->
</div>
<div id="specify-portfolio-constraints" class="slide section level2">
<h1>Specify Portfolio: Constraints</h1>
<pre class="sourceCode r"><code class="sourceCode r">portf.init <-<span class="st"> </span><span class="kw">portfolio.spec</span>(stocks)
<span class="co"># Add constraint such that the portfolio weights sum to 0*</span>
portf.dn <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.init, <span class="dt">type=</span><span class="st">"weight_sum"</span>,
<span class="dt">min_sum=</span>-<span class="fl">0.01</span>, <span class="dt">max_sum=</span><span class="fl">0.01</span>)
<span class="co"># Add box constraint such that no asset can have a weight of greater than</span>
<span class="co"># 20% or less than -20%</span>
portf.dn <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.dn, <span class="dt">type=</span><span class="st">"box"</span>, <span class="dt">min=</span>-<span class="fl">0.2</span>, <span class="dt">max=</span><span class="fl">0.2</span>)
<span class="co"># Add constraint such that we have at most 20 positions</span>
portf.dn <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.dn, <span class="dt">type=</span><span class="st">"position_limit"</span>, <span class="dt">max_pos=</span><span class="dv">20</span>)
<span class="co"># Compute the betas of each stock</span>
betas <-<span class="st"> </span><span class="kw">t</span>(<span class="kw">CAPM.beta</span>(equity.data, market, Rf))
<span class="co"># Add constraint such that the portfolio beta is between -0.25 and 0.25</span>
portf.dn <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.dn, <span class="dt">type=</span><span class="st">"factor_exposure"</span>, <span class="dt">B=</span>betas,
<span class="dt">lower=</span>-<span class="fl">0.25</span>, <span class="dt">upper=</span><span class="fl">0.25</span>)</code></pre>
<!---
explain the constraints
-->
</div>
<div id="specify-portfolio-objectives" class="slide section level2">
<h1>Specify Portfolio: Objectives</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Add objective to maximize portfolio return with a target of 0.0015</span>
portf.dn.StdDev <-<span class="st"> </span><span class="kw">add.objective</span>(portf.dn, <span class="dt">type=</span><span class="st">"return"</span>, <span class="dt">name=</span><span class="st">"mean"</span>,
<span class="dt">target=</span><span class="fl">0.0015</span>)
<span class="co"># Add objective to minimize portfolio StdDev with a target of 0.02</span>
portf.dn.StdDev <-<span class="st"> </span><span class="kw">add.objective</span>(portf.dn.StdDev, <span class="dt">type=</span><span class="st">"risk"</span>, <span class="dt">name=</span><span class="st">"StdDev"</span>,
<span class="dt">target=</span><span class="fl">0.02</span>)</code></pre>
<!---
explain the objectives, specifically the target
-->
</div>
<div id="run-optimization-1" class="slide section level2">
<h1>Run Optimization</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Generate random portfolios</span>
rp <-<span class="st"> </span><span class="kw">random_portfolios</span>(portf.dn, <span class="dv">10000</span>, <span class="st">"sample"</span>, <span class="dt">eliminate=</span><span class="ot">TRUE</span>)
<span class="co"># Run the optimization</span>
opt.dn <-<span class="st"> </span><span class="kw">optimize.portfolio</span>(equity.data, portf.dn.StdDev,
<span class="dt">optimize_method=</span><span class="st">"random"</span>, <span class="dt">rp=</span>rp,
<span class="dt">trace=</span><span class="ot">TRUE</span>)</code></pre>
<!---
generate a set of random portfolios and then pass directly to optimize.portfolio. Could just specify optimize_method = "random" and will automatically generate for you.
-->
</div>
<div id="plot-results" class="slide section level2">
<h1>Plot Results</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">plot</span>(opt.dn, <span class="dt">main=</span><span class="st">"Dollar Neutral Portfolio"</span>, <span class="dt">risk.col=</span><span class="st">"StdDev"</span>, <span class="dt">neighbors=</span><span class="dv">10</span>)</code></pre>
<div class="figure">
<img src="figures/opt_dn.png" />
</div>
</div>
<div id="example-3-data-setup" class="slide section level2">
<h1>Example 3: Data Setup</h1>
<p>Here we will look at portfolio optimization in the context of portfolio of hedge funds.</p>
<ul>
<li>EDHEC-Risk Alternative Indexes</li>
<li>Monthly returns from 1/31/1997 to 1/31/2014
<ul>
<li>Convertible Arbitrage (CA)</li>
<li>Equity Market Neutral (EMN)</li>
<li>Fixed Income Arbitrage (FIA)</li>
<li>CTA Global (CTAG)</li>
<li>Emerging Markets (EM)</li>
<li>Global Macro (GM)</li>
</ul></li>
</ul>
<pre class="sourceCode r"><code class="sourceCode r">R <-<span class="st"> </span>edhec[,<span class="kw">c</span>(<span class="st">"Convertible.Arbitrage"</span>, <span class="st">"Equity.Market.Neutral"</span>,
<span class="st">"Fixed.Income.Arbitrage"</span>,
<span class="st">"CTA.Global"</span>, <span class="st">"Emerging.Markets"</span>, <span class="st">"Global.Macro"</span>)]
<span class="co"># Abreviate column names for convenience and plotting</span>
<span class="kw">colnames</span>(R) <-<span class="st"> </span><span class="kw">c</span>(<span class="st">"CA"</span>, <span class="st">"EMN"</span>, <span class="st">"FIA"</span>, <span class="st">"CTAG"</span>, <span class="st">"EM"</span>, <span class="st">"GM"</span>)</code></pre>
</div>
<div id="monthly-returns" class="slide section level2">
<h1>Monthly Returns</h1>
<p><img src="figures/relative_barvar.png" /> <img src="figures/directional_barvar.png" /></p>
</div>
<div id="distribution-of-monthly-returns-1" class="slide section level2">
<h1>Distribution of Monthly Returns</h1>
<div class="figure">
<img src="figures/edhec_box.png" />
</div>
</div>
<div id="minimum-expected-shortfall" class="slide section level2">
<h1>Minimum Expected Shortfall</h1>
<p>Consider an allocation to hedge funds using the EDHEC-Risk Alternative Index as a proxy. This will be an extended example starting with an objective to minimize modified expected shortfall, then add risk budget percent contribution limit, and finally add equal risk contribution limit.</p>
<ul>
<li>Minimize Expected Shortfall</li>
<li>Minimize Expected Shortfall with Risk Budget Limit</li>
<li>Minimize Expected Shortfall with Equal Risk Contribution</li>
</ul>
<p>Add risk budget objective to minimize concentration of percentage component contribution to risk. Concentration is defined as the Herfindahl Hirschman Index (HHI).</p>
<p><span class="math">\[ \sum_{i=1}^n x_i^2 \]</span></p>
<!---
comments
-->
</div>
<div id="specify-initial-portfolio" class="slide section level2">
<h1>Specify Initial Portfolio</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Specify an initial portfolio</span>
funds <-<span class="st"> </span><span class="kw">colnames</span>(R)
portf.init <-<span class="st"> </span><span class="kw">portfolio.spec</span>(funds)
<span class="co"># Add constraint such that the weights sum to 1*</span>
portf.init <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.init, <span class="dt">type=</span><span class="st">"weight_sum"</span>,
<span class="dt">min_sum=</span><span class="fl">0.99</span>, <span class="dt">max_sum=</span><span class="fl">1.01</span>)
<span class="co"># Add box constraint such that no asset can have a weight of greater than</span>
<span class="co"># 40% or less than 5%</span>
portf.init <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.init, <span class="dt">type=</span><span class="st">"box"</span>,
<span class="dt">min=</span><span class="fl">0.05</span>, <span class="dt">max=</span><span class="fl">0.4</span>)
<span class="co"># Add return objective with multiplier=0 such that the portfolio mean</span>
<span class="co"># return is calculated, but does not impact optimization</span>
portf.init <-<span class="st"> </span><span class="kw">add.objective</span>(portf.init, <span class="dt">type=</span><span class="st">"return"</span>,
<span class="dt">name=</span><span class="st">"mean"</span>, <span class="dt">multiplier=</span><span class="dv">0</span>)</code></pre>
<!---
basic comments about setting up an initial portfolio
-->
</div>
<div id="add-objectives" class="slide section level2">
<h1>Add Objectives</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Add objective to minimize expected shortfall</span>
portf.minES <-<span class="st"> </span><span class="kw">add.objective</span>(portf.init, <span class="dt">type=</span><span class="st">"risk"</span>, <span class="dt">name=</span><span class="st">"ES"</span>)
<span class="co"># Add objective to set upper bound on percentage component contribution</span>
portf.minES.RB <-<span class="st"> </span><span class="kw">add.objective</span>(portf.minES, <span class="dt">type=</span><span class="st">"risk_budget"</span>,
<span class="dt">name=</span><span class="st">"ES"</span>, <span class="dt">max_prisk=</span><span class="fl">0.3</span>)
<span class="co"># Relax box constraints</span>
portf.minES.RB$constraints[[<span class="dv">2</span>]]$max <-<span class="st"> </span><span class="kw">rep</span>(<span class="dv">1</span>,<span class="kw">ncol</span>(R))
<span class="co"># Add objective to minimize concentration of modified ES</span>
<span class="co"># component contribution</span>
portf.minES.EqRB <-<span class="st"> </span><span class="kw">add.objective</span>(portf.minES, <span class="dt">type=</span><span class="st">"risk_budget"</span>,
<span class="dt">name=</span><span class="st">"ES"</span>, <span class="dt">min_concentration=</span><span class="ot">TRUE</span>)
<span class="co"># Relax box constraints</span>
portf.minES.EqRB <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.minES.EqRB, <span class="dt">type=</span><span class="st">"box"</span>,
<span class="dt">min=</span><span class="fl">0.05</span>, <span class="dt">max=</span><span class="dv">1</span>, <span class="dt">indexnum=</span><span class="dv">2</span>)</code></pre>
<!---
Key points here are that we are creating 3 new portfolios by reusing the initial portfolio and we are relaxing the box constraints because we are no longer concerned with controlling weight concentration. We have limits on risk contribution.
-->
</div>
<div id="run-optimization-2" class="slide section level2">
<h1>Run Optimization</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Combine the 3 portfolios</span>
portf <-<span class="st"> </span><span class="kw">combine.portfolios</span>(<span class="kw">list</span>(<span class="dt">minES=</span>portf.minES,
<span class="dt">minES.RB=</span>portf.minES.RB,
<span class="dt">minES.EqRB=</span>portf.minES.EqRB))
<span class="co"># Run the optimization</span>
opt.minES <-<span class="st"> </span><span class="kw">optimize.portfolio</span>(R, portf, <span class="dt">optimize_method=</span><span class="st">"DEoptim"</span>,
<span class="dt">search_size=</span><span class="dv">5000</span>, <span class="dt">trace=</span><span class="ot">TRUE</span>, <span class="dt">traceDE=</span><span class="dv">0</span>)</code></pre>
<!---
explain how portf is a list of portfolios and passed to optimize.portfolio
-->
</div>
<div id="plot-in-risk-return-space" class="slide section level2">
<h1>Plot in Risk-Return Space</h1>
<div class="figure">
<img src="figures/opt_minES.png" />
</div>
</div>
<div id="chart-risk-budgets" class="slide section level2">
<h1>Chart Risk Budgets</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">chart.RiskBudget</span>(opt.minES[[<span class="dv">2</span>]], <span class="dt">main=</span><span class="st">"Risk Budget Limit"</span>,
<span class="dt">risk.type=</span><span class="st">"percentage"</span>, <span class="dt">neighbors=</span><span class="dv">10</span>)
<span class="kw">chart.RiskBudget</span>(opt.minES[[<span class="dv">3</span>]], <span class="dt">main=</span><span class="st">"Equal ES Component Contribution"</span>,
<span class="dt">risk.type=</span><span class="st">"percentage"</span>, <span class="dt">neighbors=</span><span class="dv">10</span>)</code></pre>
<p><img src="figures/rb_minES.png" /> <img src="figures/eqrb_minES.png" /></p>
</div>
<div id="set-rebalancing-parameters-and-run-backtest" class="slide section level2">
<h1>Set Rebalancing Parameters and Run Backtest</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Set rebalancing frequency</span>
rebal.freq <-<span class="st"> "quarters"</span>
<span class="co"># Training Period</span>
training <-<span class="st"> </span><span class="dv">120</span>
<span class="co"># Trailing Period</span>
trailing <-<span class="st"> </span><span class="dv">72</span>
bt.opt.minES <-<span class="st"> </span><span class="kw">optimize.portfolio.rebalancing</span>(R, portf,
<span class="dt">optimize_method=</span><span class="st">"DEoptim"</span>,
<span class="dt">rebalance_on=</span>rebal.freq,
<span class="dt">training_period=</span>training,
<span class="dt">trailing_periods=</span>trailing,
<span class="dt">search_size=</span><span class="dv">5000</span>,
<span class="dt">traceDE=</span><span class="dv">0</span>)</code></pre>
</div>
<div id="min-es-risk-contributions-and-weights-through-time" class="slide section level2">
<h1>Min ES Risk Contributions and Weights Through Time</h1>
<p><img src="figures/risk_minES.png" /> <img src="figures/weights_minES.png" /></p>
</div>
<div id="min-es-risk-budget-limit-risk-contributions-and-weights-through-time" class="slide section level2">
<h1>Min ES Risk Budget Limit Risk Contributions and Weights Through Time</h1>
<p><img src="figures/risk_minESRB.png" /> <img src="figures/weights_minESRB.png" /></p>
</div>
<div id="min-es-equal-component-contribution-risk-contributions-and-weights-through-time" class="slide section level2">
<h1>Min ES Equal Component Contribution Risk Contributions and Weights Through Time</h1>
<p><img src="figures/risk_minESEqRB.png" /> <img src="figures/weights_minESEqRB.png" /></p>
</div>
<div id="compute-returns-and-chart-performance" class="slide section level2">
<h1>Compute Returns and Chart Performance</h1>
<pre class="sourceCode r"><code class="sourceCode r">ret.bt.opt <-<span class="st"> </span><span class="kw">do.call</span>(cbind, <span class="kw">lapply</span>(bt.opt.minES,
function(x) <span class="kw">summary</span>(x)$portfolio_returns))
<span class="kw">colnames</span>(ret.bt.opt) <-<span class="st"> </span><span class="kw">c</span>(<span class="st">"min ES"</span>, <span class="st">"min ES RB"</span>, <span class="st">"min ES Eq RB"</span>)
<span class="kw">charts.PerformanceSummary</span>(ret.bt.opt)</code></pre>
<div class="figure">
<img src="figures/ret_minES.png" />
</div>
</div>
<div id="example-4-maximize-crra" class="slide section level2">
<h1>Example 4: Maximize CRRA</h1>
<p>Consider an allocation to hedge funds using the EDHEC-Risk Alternative Index as a proxy. Our objective to maximize the fourth order expansion of the Constant Relative Risk Aversion (CRRA) expected utility function as in the Boudt paper and Martinelli paper. We use the same data as Example 3.</p>
<p><span class="math">\[
EU_{\lambda}(w) = - \frac{\lambda}{2} m_{(2)}(w) +
\frac{\lambda (\lambda + 1)}{6} m_{(3)}(w) -
\frac{\lambda (\lambda + 1) (\lambda + 2)}{24} m_{(4)}(w)
\]</span></p>
<!---
Demonstrate a custom moment function and a custom objective function.
-->
</div>
<div id="define-a-function-to-compute-crra" class="slide section level2">
<h1>Define a function to compute CRRA</h1>
<pre class="sourceCode r"><code class="sourceCode r">CRRA <-<span class="st"> </span>function(R, weights, lambda, sigma, m3, m4){
weights <-<span class="st"> </span><span class="kw">matrix</span>(weights, <span class="dt">ncol=</span><span class="dv">1</span>)
M2.w <-<span class="st"> </span><span class="kw">t</span>(weights) %*%<span class="st"> </span>sigma %*%<span class="st"> </span>weights
M3.w <-<span class="st"> </span><span class="kw">t</span>(weights) %*%<span class="st"> </span>m3 %*%<span class="st"> </span>(weights %x%<span class="st"> </span>weights)
M4.w <-<span class="st"> </span><span class="kw">t</span>(weights) %*%<span class="st"> </span>m4 %*%<span class="st"> </span>(weights %x%<span class="st"> </span>weights %x%<span class="st"> </span>weights)
term1 <-<span class="st"> </span>(<span class="dv">1</span> /<span class="st"> </span><span class="dv">2</span>) *<span class="st"> </span>lambda *<span class="st"> </span>M2.w
term2 <-<span class="st"> </span>(<span class="dv">1</span> /<span class="st"> </span><span class="dv">6</span>) *<span class="st"> </span>lambda *<span class="st"> </span>(lambda +<span class="st"> </span><span class="dv">1</span>) *<span class="st"> </span>M3.w
term3 <-<span class="st"> </span>(<span class="dv">1</span> /<span class="st"> </span><span class="dv">24</span>) *<span class="st"> </span>lambda *<span class="st"> </span>(lambda +<span class="st"> </span><span class="dv">1</span>) *<span class="st"> </span>(lambda +<span class="st"> </span><span class="dv">2</span>) *<span class="st"> </span>M4.w
out <-<span class="st"> </span>-term1 +<span class="st"> </span>term2 -<span class="st"> </span>term3
out
}</code></pre>
<!---
The function arguments should have 'R' as the name of the returns and 'weights' as the name of the weights. 'R' and 'weights' are automatically matched, any other function arguments can be passed in through arguments in add.objective.
-->
</div>
<div id="specify-portfolio-1" class="slide section level2">
<h1>Specify Portfolio</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Specify portfolio</span>
portf.crra <-<span class="st"> </span><span class="kw">portfolio.spec</span>(funds)
<span class="co"># Add constraint such that the weights sum to 1</span>
portf.crra <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.crra, <span class="dt">type=</span><span class="st">"weight_sum"</span>,
<span class="dt">min_sum=</span><span class="fl">0.99</span>, <span class="dt">max_sum=</span><span class="fl">1.01</span>)
<span class="co"># Add box constraint such that no asset can have a weight of greater than</span>
<span class="co"># 40% or less than 5% </span>
portf.crra <-<span class="st"> </span><span class="kw">add.constraint</span>(portf.crra, <span class="dt">type=</span><span class="st">"box"</span>,
<span class="dt">min=</span><span class="fl">0.05</span>, <span class="dt">max=</span><span class="fl">0.4</span>)
<span class="co"># Add objective to maximize CRRA</span>
portf.crra <-<span class="st"> </span><span class="kw">add.objective</span>(portf.crra, <span class="dt">type=</span><span class="st">"return"</span>,
<span class="dt">name=</span><span class="st">"CRRA"</span>, <span class="dt">arguments=</span><span class="kw">list</span>(<span class="dt">lambda=</span><span class="dv">10</span>))
<span class="co"># I just want these for plotting</span>
<span class="co"># Set multiplier=0 so that it is calculated, but does not affect the optimization</span>
portf.crra <-<span class="st"> </span><span class="kw">add.objective</span>(portf.crra, <span class="dt">type=</span><span class="st">"return"</span>, <span class="dt">name=</span><span class="st">"mean"</span>, <span class="dt">multiplier=</span><span class="dv">0</span>)
portf.crra <-<span class="st"> </span><span class="kw">add.objective</span>(portf.crra, <span class="dt">type=</span><span class="st">"risk"</span>, <span class="dt">name=</span><span class="st">"ES"</span>, <span class="dt">multiplier=</span><span class="dv">0</span>)
portf.crra <-<span class="st"> </span><span class="kw">add.objective</span>(portf.crra, <span class="dt">type=</span><span class="st">"risk"</span>, <span class="dt">name=</span><span class="st">"StdDev"</span>, <span class="dt">multiplier=</span><span class="dv">0</span>)</code></pre>
<!---
Focus on how CRRA is added as an objective
-->
</div>
<div id="run-optimization-3" class="slide section level2">
<h1>Run Optimization</h1>
<pre class="sourceCode r"><code class="sourceCode r">opt.crra <-<span class="st"> </span><span class="kw">optimize.portfolio</span>(R, portf.crra, <span class="dt">optimize_method=</span><span class="st">"DEoptim"</span>,
<span class="dt">search_size=</span><span class="dv">5000</span>, <span class="dt">trace=</span><span class="ot">TRUE</span>, <span class="dt">traceDE=</span><span class="dv">0</span>,
<span class="dt">momentFUN=</span><span class="st">"crra.moments"</span>)</code></pre>
<pre class="sourceCode r"><code class="sourceCode r">opt.crra</code></pre>
<pre><code>## ***********************************
## PortfolioAnalytics Optimization
## ***********************************
##
## Call:
## optimize.portfolio(R = R, portfolio = portf.crra, optimize_method = "DEoptim",
## search_size = 5000, trace = TRUE, traceDE = 0, momentFUN = "crra.moments")
##
## Optimal Weights:
## CA EMN FIA CTAG EM GM
## 0.062 0.382 0.344 0.094 0.050 0.072
##
## Objective Measures:
## CRRA
## -0.0005303
##
##
## mean
## 0.005418
##
##
## ES
## 0.0307
##
##
## StdDev
## 0.009984</code></pre>
<!---
remember to specify a momentFUN to match the arguments in CRRA
-->
</div>
<div id="chart-results" class="slide section level2">
<h1>Chart Results</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">chart.RiskReward</span>(opt.crra, <span class="dt">risk.col =</span> <span class="st">"ES"</span>)
<span class="kw">chart.RiskReward</span>(opt.crra, <span class="dt">risk.col =</span> <span class="st">"StdDev"</span>)</code></pre>
<p><img src="figures/crra_RR_ES.png" /> <img src="figures/crra_RR_StdDev.png" /></p>
</div>
<div id="run-backtest-and-compute-returns" class="slide section level2">
<h1>Run Backtest and Compute Returns</h1>
<pre class="sourceCode r"><code class="sourceCode r">bt.opt.crra <-<span class="st"> </span><span class="kw">optimize.portfolio.rebalancing</span>(R, portf.crra,
<span class="dt">optimize_method=</span><span class="st">"DEoptim"</span>,
<span class="dt">search_size=</span><span class="dv">5000</span>, <span class="dt">trace=</span><span class="ot">TRUE</span>,
<span class="dt">traceDE=</span><span class="dv">0</span>,
<span class="dt">momentFUN=</span><span class="st">"crra.moments"</span>,
<span class="dt">rebalance_on=</span>rebal.freq,
<span class="dt">training_period=</span>training,
<span class="dt">trailing_periods=</span>trailing)
ret.crra <-<span class="st"> </span><span class="kw">summary</span>(bt.opt.crra)$portfolio_returns
<span class="kw">colnames</span>(ret.crra) <-<span class="st"> "CRRA"</span></code></pre>
<!---
Run optimization and extract the portfolio rebalancing returns from the summary method
-->
</div>
<div id="chart-performance" class="slide section level2">
<h1>Chart Performance</h1>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">charts.PerformanceSummary</span>(<span class="kw">cbind</span>(ret.bt.opt, ret.crra),
<span class="dt">main=</span><span class="st">"Optimization Performance"</span>)</code></pre>
<div class="figure">
<img src="figures/ret_crra.png" />
</div>
</div>
<div id="conclusion" class="slide section level2">
<h1>Conclusion</h1>
<p>TODO</p>
<ul>
<li>Overview of what was covered</li>
<li>Additional information and plans for PortfolioAnalytics</li>
</ul>
</div>
<div id="acknowledgements" class="slide section level2">
<h1>Acknowledgements</h1>
<p>Many thanks to</p>
<ul>
<li>Google: funding for Google Summer of Code (GSoC)</li>
<li>GSoC Mentors: Brian Peterson, Peter Carl, Doug Martin, and Guy Yollin</li>
<li>R/Finance Committee</li>
</ul>
<!---
- One of the best things about GSoC is the opportunity to work and interact with the mentors.
- Thank the GSoC mentors for offering help and guidance during the GSoC project and after as I continued to work on the PortfolioAnalytics package.
- R/Finance Committee for the conference and the opportunity to talk about PortfolioAnalytics.
- Google for funding the Google Summer of Code for PortfolioAnalytics and many other proposals for R
-->
</div>
<div id="references-and-useful-links" class="slide section level2">
<h1>References and Useful Links</h1>
<ul>
<li><a href="http://cran.r-project.org/web/packages/ROI/index.html">ROI</a></li>
<li><a href="http://cran.r-project.org/web/packages/DEoptim/index.html">DEoptim</a></li>
<li><a href="http://cran.r-project.org/web/packages/pso/index.html">pso</a></li>
<li><a href="http://cran.r-project.org/web/packages/GenSA/index.html">GenSA</a></li>
<li><a href="http://cran.r-project.org/web/packages/PerformanceAnalytics/index.html">PerformanceAnalytics</a></li>
<li>Pat Burns Random Portfolios</li>
<li>W.T. Shaw Random Portfolios</li>
<li>Martinelli paper</li>
<li>Boudt paper</li>
<li><a href="https://r-forge.r-project.org/projects/returnanalytics/">PortfolioAnalytics on R-Forge</a></li>
<li><a href="http://spark.rstudio.com/rossbennett3/PortfolioOptimization/">Shiny App</a></li>
</ul>
</div>
</body>
</html>