组合投资的风险与回报概述及 MATLAB 实现

组合投资的风险与回报概述及 MATLAB 实现

介绍:
组合投资是指将资金分散投资于多种不同资产的投资策略。通过组合投资,投资者可以实现风险分散,并在不同资产类别之间平衡风险和回报。本文将概述组合投资的风险与回报,并提供使用 MATLAB 进行组合投资分析的源代码示例。

  1. 风险的概念与度量方法:
    风险是指投资中可能发生的损失或不确定性。在组合投资中,风险可以通过标准差、方差和协方差等方法进行度量。标准差衡量资产收益的波动性,方差衡量资产收益的离散程度,而协方差则度量不同资产之间的相关性。在 MATLAB 中,可以使用以下代码计算资产收益的标准差:
returns = [0.05, 0.03, 0.02, 0.04];
组合投资的风险与回报分析 - MATLAB实现 假设我们希望构建一个由这 5 种资产组成的投资组合,其中 AAPL、GOOG、IBM、XOM、GS 的权重分别为 0.2、0.2、0.2、0.2、0.2。上述代码中,我们定义了投资组合的权重向量,并用该向量乘以每个资产的年度平均收益率,得到了该投资组合的预期年收益率。通过以上分析,我们可以更加科学、全面地评估不同投资组合的风险与回报,从而制定出更加符合自身风险偏好和投资目标的投资策略。最后,我们可以通过绘制投资组合在收益-风险平面上的分布情况,来直观地评估该投资组合的风险与回报。上述代码中,我们调用了。 阅读详情

相关推荐

Matlab风险投资模型:收益与风险的非线性求解

Matlab是一个高性能的数值计算环境和第四代编程语言,广泛用于算法开发、数据可视化、数据分析及数值计算。它的特点在于矩阵运算的简便性和强大的函数库支持,特别适合解决金融建模中的复杂问题。在风险投资模型中,Matlab可以用来处理大量数据、计算收益率和风险指标,以及优化投资组合。风险投资模型是一种统计模型,用于估计投资的潜在风险和预期收益。在金融领域,风险通常与收益呈正相关关系,投资者需要在预期收益和可接受的风险水平之间找到平衡点。

weixin_33628677的博客 920

OriginPro实战:5步搞定碳材料拉曼光谱D峰G峰分析(附完整数据处理流程)

本文详细介绍了使用OriginPro进行碳材料拉曼光谱D峰G峰分析的完整流程,涵盖数据预处理、多图层可视化、高精度分峰拟合等关键步骤。特别针对材料科学研究中的基线漂移、多峰重叠等问题提供专业解决方案,帮助研究者快速完成从原始数据到科研级图表的全流程分析,提升碳材料表征效率与准确性。

vodka的博客 951

SpringBoot文件上传实战:MultipartFile重复读取的3种方法(附避坑指南)

本文详细介绍了SpringBoot中处理MultipartFile重复读取的3种实用方法,包括字节数组缓存法、临时文件法和流重置法,并提供了避坑指南和性能优化技巧。特别适合需要多次读取上传文件内容的开发者,帮助解决InputStream流只能读取一次的问题。

weixin_28710999的博客 399

MIT 18.03 微分方程 ODE 学习笔记分享——目录

从B站上看到了MIT 微分方程的课程,觉得老爷子讲的真好! 其实微分方程对于工科来说相当重要,但是很多学习也仅把他放在高数里作为单独的一个章节来讲,这是远远不够的。所以对于同学们来说 ,一定要认真听讲,做好笔记! 以下是我的个人学习比较分享。有需要的同学可以做一个参考。 注:个人认为笔记的作用是用来回想起课堂所讲的内容(细节),所以我的笔记风格为以老师讲课思路为准,板书为辅。建议刚开始听这门课的同...

weixin_40664094的博客 2634

Windows正在配置Xftp6在下面的框输入包含安装程序包“Xftp 6.msi“的文件夹的路径

Windows正在配置Xftp6在下面的框输入包含安装程序包“Xftp 6.msi"的文件夹的路径

m0_56588258的博客 2474

[南大ICS-PA2]PA2 - 简单复杂的机器:冯诺依曼计算机系统

mips32和riscv32的指令长度只有32位, 因此它们不能像x86那样, 把C代码中的32位常数直接编码到一条指令中. 思考一下, mips32和riscv32应该如何解决这个问题?加载立即数到寄存器的高20位,然后便可以是哟给你标准的立即指令来创建32位常量。在程序分析领域中,静态指令是指程序代码中的指令,动态指令是指程序运行过程中的指令,例如对于一下指令序列。位域,在小端机器上,先定义的在每个字节的低位,后定义的在每个字节的高位。,这是处理非法指令的宏,其定义在。指令,而下一条动态指令则是。

qq_42474104的博客 929

IDCNBSAIS-财务报表功能范围取值管理费用、销售费用、研发费用排除指定科目的实现

研究了很多方法,没有办法实现,只在营业费用增加一个冲抵项解决,也咨询了外部顾问说要建立自建表。限于需要马上修正后面只能用了最最low的办法处理了一下。公司遇到的一个问题,目前报表有些项目是按照功能范围取值的,发现取多了。IDCNBSAIS-财务报表功能范围取值管理费用、销售费用、研发费用排除指定科目的实现。最后结果是正确的,但是总觉得有更好的办法,不知道有没有高人可以指点一下?建立一个调整项的目录,在每个节点做了调整。除了研发费用做了冲抵在以下每个节点都做了冲抵。为财务报表定义表格结构。

nopicture的博客 1496

82、yolov11检测模型迁移瑞芯微rk3588和使用昇腾设备300i DUO卡推理 batch=1/3,支持昇腾NMS迁移npu推理

本文介绍了使用昇腾设备进行分割推理的测试流程,包括两种测试方式(cann+onnx和om)。首先验证300iDUO卡的可用性,随后创建Docker镜像和容器以搭建独立环境。通过从指定仓库拉取Ubuntu 20.04镜像,创建容器并映射目录。进入容器后安装必要组件(Python3、GCC等)和系统工具(pciutils、net-tools等),为后续模型转换和迁移做准备。整个流程旨在构建可交付给第三方的标准化测试环境。

sxj731533730 1219

Vaultwarden(Bitwarden)密码管理器部署教程,完美解决局域网HTTPS访问难题

想部署Bitwarden/Vaultwarden密码管理器,但是遇到了HTTPS访问难题。🔐 本文将与您分享密码管理器的部署和HTTPS问题的解决方案🚀

XiaoqiangClub的博客 710

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

上一篇: 使用FFT变换对比加入窗函数后的图像频谱和相位 - MATLAB实现
下一篇: 基于贝叶斯优化的 LSTM 模型实现数据预测
普通网友
博客等级 码龄3年 293粉丝 666原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值