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

 
Quantum:

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.


Thank you
 
Another paper has this
построим распределение LR Correlation for 10,000 independent examples, each consisting of 1,000 measurements

How can I get such a distribution for arbitrary data via Include\Math ? I.e. I input an array of original data, and on the output I get an array of distribution of the original data.

R-квадрат как оценка качества кривой баланса стратегии
R-квадрат как оценка качества кривой баланса стратегии
  • 2017.10.24
  • Vasiliy Sokolov
  • www.mql5.com
Каждая торговая стратегия нуждается в объективной оценке ее эффективности. Для этого используется обширный ряд статистических параметров. Многие из них просты в расчете и показывают интуитивно понятные метрики. Другие сложнее в построении и в интерпретации значений. Несмотря на все это многообразие, есть очень мало качественных метрик для...
 
fxsaber:
Another article has this

How to obtain such a distribution for arbitrary data via Include\Math ? I.e. I input an array of initial data, and on the output I get an array of distribution of initial data.

An example is given in the help - Normal distribution

 
Rashid Umarov:

An example is given in the help - Normal Distribution

Thank you! Why is this often needed function from the example not included in the SB?

//+------------------------------------------------------------------+ 
//| Calculate frequencies for data set| 
//+------------------------------------------------------------------+ 
bool CalculateHistogramArray(const double &data[],double &intervals[],double &frequency[], 
                             double &maxv,double &minv,const int cells=10);
 
fxsaber:

Thank you! Why is this often needed feature from the example not included in the SB?

It is there. Those who need it will find it immediately, and those who don't need it will pass it by

 
Rashid Umarov:

It's right there. Those who need it will find it right away, and those who don't need it will pass it by

Even in the example, it is not called from the SB, but written from scratch. Where is it in SB? I specifically searched for it (in ME CTRL+SHIFT+F "Histogram"), I couldn't find it.

 
fxsaber:

Even in the example it is not called from the SB, but written from scratch. Where is it in the SB? I searched specifically (in ME CTRL+SHIFT+F "Histogram"), I couldn't find it.

Ah, yes. It was written as an example in the help and was not included in the library sources.

And there may be problems in some cases, if I'm not mistaken.

 

Функция рассчитывает значение функции логнормального распределения вероятностей с параметрами mu и sigma для массива случайных величин x[]. В случае ошибки возвращает false. Аналогplnorm() в R.

bool MathCumulativeDistributionLognormal(
  const double   &x[],        // [in] Array with values of the random variable
  const double   mu,          // [in]  Логарифм математического ожидания (log mean)
  const double   sigma,       // [in] Logarithm of standard deviation (log standard deviation)
  const bool     tail,        // [in]. Calculation flag, if true, it calculates the probability that the random variable will not exceed x
  const bool     log_mode,    // [in]. Flag for calculating the logarithm of the value, if log_mode=true, the natural logarithm of the probability is calculated
  double         &result[]    // [out] Array for probability function values
);

What is that x-value?

 
fxsaber:

Even in the example it is not called from the SB, but written from scratch. Where is it in the SB? I looked for it specifically (in ME CTRL+SHIFT+F "Histogram"), I couldn't find it right away.

There are MathProbabilityDensityEmpirical and MathCumulativeDistributionEmpirical (corrected version of Math.mqh in #155) to calculate empirical (from data) density and distribution function.

fxsaber:

What is this x-value?

Since the function is vector-based and works with the array x[i], here you mean the specific value of x[i] (the first parameter).

The tail flag makes sense similar to lower.tail in R, if tail=true, the value of cdf(x) is returned, otherwise 1-cdf(x).
Обсуждение статьи "Статистические распределения в MQL5 - берем лучшее из R и делаем быстрее"
Обсуждение статьи "Статистические распределения в MQL5 - берем лучшее из R и делаем быстрее"
  • 2017.10.19
  • www.mql5.com
Опубликована статья Статистические распределения в MQL5 - берем лучшее из R и делаем быстрее: Автор: MetaQuotes Software Corp...
 
Quantum:

There are MathProbabilityDensityEmpirical and MathCumulativeDistributionEmpirical (corrected version of Math.mqh in #155) to calculate the empirical (from data) density and distribution function

How can I use these functions to replace CalculateHistogramArray in this source?