Discussion of article "Statistical Distributions in MQL5 - taking the best of R" - page 16

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
that's for you to take a course in mathematical statistics :-) Consider it a divine truth given to us from above and in the form of State Standards
Maple and Mathcad are waving goodbye.
ZY R also counts through (size-1)?
Yes. MathVariance counts sample variance similarly to var() in R.
1.2 MathVariance
The function calculates the variance (second moment) of array elements. In case of an error it returns NaN. An analogue of var() in R.
R:
MQL5:
Wolfram:
Excel:
Yes. MathVariance counts sample variance similarly to var() in R.
R:
MQL5:
Wolfram:
Excel:
Mathcad:
There seems to be no understanding of what Mean Square Deviation is in the systems you cited.
Mathcad:
To calculate sample variance in MathCad try "Var" instead of "var".
How to do it in MQL?
ZY In mathcad there is mean, but there is no Mean. And so it is with many functions. And most people use functions with a small letter. And when something specific is needed, they use capital letters. But in R/Wolfram/Excel, it seems to be the other way round: if there is a possibility to give something specific, it is given by default, and if you need something standard, write it differently. But of course, it's a pity that Math.mqh can't calculate RMS.
Either I have something wrong or there is a problem with the empirical density calculation.
Thanks for the message, you are right, there is an error in the normalisation of the empirical density. Attached is the corrected version of Math.mqh.
How to do it in MQL?
ZY In mathcad there is mean, but there is no Mean. And so it is with many functions. And most people use functions with a small letter. And when you need something specific - with a capital letter. But in R/Wolfram/Excel, it seems to be the other way round: if you can give something specific, it is given by default, and if you need something standard, write it differently. And so, of course, it's a pity that Math.mqh can't calculate RMS.
In general, the function that we have now - MathVariance() - should be called MathUnbiasedVariance(). Because it is a sample unbiased variance (normalised by n-1). I looked in ALGLIB library, it calculates sampled unbiased variance there too.
Good article on the topic.In general, the function that we have now - MathVariance() - should be called MathUnbiasedVariance(). Because it is a sample unbiased variance (normalised by n-1). I looked in the ALGLIB library, it calculates sampled unbiased variance there too.
Will you leave it the bad way?
Will you leave it the bad way?
I will not edit the SB, let the authors do it :-) In principle, you can write your own statistical class based on the SB.
There is another nuance here, imho: when to use biased or unbiased estimation. And what kind of population we are working with - sample or general. The SB tells us right away that we're dealing with a sample. And that's not always the case. Yes, all this is critical when the population is small.
I will not edit the SB, let the authors do it :-) In principle, you can write your own statistical class based on the SB.
There is another nuance here, imho: when to use biased or unbiased estimation. And what kind of population we are working with - sample or general. The SB tells us right away that we're dealing with a sample. And that's not always the case. Yes, all this is critical when the population is small.
Well, then don't change the SB, add it. I myself, of course, it is not difficult to correct and write from scratch. The point is that you can pass the code to someone without your bible, because everyone has an SB.