PureBytes Links
Trading Reference Links
|
Thanks, but there is one problem:
Arr2=Yrs;
I was looking for the function Yrs in Help but found nothing:-(, even not
similar:-(
_____
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of vlanschot
Sent: Wednesday, February 21, 2007 5:21 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Covariance
Arr1=C;
Arr2=Yrs;
Lookback=30;
Covar=correlation (Arr1, Arr2,Lookback)*StDev(Arr1)*StDev(Arr2);
Var=StDev(Arr1)^2;
A few points:
1) Lookback is arbitrary. Longer is better.
2) You're dealing with non-stationary series. Be careful about
interpretation of statistics.
3) Since correlation of a series with itself is 1, Var is simply
StDev-squared.
4) AB's StDev is based on assumed full population, whereas you're
only using a sample. I.e. purists need to adjust for this.
Hopefully, once the account-manager is fully functional, TJ will
think about adding matrix-functions, with which we could easily
create var-covar matrices of portfolio-returns, factor-returtns, etc.
(Yes, I know I can already do this in AFL, but what about an inverted
matrix??)
PS
--- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com> ps.com,
"aleskresta" <ales.kresta@xxx>
wrote:
>
> Greetings,
>
> I am still a little bit confused about arrays in AB, could
someone
> give me an example of one simple thing:
>
> 1)I have an array of Close prices
> 2)I want to create an array(the same length as first) of a number
> 1,2,3, nad so on
> 3)I want to compute covarience between array 1 and array 2, and
> variance of array 2
>
> Because I am confused about arrays I don't know how to do the
second
> thing
>
> Thanks a lot for advice
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/696 - Release Date: 2/21/2007 3:19 PM
|