Skip to content

Commit a140735

Browse files
committed
Fix CamDavidsonPilon#277 Ch6 portfolio optimization equation
Substitute "max" for "min". If lambda = 1, then the objective function approximates the portfolio's geometric mean return, and that's something one should maximize with respect to the weights (which by construction should sum to 1). Fix approved by owner: modified: Ch6_Priors_PyMC2.ipynb modified: Ch6_Priors_PyMC3.ipynb and these notebooks need to be in trusted state later.
1 parent 465e7e1 commit a140735

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Chapter6_Priorities/Ch6_Priors_PyMC2.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@
13781378
"\n",
13791379
"With this Bayesian analysis of the stock market, we can throw it into a Mean-Variance optimizer (which I cannot stress enough to not use with frequentist point estimates) and find the minimum. This optimizer balances the tradeoff between a high return and high variance.\n",
13801380
"\n",
1381-
"$$ w_{opt} = \\min_{w} \\frac{1}{N}\\left( \\sum_{i=0}^N \\mu_i^T w - \\frac{\\lambda}{2}w^T\\Sigma_i w \\right)$$\n",
1381+
"$$ w_{opt} = \\max_{w} \\frac{1}{N}\\left( \\sum_{i=0}^N \\mu_i^T w - \\frac{\\lambda}{2}w^T\\Sigma_i w \\right)$$\n",
13821382
"\n",
13831383
"where $\\mu_i$ and $\\Sigma_i$ are the $i$th posterior estimate of the mean returns and the covariance matrix. This is another example of loss function optimization."
13841384
]

Chapter6_Priorities/Ch6_Priors_PyMC3.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@
13781378
"\n",
13791379
"With this Bayesian analysis of the stock market, we can throw it into a Mean-Variance optimizer (which I cannot stress enough, do not use with frequentist point estimates) and find the minimum. This optimizer balances the tradeoff between a high return and high variance.\n",
13801380
"\n",
1381-
"$$ w_{opt} = \\min_{w} \\frac{1}{N}\\left( \\sum_{i=0}^N \\mu_i^T w - \\frac{\\lambda}{2}w^T\\Sigma_i w \\right)$$\n",
1381+
"$$ w_{opt} = \\max_{w} \\frac{1}{N}\\left( \\sum_{i=0}^N \\mu_i^T w - \\frac{\\lambda}{2}w^T\\Sigma_i w \\right)$$\n",
13821382
"\n",
13831383
"where $\\mu_i$ and $\\Sigma_i$ are the $i$th posterior estimate of the mean returns and the covariance matrix. This is another example of loss function optimization."
13841384
]

0 commit comments

Comments
 (0)