Would you tell me the code for Fisher Pearson skewness?

1 回表示 (過去 30 日間)
Chris
Chris 2022 年 9 月 20 日
コメント済み: Sim 2023 年 11 月 27 日
Would you tell me the code for Fisher Pearson skewness?
How can I get the skewness with Fisher Pearson formula..?

採用された回答

David Goodmanson
David Goodmanson 2022 年 9 月 21 日
編集済み: David Goodmanson 2022 年 9 月 21 日
Hi Chris,
y = rand(1,100); % some data
m = mean(y);
n = numel(y);
scalc = (sum((y-m).^3)/n)/var(y,1)^(3/2)
s = skewness(y)
scalc agrees with Matlab's skewness function.
You have to be careful using the variance here (or the standard deviation). The var default is
sum((y-m)^2)/(n-1)
but for variance as used in Matlab's skewness function, you divide by n instead of (n-1). That means using var(y,1) rather than the default var(y). Same idea for std if that were used.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 9 月 20 日
FPskewness = sum(x - mean(x)) / numel(x) / std(x).^3
You would need to be more rigourous if you wanted to handle non-vectors.
  5 件のコメント
John D'Errico
John D'Errico 2022 年 9 月 21 日
Jeff is correct. Skewness would be a scaled (normalized) 3rd central moment, so there MUST be a cube in there.
Sim
Sim 2023 年 11 月 27 日
Hi, what should be changed, in the @Walter Roberson formula, to make it correct? I do not understand...
y = rand(1,100); % some data
m = mean(y);
n = numel(y);
s = skewness(y) % matlab embedded function
s = -0.2898
scalc = (sum((y - m).^3) / numel(y)) / var(y,1)^(3/2) % David Goodmanson solution
scalc = -0.2898
FPskewness = sum(y - mean(y)) / numel(y) / std(y).^3 % Walter Roberson solution
FPskewness = -8.9461e-16

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by