【CVX】Equivalent convex problems (Huber) Log-optimal investment strategy
Navigator
- Basic model
- b.cvx code
- c.cvx code
- c.yalmip code
- Log-optimal investment strategy
- cvx/yalmip code
- Reference
Basic model
Show that the following three convex problems are equivalent.
(a) The robust least-squares problem (Huber Regression)
min ∑ i = 1 m ϕ ( a i T x − b i ) \min \sum_{i=1}^m\phi(a_i^Tx-b_i) mini=1∑mϕ(aiTx−bi)
with variable x ∈ R n x\in\mathbb{R}^n x∈Rn, where ϕ : R → R \phi:\mathbb{R}\to\mathbb{R} ϕ:R→R is defined as
ϕ ( u ) = { u 2 ∣ u ∣ ≤ M M ( 2 ∣ u ∣ − M ) ∣ u ∣ > M \phi(u)= \begin{cases} u^2 & |u|\leq M\\ M(2|u|-M)& |u|>M \end{cases} ϕ(u)={u2M(2∣u∣−M)∣u∣≤M∣u∣>M
(b) The least-squares problem with variable weights
min ∑ i = 1 m ( a i T x − b i ) 2 / ( 1 + w i ) + M 2 1 T w s . t . w ⪰ 0 \min \sum_{i=1}^m (a_i^Tx-b_i)^2/(1+w_i)+M^2\mathbf{1}^Tw\\ s.t.\quad w\succeq 0 mini=1∑m(aiTx−bi)2/(1+wi)+M21Tws.t.w⪰0
quad_over_lin
Sum of squares over linear. Z=quad_over_lin(X, Y)
where X X X is a vector and Y Y Y is a scalar, is equal to sum(abs(X).^2)./Y
if Y Y Y is positive, and ∞ \infty ∞ otherwise.
b.cvx code
%% cvx: least squares problem with variable weights
disp('Computing the solution of the least-squares problem with variable weights...');
cvx_beginvariable x2(n);variable w(m);minimize (sum(quad_over_lin(diag(A*x2-b), w'+1))+M^2*ones(1, m)*w);subject tow>=0;
cvx_end
(c) Quadratic program
min ∑ i = 1 m ( u i 2 + 2 M v i ) s . t . { − u − v ⪯ A x − b ⪯ u + v 0 ⪯ u ⪯ M 1 \min \sum_{i=1}^m (u_i^2+2Mv_i)\\ s.t. \begin{cases} -u-v\preceq Ax-b\preceq u+v\\ 0\preceq u \preceq M\mathbf{1} \end{cases} mini=1∑m(ui2+2Mvi)s.t.{−u−v⪯Ax−b⪯u+v0⪯u⪯M1
c.cvx code
%% cvx: quadratic program
disp('Computing the solution of the quadratic program...');
cvx_beginvariable x3(n)variable u(m)variable v(m)minimize (sum(square(u)+2*M*v))A*x3-b<=u+v;A*x3-b>=-u-v;u>=0;u<=M;v>=0;
cvx_end
c.yalmip code
%% yalmip: quadratic program
x4 = sdpvar(n, 1);
u = sdpvar(m, 1);
v = sdpvar(m, 1);
F = [A*x4-b<=u+v, A*x4-b>=-u-v];
F = [F, u>=0, u<=M, v>=0];
obj = sum(u.^2+2*M*v);
optimize(F, obj);
Log-optimal investment strategy
We consider a portfolio problem with n n n assets held over N N N periods. At the begining of each period, we reinvest our total wealth, redistributing it over the n n n assets using a fixed, constant, allocation strategy x ∈ R n x\in\mathbb{R}^n x∈Rn, where x ⪰ 0 , 1 T x = 1 x\succeq 0, \mathbf{1}^Tx=1 x⪰0,1Tx=1. In other words, if W ( t − 1 ) W(t-1) W(t−1) is the wealth at the beginning of period t t t, then during period t t t we invest x i W ( t − 1 ) x_iW(t-1) xiW(t−1) in asset i i i. We denote by λ ( t ) \lambda(t) λ(t) the total return during period t t t, i.e., λ ( t ) = W ( t ) / W ( t − 1 ) \lambda(t)=W(t)/W(t-1) λ(t)=W(t)/W(t−1). At the end of N N N periods the wealth has been multiplied by the factor ∏ t = 1 N λ ( t ) \prod_{t=1}^N\lambda(t) ∏t=1Nλ(t). We call
1 N ∑ t = 1 N log λ ( t ) \frac{1}{N}\sum_{t=1}^N\log\lambda(t) N1t=1∑Nlogλ(t)
the growth rate of the investment over the N N N periods. We are interested in determining an allocation strategy x x x that maximizing growth of the total wealth for large N N N.
A discrete stochastic model is employed to account for the uncertainty in the returns. We assume that during each period there are m m m possible scenarios, with probabilities π j , j = 1 , … , m \pi_j, j=1, \dots, m πj,j=1,…,m. In scenario j j j, the return for asset i i i over one period is given by p i j p_{ij} pij. Therefore, the return λ ( t ) \lambda(t) λ(t) of the portfolio during period t t t is a random variable, with m m m possible values p 1 T x , … , p m T x p_1^Tx, \dots, p_m^Tx p1Tx,…,pmTx, and distribution
π j = P ( λ ( t ) = p j T x ) , j = 1 , … , m \pi_j=\mathbb{P}(\lambda(t)=p_j^Tx), j=1,\dots, m πj=P(λ(t)=pjTx),j=1,…,m
We assume the same scenarios for each period, with identical independent distributions. Using the law of big numbers, we have
lim N → ∞ 1 N ( W ( N ) W ( 0 ) ) = lim N → ∞ 1 N ∑ t = 1 N log λ ( t ) = ∑ j = 1 m π j log ( p j T x ) \lim_{N\to\infty} \frac{1}{N}(\frac{W(N)}{W(0)})=\lim_{N\to\infty}\frac{1}{N}\sum_{t=1}^N\log\lambda(t)=\sum_{j=1}^m\pi_j\log(p_j^Tx) N→∞limN1(W(0)W(N))=N→∞limN1t=1∑Nlogλ(t)=j=1∑mπjlog(pjTx)
In other words, with investment strategy x x x, the long term growth rate is given by
R = ∑ j = 1 m π j log ( p j T x ) R=\sum_{j=1}^m\pi_j\log(p_j^Tx) R=j=1∑mπjlog(pjTx)
The investment strategy x x x that maximizes this quantity is called the log-optimal investment strategy, and can be found by solving the optimization problem
max ∑ j = 1 m π j log ( p j T x ) s . t . { x ⪰ 0 1 T x = 1 \max \sum_{j=1}^m \pi_j\log(p_j^Tx)\\ s.t. \begin{cases} x\succeq 0\\ \mathbf{1}^Tx=1 \end{cases} maxj=1∑mπjlog(pjTx)s.t.{x⪰01Tx=1
cvx/yalmip code
%% Data
rng(729);
% P_{ij} is the return of asset i over one period in scenario j
P = [3.5000 1.1100 1.1100 1.0400 1.0100;0.5000 0.9700 0.9800 1.0500 1.0100;0.5000 0.9900 0.9900 0.9900 1.0100;0.5000 1.0500 1.0600 0.9900 1.0100;0.5000 1.1600 0.9900 1.0700 1.0100;0.5000 0.9900 0.9900 1.0600 1.0100;0.5000 0.9200 1.0800 0.9900 1.0100;0.5000 1.1300 1.1000 0.9900 1.0100;0.5000 0.9300 0.9500 1.0400 1.0100;3.5000 0.9900 0.9700 0.9800 1.0100];% n assets and m scenarios[m, n] = size(P);v = abs(randn(m, 1));Pi = v/sum(v);x_eq = ones(n, 1)/n;%% cvx: find the log-optimal investment policycvx_beginvariable x_opt(n);maximize sum(Pi.*log(P*x_opt))subject tosum(x_opt)==1;x_opt>=0;cvx_end%% yalmipx_yal = sdpvar(n, 1);F = [sum(x_yal)==1, x_yal>=0];obj = sum(Pi.*log(P*x_yal));optimize(F, -obj);x_yal = value(x_yal);%% long-term growth ratesR_opt = sum(Pi.*log(P*x_opt));R_eq = sum(Pi.*log(P*x_eq));disp('The long term growth rate of the log-optimal strategy is:');disp(R_opt);disp('The long term growth rate of the uniform strategy is:');disp(R_eq);%% random event sequencesN = 10;T = 200;w_opt = zeros(1+T, N);w_eq = zeros(1+T, N);for i=1:Nevents = ceil(rand(1, T)*m);P_event = P(events, :);w_opt(:, i) = [1; cumprod(P_event*x_opt)];w_eq(:, i) = [1; cumprod(P_event*x_eq)];endfigure;semilogy(w_opt, 'b');hold onsemilogy(w_eq, 'r');axis tightxlabel('time')ylabel('wealth')
Reference
Convex Optimization S.Boyd. Page 233
【CVX】Equivalent convex problems (Huber) Log-optimal investment strategy相关推荐
- 【Elasticsearch】你看懂 Elasticsearch Log 中的 GC 日志了吗?
1.概述 转载:https://elasticsearch.cn/article/812 如果你关注过 elasticsearch 的日志,可能会看到如下类似的内容: [2018-06-30T17:5 ...
- 【转】Hibernate入门之命名策略(naming strategy)详解
前言 JPA和Hibernate都提供了默认映射策略,通过映射将每个实体类映射到具有相同名称的数据库表,它的每个属性都映射到具有相同属性的列, 但是,在实际项目开发中可能出现与默认命名约定不匹配,也就 ...
- 【CVX】Markowitz Model
Navigator portfolio model Matlab Code Reference portfolio model An extension of the classical Markow ...
- 【转】Monkey测试6-Monkey Test Log
Moneky Test Log 分析: 首先用一个最简单的例子分析: monkey --pct-trackball 0 --throttle 100 -v 500 /*p参数: 表示指定测试的程序 / ...
- 【译】如何停止使用console.log()转而使用浏览器debugger
如何停止使用console.log()转而使用浏览器debugger 原文地址:How to stop using console.log() and start using your browser ...
- 【Clickhouse】Clickhouse 表引擎之 Log系列
文章目录 1.概述 5.1 TinyLog引擎(数据不分快) 5.2 StripeLog 5.3 Log 1.概述 Log家族具有最小功能的轻量级引擎.当您需要快速写入许多小表(最多约100万行)并在 ...
- 【Sharepoint】 备份与清理Audit log
Sharepoint Audit Log 是什么? 就是一个记录用户访问操作Sharepoint的日志的功能. 是给管理员了解当前网站的访问状况, 哪些帐号经常访问哪些站点. 设置方式是进入到Si ...
- 【AGC005F】Many Easy Problems FFT 容斥原理
题目大意 给你一棵树,有\(n\)个点.还给你了一个整数\(k\). 设\(S\)为树上某些点的集合,定义\(f(S)\)为最小的包含\(S\)的联通子图的大小. \(n\)个点选\(k\)个点一共有 ...
- 【解决】npm ERR A complete log of this run can be found in npm ERR
有一些同学可能想配置react的运行环境,苦于不同的电脑遇到千奇百怪的问题和ERROR.下面是我遇到问题对应的解决方案,希望对你们有帮助. 本来我们的基本步骤是: 下载好nvm文件 在里面下载node ...
最新文章
- 如何屏蔽ctrl + v 粘贴事件,鼠标右键粘贴事件
- GIT:本地有更改,但强制作远程仓库里作更新
- 【 FPGA 】按键消抖与LED灯流动小实验
- 人脸识别错误代码437是什么意思_lol手游repeat ready check fails什么意思 解决攻略大全...
- c#读蓝牙数据_C#读取BWT901CL蓝牙传感器的数据
- 指针知识(四):指针数学计算
- dialog对话框初始化 mfc_MFC添加子对话框及如何初始化
- Spring boot 学习二:入门
- 递归下降实现LL(1)文法分析C语言与Python实现
- Softether软件原理分析
- 【Unit 1】Python以及Pycharm的安装与设置
- java创建按钮_java中制作一个按钮需要那些步骤
- 计算机用户里的AppData,AppData是什么意思,Appdata文件夹可以删除吗?
- 搜狗实验室新闻数据文本分类深度学习案例 ———Tensorflow+CNN深度学习全流程(上)
- 关于计算机的教学论文,关于计算机教学论文
- ES数据的操作(二)
- 产品经理成长经历感悟
- 资产分类计算机软件,固定资产管理系统_资产分类名称(电子计算机及其外围设备篇)...
- 年末阿里百度等大厂技术面试题汇总,原理+实战+视频+源码
- html背景视频模糊效果,怎么给竖屏视频添加模糊背景的效果
热门文章
- MD04, MD05, MD07, MD07区别
- 用口诀背单词 - 5
- Onscripter for Android 04.25 更新!
- php edd,吐槽解密吸尘器戴森v10motorhedd和fluffy区别有啥?哪个好点?使用良心点评解析...
- 面向对象编程练习(一)
- 榜样访谈| 黄思怡:高校俱乐部提供了更大的平台
- 一个神奇的网站 Papers with code
- Telegram公布个人身份验证工具,可共享财务及ICO数据
- android launcher3,android Launcher3 设置默认桌面应用
- Device /dev/sdb1 excluded by a filter