投资组合最优化计算
标签:
杂谈 |
分类: 最优化计算 |
The advantages of the IML procedure are as follows:
- You can use matrix algebra to specify the objective function, nonlinear constraints, and their derivatives in IML modules.
- The IML procedure offers several subroutines that can be used to specify the objective function or nonlinear constraints, many of which would be very difficult to write for the NLP procedure.
- You can formulate your own termination criteria by using the "ptit" module argument.
- Although identical optimization algorithms are used, the NLP procedure can be much faster because of the interactive and more general nature of the IML product.
- Analytic first- and second-order derivatives can be computed with a special compiler.
- Additional optimization methods are available in the NLP procedure that do not fit into the framework of this package.
- Data set processing is much easier than in the IML procedure. You can save results in output data sets and use them in following runs.
- The printed output contains more information.
其中:(大部分参数是NLP所有子程序所相同的,不同的子程序还有个别的不同参数,像这里的quad)
| Optimization Subroutines |
| Conjugate Gradient Optimization Method |
|
| Double Dogleg Optimization Method |
|
| Nelder-Mead Simplex Optimization Method |
|
| Newton-Raphson Optimization Method |
|
| Newton-Raphson Ridge Optimization Method |
|
| (Dual) Quasi-Newton Optimization Method |
|
| Quadratic Optimization Method |
|
| Trust-Region Optimization Method |
|
| Least-Squares Subroutines |
| Hybrid Quasi-Newton Least-Squares Methods |
|
| Levenberg-Marquardt Least-Squares Method |
|
| Supplementary Subroutines |
| Approximate Derivatives by Finite Differences |
|
| Feasible Point Subject to Constraints |
|
- The matrix input argument "blc" enables you to specify boundary and general linear constraints.
- The IML module input argument "nlc" enables you to specify general constraints, particularly nonlinear constraints.
http://blog.sina.com.cn/s/blog_62615f170100fooa.html
*------------------求预期收益下的风险最小投资组合-------------------*;
proc corr data=return cov outp=Cov_out ;
var x1-x8;
quit;
proc iml;
close Cov_out;
quit;
最优结果为:
方差为:
blc ,通常有N+2列,N表示结构参数的个数,n+1列表示约束的方向(0表示=,1表示>=,-1表示=<;),n+2列表示约束条件的右边项(right hand side),low1,2表示x1-x8的上下界,low3表示组合的权重约束,low4表示组合的预期收益约束条件。
quad, 注意这里是2倍于协方差矩阵。
*---------------求过无风险利率与有效边界相切时对应的有效组合------------*;
*---------------即最大化定义的函数object--------------------------------------*;
proc iml;
read all var _num_ where(_type_='MEAN') into mean;
close Cov_out;
start object(x) global(mean, COV);
optn={1 2};
结果为:

加载中…