[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Random numbers



PureBytes Links

Trading Reference Links

Ed,

An alternative is to import a CSV with numbers generated by any 
theoretical distribution you like (you can generate these in XL for 
example, see "Random Number Generator"). Then you can use AFL's 
looping and Random to draw from this series.

I've asked Tomasz to increase the number of statistical/methematical 
functions, because I now need to either program them myself (which is 
complicated for something like multiple var OLS), or import from 
external programs.

Hope this helps. 

PS

--- In amibroker@xxxxxxxxxxxxxxx, "ed nl" <ed2000nl@xxxx> wrote:
> hi,
> 
> the random() function generates numbers between 0 and 1, 
distributed "linearly" (not sure this is the proper term  -> 
statistics was a while back .....). Meaning that if you run Lastvalue
(random()) a million times we would about get the same hits with 0.9 
as with 0.3.
> 
> (0.5 - Random()) * 2  gives you a function with numbers between -1 
and 1  with a "linear" distribution.
> 
> What I want is to generate random numbers between -1 and 1 which do 
not have a "linear" distribution. They should have some kind of 
Gaussian distribution where chances a number generated near 0 is 
greater than a number generated neat -1 or 1. 
> 
> I made this Gauss function (see below) but this generates numbers 
with a standard deviation of 1 but does not have a high or low number 
restriction.  So I want the numbers to fluctuate randomly between -1 
and 1 but still have some form of Gauss function in them so that a 
hit at 1 occurs less frequent than at 0.3.
> 
> thanks,
> 
> rgds, Ed
> 
> 
> function gauss_func() { 
> 
>    w = 1; 
>    while( w >= 1 ) { 
> 
>       x1 = 2.0 * LastValue(Random()) - 1; 
>       x2 = 2.0 * LastValue(Random()) - 1; 
>       w = x1 * x1 + x2 * x2; 
> 
>    } 
> 
>    w = sqrt( (-2 * log(w)) / w ); 
>    y1 = x1 * w; 
>    //y2 = x2 * w; 
>     
>    return y1; 
> 
> }




------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/