# Would you tell me the code for Fisher Pearson skewness?

조회 수: 3(최근 30일)
Chris 2022년 9월 20일
편집: David Goodmanson 2022년 9월 21일
Would you tell me the code for Fisher Pearson skewness?
How can I get the skewness with Fisher Pearson formula..?

댓글을 달려면 로그인하십시오.

### 채택된 답변

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 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.
##### 댓글 수: 4표시숨기기 이전 댓글 수: 3
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.

댓글을 달려면 로그인하십시오.

### 범주

Find more on Surface and Mesh Plots in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!