[Statistical Tools] Skewness, Kurtosis bug

[Statistical Tools] Skewness, Kurtosis bug - Messages

#1 Posted: 5/28/2018 1:32:09 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Stat Skewness(Y).sm (10 KiB) downloaded 47 time(s).
#2 Posted: 5/28/2018 1:46:01 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... kurtosis does not cut the mustard either.

Stat Skewness(Y).sm (12 KiB) downloaded 46 time(s).
1 users liked this post
NDTM Amarasekera 5/28/2018 11:11:00 PM
#3 Posted: 5/29/2018 12:22:15 PM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

I have the same problem with latest SS appVersion(4)="0.99.6671.38791".
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#4 Posted: 5/29/2018 2:52:33 PM
Arie

Arie

93 likes in 285 posts.

Group: User

I don't know anything about Skewness/Kurtosis, but I did look up the Matlab algorithms for each. Jean, I don't know where your algorithms comes from, but it appears SMath uses same/similar algorithms as Matlab.

Stat Skewness(Y)_Lyles.sm (19 KiB) downloaded 49 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#5 Posted: 5/29/2018 11:34:12 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Jean, I don't know where your algorithms come from, but it appears SMath uses same/similar algorithms as Matlab.


Source code: Mathcad/Mathsoft "Statistical Electronic Book"
As you know, there are three kinds of lies:
1 white lie... 2. convenient lie ... 3. Statistics

Thanks for checking, thanks Collab NDTMA for checking too.

#6 Posted: 5/30/2018 6:14:36 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Thank you Jean for highlighting this issue.

Sta bug.jpg
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#7 Posted: 5/30/2018 7:03:22 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Forgot to attach the Excel worksheet. Sorry!

Skew & Kurtosis.xlsx (24 KiB) downloaded 36 time(s).
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#8 Posted: 5/30/2018 7:50:49 AM
Arie

Arie

93 likes in 285 posts.

Group: User

Wrote


Source code: Mathcad/Mathsoft "Statistical Electronic Book"



I may have found the issue. Not sure if there is a typo or not in your book, but if you look at the Mathcad Website here: https://help.ptc.com/mathcad/en/index.html#page/PTC_Mathcad_Help/example_kurt_and_skew.html

You will see a formula similar to yours. However, you need to move the StdDev(Y) function outside of the left most expression in each function. I'm not at a computer with Smath right now so I can't verify if it produces the same results. Will check back later.

Untitled drawing.png
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#9 Posted: 5/30/2018 2:14:55 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

However, you need to move the StdDev(Y) function outside of the left most expression in each function



That is immaterial, the suite of multiplications is commutative.
Smath/Matlab use the same Kurtosis algorithm ... different than Mathcad.
OriginLab 7.5 [formerly Microcal] gives 19 stat parameters wrt to 'Y'
OriginLab 7.5 kurtosis = same as Mathcad [-0.618]
Note that OriginLab is the Bible CAS in Pharmacokinetics.

Smath KurtosisExcess(Y)=-0.775 is much closer ... still troubling.

Cheers ... Jean

Stat Skewness_Kurtosis(Y).sm (32 KiB) downloaded 38 time(s).
#10 Posted: 5/30/2018 2:45:37 PM
Arie

Arie

93 likes in 285 posts.

Group: User

Wrote


That is immaterial, the suite of multiplications is commutative.



Yes. but (a*b*c)^4 is much different than (a*b )*C^4 Edit: Whoops I see that it looks right in original file. I miscounted parentheses.

I've done quite a bit of research into this because I've been curious. There are two differences between the Matlab/Smath and Mathcad Functions.

1.) The Matlab kurtosis link mentions this, but the Wolfram link explains it very well. Kurtosis has been historically defined such that a normal distribution has kurtosis of 3. However, Kurtosis Excess is defined with a -3 offset such that a Normal distribution has a Kurtosis Excess of 0. The Mathcad Kurtosis function is really a Kurtosis Excess function such that a normal distribution has a kurtosis of 0.

2.) The second difference is that the Mathcad algorithm accounts for sample size whereas the Matlab/SMath algorithm does not. I found a website here that explains the difference.

Lastly, I performed a small experiment by creating a Matlab based skewness and kurtosis function as well as a mathcad based skewness and kurtosis function. I then created random vectors with increasing sample sizes (from 10 to 1000) and compared the % error from the built in Smath Skewness and Kurtosis functions. As you can see the as the sample size increases the difference between the Matlab and Mathcad algorithms decreases (at least for Skewness). It may take a minute or two to run.

Untitled.png

Stat Skewness(Y)_Lyles.sm (31 KiB) downloaded 36 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#11 Posted: 5/30/2018 6:18:16 PM
CBG

CBG

77 likes in 312 posts.

Group: User

Skewness.png

Skewnesss_and_Kurtosis_Jean_CBG.sm (11 KiB) downloaded 39 time(s).


Best Regards

Carlos
#12 Posted: 5/30/2018 10:44:21 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Thank you both: Alyles, Carlos.

I reconciliated myself with these two descriptive statistic parameters.
In short: as useful as knowing the night of next blue moon, as they refer
strictly to Normal Distribution ... Oh ! there are surely very many in fact.
In real data collection, you are just interested to fit an histogram to some
kind of PDF from known or less common.
Like Mathcad says: value of kurtosis is immaterial, only ±

Stat Skewness_Kurtosis(Y).sm (43 KiB) downloaded 36 time(s).
#13 Posted: 5/31/2018 12:38:51 AM
CBG

CBG

77 likes in 312 posts.

Group: User

Skewnesss_and_Kurtosis_Jean_CBG_R1.sm (46 KiB) downloaded 36 time(s).

Skewness_R1.png

Best Regards

Carlos
#14 Posted: 5/31/2018 11:05:56 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Thanks Carlos for your reconciliation ... no more bug !

Stat Skewness_Kurtosis(Y).sm (60 KiB) downloaded 44 time(s).
  • New Posts New Posts
  • No New Posts No New Posts