Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3227
| From | Bob Hanlon <hanlonr@cox.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: random financial portfolios |
| Date | 2011-06-21 12:36 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <itq38n$nd3$1@smc.vnet.net> (permalink) |
returns = {0.05, -0.2, 0.15, 0.3};
covariance = {
{0.08, -0.05, -0.05, -0.05},
{-0.05, 0.16, -0.02, -0.02},
{-0.05, -0.02, 0.35, 0.06},
{-0.05, -0.02, 0.06, 0.35}};
data = Table[
weights = RandomReal[{0, 1}, 4];
weights = weights/Total[weights];
{weights.covariance.weights, weights.returns},
{100}];
ListPlot[data, Frame -> True, Axes -> False]
Bob Hanlon
---- Priyan Fernando <priyan.fernando@gmail.com> wrote:
=============
Hi,
Wonder if someone can help me pls; I'm new to mathematica. I want to
generate "random" financial portfolios using the following parameters.
returns = {0.05, -0.2, 0.15, 0.3}
covariance = {{0.08, -0.05, -0.05, -0.05}, {-0.05,
0.16, -0.02, -0.02}, {-0.05, -0.02, 0.35, 0.06}, {-0.05, -0.02,
0.06, 0.35}}
So we need
*weights={w1,w2,w3,w4}*
where each term is a random numbers representing asset the asset weigth
[assume that these must sum to 1 - a long only portfolio]
I want to randomly change the weights and then calculate porfolio return:
*weights.returns*
and portfolio variance:
*weights.covariance.weights*
Then want to plot the return against risk, for say around 100 simulations.
Your help is much appreciated.
Thanks!
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: random financial portfolios Bob Hanlon <hanlonr@cox.net> - 2011-06-21 12:36 +0000
csiph-web