peev / cryptobeast-reactjs

MIT License
1 stars 2 forks source link

[Analytics] St. Dev, Skewness, Kurtosis #260

Open KudraVello opened 5 years ago

KudraVello commented 5 years ago

As a user, When I to analytics / volatility, I want to see a graph which shows me the St. Dev, Skewness and Kurtosis for each individual asset I currently own.

The number needs to be calculated separately for each of the assets and then displayed in a bar chart. image

Standard deviation is calculated as follows:

  1. Calculate the average (mean) price for the number of periods or observations.
  2. Determine each period's deviation (close price less average price).
  3. Square each period's deviation.
  4. Sum the squared deviations.
  5. Divide this sum by the number of observations.
  6. The standard deviation is then equal to the square root of that number.

Skewness is calculated as follows: Skewness numer = Mean ^ 3 divided by (2 * (standard deviation ^ 3))

Kurtosis is calculated as follows: m4 = (sum of ([all deviations from the mean] ^ 4) divided by size of sample) m2 = (sum of ([all deviations from the mean] ^ 2) divided by size of sample) Kurtosis = m4 divided by m2 ^ 2

KudraVello commented 5 years ago

image

TeodorKolev commented 5 years ago

formulas Solved by: Std.Deviation - used http://mathjs.org/docs/reference/functions/std.html Skewness - used https://github.com/maxto/ubique (NOT found correct online calculator that finds exact number) example: https://ncalculators.com/statistics/skewness-calculator.htm // 0.617481 https://ncalculators.com/statistics/skewness-calculator.htm // 0.5858 https://www.socscistatistics.com/tests/skewness/Default.aspx // 0.73 conclusion: online calculators are not correct Kurtosis - used https://github.com/maxto/ubique https://www.easycalculation.com/statistics/kurtosis.php // 3.03758113489 https://github.com/maxto/ubique/blob/master/lib/stats/kurtosis.js // 3.037581