Given:
stkret=: 365$3^%365
bndret=: 365$2^%365
You are expecting that the following two
expressions should give the same results:
*/(0.60*stkret)+0.40*bndret
2.55099
{: (0.60**/\stkret)+0.40**/\bndret
2.6
The latter is mathematically equivalent to:
(0.60**/stkret)+0.40**/bndret
2.6
So why to you think the following expressions
should be the same?
*/(0.60*stkret)+0.40*bndret
(0.60**/stkret)+0.40**/bndret
Some examples to show that they are not the same.
(Imprecision due to floating point numbers is
clearly not a factor.)
s=: 1 2 [ b=: 3 4
*/(0.6*s) + 0.4*b
5.04
(0.6**/s) + 0.4**/b
6
s=: 2 2 [ b=: 5 5
*/(0.6*s) + 0.4*b
10.24
(0.6**/s) + 0.4**/b
12.4
s=: 1r2 1r2 [ b=: 1r3 1r3
*/ (3r5*s) + 2r5*b
169r900
(3r5**/s) + 2r5**/b
7r36
----- Original Message -----
From: Devon McCormick <[EMAIL PROTECTED]>
Date: Sunday, December 10, 2006 7:12 pm
Subject: Re: [Jgeneral] exp(y). sin(y) and accuracy.
> I am not making this assumption at all.
>
> On 12/9/06, Chris Burke <[EMAIL PROTECTED]> wrote:
> >
> > The mistake is the assumption that:
> >
> > (x^r)+(y^r) is the same as (x+y)^r
> >
> > i.e.
> >
> > */365 $ +/0.6 0.4 * 3 2 ^ %365
> > 2.55099
> >
> > */365 $ (+/0.6 0.4 * 3 2) ^ %365
> > 2.6
> >
> >
> > Devon McCormick wrote:
> > > Here's a real-life example I encountered recently. I've
> simplified the
> > > annual return
> > > numbers to 200% for stocks and 100% for bonds (*3 2,
> respectively) to
> > make
> > > the
> > > math more easily checkable.
> > >
> > > I start with a series of daily returns for a stock and bond index:
> > >
> > > */stkret=. 365$3^%365 NB. Daily stock returns - triple
> over the
> > year
> > > 3
> > > */bndret=. 365$2^%365 NB. Daily bond returns - double
> over the year
> > > 2
> > >
> > > I want to use the daily returns of a 60/40 stock/bond
> benchmark based on
> > > these
> > > index returns to calculate an annual return:
> > >
> > > NB. 60/40 stock/bond benchmark - naive calculation:
> > > */bmkret1=. (0.60*stkret)+0.40*bndret
> > > 2.5509869
> > > NB. is demonstrably wrong:
> > > 0.6 0.4 +/ . * 3 2
> > > 2.6
> > >
> > > NB. Alternate version (using cumulative returns) gives correct
> answer:> > {:bmkretcum=. (0.60**/\stkret)+0.40**/\bndret
> > > 2.6
> > >
> > > So, I've introduced a noticeable loss of precision simply by
> multiplying> > each series by a number less than one before
> accumulating the returns.
> > > This error is easy to make but harder to catch when using real
> return> > numbers
> > > if we don't have some independent calculation of the final result.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm