hoangduit / accord

Automatically exported from code.google.com/p/accord
0 stars 0 forks source link

Q: Distribution functions that take x, but what about functions that can take z? #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Most of my code work in standard units, but I don't see any function
that take z. I do see ZScore that take an x and returns a z (it would also be 
nice to have a function called ToX(z), i.e. the complement of ZScore).

Anyway, I'm currently doing the following:
var x = z * std + mean;

then I'm calling normal.DistributionFunction(x) and the first thing
the functions do is turn x back into z.

This isn't that expensive if you are only performing a few hundred calculations 
but I'll be performing 2-15 Billion calculations and I'm afraid this overhead 
will add up quickly.

Any chance we could get functions that takes a ZScore? I don't know what you 
would call it, maybe something like:
normal.ZScoreDistributionFunction(z) (personal favorite) or
normal.ZDistributionFunction(z) or 
normal.DistributionFunctionZ(z) or 
normal.StandardDistributionFunction(z) (least favorite) or 
????

Thanks.

Original issue reported on code.google.com by Tristen....@gmail.com on 11 Sep 2013 at 2:39

GoogleCodeExporter commented 9 years ago
Thanks for the suggestion! The new functions would indeed be nice. But for the 
time being, please let me know if any of those two ideas would also work for 
you:

1) The NormalDistribution has a static property named Standard. So if you need 
you can call NormalDistribution.Standard.DistributionFunction(z) passing your 
z-score without the need for computing var x = z * std + mean beforehand.

2) Alternatively, there is also the Accord.Math.Normal class which provides raw 
access to some of the Phi functions (normal distribution functions) directly. 
They accept z-scores directly and do not perform any extra transformations.

Hope it helps!

Original comment by cesarso...@gmail.com on 11 Sep 2013 at 5:52

GoogleCodeExporter commented 9 years ago
Thanks, option 2 worked perfectly!

PS. THANKS FOR THE LIBRARY!!! I starting using your library for the first time 
yesterday and I was able to implement a complex algorithm from start to finish 
in under 6 hours and in less than 100 lines of code! That felt great!

Original comment by Tristen....@gmail.com on 12 Sep 2013 at 1:42

GoogleCodeExporter commented 9 years ago
I am glad you got it working! I also hope the framework can continue being 
useful for your needs! :-)

If you need further help, please open a new ticket, or visit the project forums.

Original comment by cesarso...@gmail.com on 13 Sep 2013 at 2:48