moving a histogram to correct skewness

3 次查看(过去 30 天)
zozo
zozo 2012-8-17
I have the following histogram:
If x is a vector containing my dataset,
k=skewness(x,0); %skewness of data-set with bias correction
I plotted the above histogram as:
[bin,xout]=hist(x,200); %%s1 original%%%histogram of filtered signal
bin=bin./max(bin); %normalise histogram bins to max. bin
bar(xout,bin);
How do I move my histogram to correct the bias in skewness so that my histogram is now modified to skewness=0?
addtional info
I am taking the area (say 4%) of the total histogram area on either side of histogram. But since in this case, the right side is more compared to the left, I would like to update(increase) my % area on right side in accordance to the skewness value so that it is balanced. How can I achience this?
Please help
  2 个评论
the cyclist
the cyclist 2012-8-17
I'm not sure what you mean by "move" your histogram. Do you mean just translate by a constant x0, left or right? That will not affect the skewness.
Maybe you should describe what it really is that you are trying to achieve with your data.
José-Luis
José-Luis 2012-8-17
编辑:José-Luis 2012-8-17
If you want your histogram to look different then you need to transform your data. The boxcox transform will (hopefully) make your data normal, i.e. skew = 0. It is available from the financial toolbox. If you don't have it you can try to do a power transform of your data (positive or negative depending on whether your data is skewed to the left or the right) and test again.
Cheers!

请先登录,再进行评论。

回答(2 个)

José-Luis
José-Luis 2012-8-17
You can use a boxcox transform to make your data normal.
http://www.mathworks.se/help/toolbox/finance/boxcox.html
Cheers!
  6 个评论
zozo
zozo 2012-8-17
编辑:zozo 2012-8-17
I want to reduce only the small peaks near the baseline and withhold the large peaks. % area on left => area from the beginning of histogram till it reaches 6% of the total area. Similarly on the right. I somehow want to update my %area on left and right (which is equal as of now) according to the skewness value( if right skewed=+1.48, %area on the right would be large compared to the left). Is there some math relation or idea u can suggest?
José-Luis
José-Luis 2012-8-17
I don't understand what you are trying to achieve. If you want to keep your large peaks and get rid of the skew, then you have to transform your data. Maybe smoothing it out would work as well. You could either smooth out the data using, some sort of moving average. Or you could smooth out your histogram, using Matlab's ksdensity. Sorry i can't be of more help but i really don't get what you want to do.
Cheers!

请先登录,再进行评论。


Image Analyst
Image Analyst 2012-8-17
I'm not sure why you want to do this, but if you have an image, you can use my histogram shaping routine to make it whatever shape you want: http://www.mathworks.com/matlabcentral/fileexchange/28972-custom-shaped-histogram Of course a 1D vector could also be considered a number.
Basically it will change your input data so that when you take its histogram, it will now be the shape that you specified.

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by