MATLAB: How matlab determine skewness

skewness

hi all, i tabulated out my data residual and i do a boxplot on the residual, what i find is the median line is closer to the 75th percentile so by right it should be positively skewed and i use matlab function skewness(data) and got a positive value which validate the residual boxplot as positively skewed. However, if its positively skewed it should mean there are more observation on the positive side, but of all the residual that i have(124 of them) only 30+ of them is positive. I wondering if it still considered as positively skewed ? or is there something i missed out ? (and yes, my mean is smaller than median)

Best Answer

Please post a screenshot, and attach your data file and m-code to read it in and plot it, if you can.
Be aware that skewness is determined not only by how many data points are to the right and left of the mode but also how far away they are . So more points that are on the left but close to the mode, may not overwhelm a few points that are on the right but much farther away, giving an overall positive skewness even though more points are on the left. Here is the formula for an image:
% Get the skew.
skewness = sum((GLs - meanGL) .^ 3 .* pixelCounts) / ((numberOfPixels - 1) * stdDev^3);
Related Question