Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3217 > unrolled thread
| Started by | Priyan Fernando <priyan.fernando@gmail.com> |
|---|---|
| First post | 2011-06-21 11:24 +0000 |
| Last post | 2011-06-22 07:42 +0000 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
random financial portfolios Priyan Fernando <priyan.fernando@gmail.com> - 2011-06-21 11:24 +0000
Re: random financial portfolios Ray Koopman <koopman@sfu.ca> - 2011-06-21 12:24 +0000
Re: random financial portfolios Priyan Fernando <priyan.fernando@gmail.com> - 2011-06-22 07:56 +0000
Re: random financial portfolios Priyan Fernando <priyan.fernando@gmail.com> - 2011-06-22 07:42 +0000
| From | Priyan Fernando <priyan.fernando@gmail.com> |
|---|---|
| Date | 2011-06-21 11:24 +0000 |
| Subject | random financial portfolios |
| Message-ID | <itpv0k$m6o$1@smc.vnet.net> |
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!
[toc] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2011-06-21 12:24 +0000 |
| Message-ID | <itq2ir$n2j$1@smc.vnet.net> |
| In reply to | #3217 |
On Jun 21, 4:24 am, Priyan Fernando <priyan.ferna...@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!
RandomVariate[DirichletDistribution[{1,1,1,1}]] will give you
a random portfolio in which all weightings are equally likely.
RandomVariate[DirichletDistribution[{1,1,1,1}],n] will give you
n such portfolios.
[toc] | [prev] | [next] | [standalone]
| From | Priyan Fernando <priyan.fernando@gmail.com> |
|---|---|
| Date | 2011-06-22 07:56 +0000 |
| Message-ID | <its76m$65u$1@smc.vnet.net> |
| In reply to | #3217 |
Thanks Bob for your code :)
Ray, using the Dirichlet distribution would give the same results as using
the following, right?
weights = RandomReal[{0, 1}, 4]; weights = weights/Total[weights];
On 21 June 2011 17:54, Ray Koopman <koopman@sfu.ca> wrote:
> On Jun 21, 4:24 am, Priyan Fernando <priyan.ferna...@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!
>
> RandomVariate[DirichletDistribution[{1,1,1,1}]] will give you
> a random portfolio in which all weightings are equally likely.
>
> RandomVariate[DirichletDistribution[{1,1,1,1}],n] will give you
> n such portfolios.
>
>
--
Thanks and Regards,
Priyan Fernando
Mob. +94 772 622 368
[toc] | [prev] | [next] | [standalone]
| From | Priyan Fernando <priyan.fernando@gmail.com> |
|---|---|
| Date | 2011-06-22 07:42 +0000 |
| Message-ID | <its6d7$5u8$1@smc.vnet.net> |
| In reply to | #3217 |
Thanks Bob for your code :)
Ray, using the Dirichlet distribution would give the same results as using
the following, right?
weights = RandomReal[{0, 1}, 4]; weights = weights/Total[weights];
On 21 June 2011 17:54, Ray Koopman <koopman@sfu.ca> wrote:
> On Jun 21, 4:24 am, Priyan Fernando <priyan.ferna...@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!
>
> RandomVariate[DirichletDistribution[{1,1,1,1}]] will give you
> a random portfolio in which all weightings are equally likely.
>
> RandomVariate[DirichletDistribution[{1,1,1,1}],n] will give you
> n such portfolios.
>
>
--
Thanks and Regards,
Priyan Fernando
Mob. +94 772 622 368
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web