moving a histogram to correct skewness

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 commentaires

the cyclist
the cyclist le 17 Août 2012
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 le 17 Août 2012
Modifié(e) : José-Luis le 17 Août 2012
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!

Connectez-vous pour commenter.

Réponses (2)

José-Luis
José-Luis le 17 Août 2012
You can use a boxcox transform to make your data normal.
http://www.mathworks.se/help/toolbox/finance/boxcox.html
Cheers!

6 commentaires

zozo
zozo le 17 Août 2012
I cannot use boxcox since my data has both +ve and -ve values. boxcox accepts only +ve data! :(
José-Luis
José-Luis le 17 Août 2012
Modifié(e) : José-Luis le 17 Août 2012
Well, offset your data first and then do the transform. But as the cyclist said, it all depends of what you want to do.
Cheers!
zozo
zozo le 17 Août 2012
The histogram is from a signal. And Iam trying to denoise the signal using the percentage area on left and right to generate threshold limits(as shown in the title of subplot(313)). In above figure, I threholded using same percentage (say 6% on left and right). Now I would like to update my area (on left or right) depending on skewness (left skewed or right skewed)
José-Luis
José-Luis le 17 Août 2012
Let me get this straight. You want to filter your signal so your so your skew is 0? The skew is very sensitive to values that are away from the mean. It's all those high positive peaks that are giving the skew. You could place a threshold on high values as well, instead of only a minimum. Not entirely sure that's what you want though... Percentage are on the left and right of what? Of the maximum and minimum values?
zozo
zozo le 17 Août 2012
Modifié(e) : zozo le 17 Août 2012
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 le 17 Août 2012
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!

Connectez-vous pour commenter.

Image Analyst
Image Analyst le 17 Août 2012

0 votes

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.

Question posée :

le 17 Août 2012

Community Treasure Hunt

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

Start Hunting!

Translated by