I have a histogram representing the PDF of an unknown discrete RV. The histogram is asymmetrical. To be clear, all I have is the histogram. Is there a known way to increase/decrease the variance of the distribution (i.e. scaling it on the x-axis) while retaining other shape characteristics as much as possible? Preserving the Mean is most important to me.

If there is a way, what would be a good numerical recipe for an efficient implementation?

I went over this Wiki article and also looked on-line, mostly around this approach and its derivatives which aim to minimize deviating from the input histogram in terms of shape.



A histogram represents probability density by height and probability by area.

To rescale and shift the data it represents, merely rescale and shift the numbers on the value axis. When this happens, the old standard deviation of $s$ is changed to a new standard deviation of $t$, thereby multiplying all the bases of the histogram bars by $t/s$. To keep their areas the same, their heights must be multiplied by $s/t$ to compensate.

This leads to a simple procedure. Begin with the original histogram.

  1. Clearly mark the mean at $m$.

  2. Put ticks on the value axis that are one standard deviation $s$ apart, starting at $m$, so that they are located at values $\ldots,m−2s,m−s,m,m+s,m+2s,\ldots$.

  3. Erase the actual numbers on the value axis.

  4. Relabel the ticks with the numbers $\ldots,m−2t,m−t,m,m+t,m+2t,\ldots$.

  5. If the other axis is a density (which technically it should be), multiply all its values by $s/t$. (Sometimes people show the frequencies or raw counts on the other axis. In those cases, do not change its labels.)



The left plot in this figure is the original histogram. It shows the densities of data having a mean of $5$ and standard deviation $s=2.28$. The middle plot relabels the value axis at the mean and multiples of the standard deviation from it. The right plot converts those values to the desired new mean (still $5$) and new standard deviation (set to $t=4$ in this example). Because the vertical axis shows densities, they have been multiplied by the ratio $s/t = 2.82/4 = 0.594$.

Note that all three plots are graphically identical: only the axis labels are changed.

  • $\begingroup$ A comprehensive and thorough answer, Thank you @whuber. However, while these plots are graphically identical, what I want is a method to spread the distribution on a unified scale -- i.e. let the axis itself "sit still" and have the mass spread around along the same exact x-axis. I realize this of course will change the shape, as indicated in the original question. Could you, in the spirit of such great a reply, supply such a method? $\endgroup$ – Reinstate Monica Jan 27 '15 at 8:14
  • $\begingroup$ I'm afraid you should refresh some math, @SkepticalEmpiricist; what you are asking for would change the distribution, which in turn means that it would imply adding data in the corresponding bins, which in turn means a new sampling process. No transformation possible. But why would you need what you ask for, in the first place? $\endgroup$ – ocramz Jan 28 '15 at 11:41
  • $\begingroup$ Correct @ocramz! The distribution is to change, and so a different underlying sampling process is indeed implied. It is a new and different distribution now, as you would know simply by the fact it has a different variance. Now, all I am looking for is a way to make it evident, by using the same scale/resolution of bins. You are also correct that mass/bins data is to be modified (some sort of interpolation between neighboring bins could be considered). I need to do so, in the first place, in order to numerically fit a "fatter"/"thinner" distribution to my set of data. $\endgroup$ – Reinstate Monica Jan 28 '15 at 11:59
  • $\begingroup$ @Skeptical This solution accomplishes exactly what you ask for. What you seem to be missing is that the beginning and ending histograms are drawn on different value scales. If you wish to compare them on the same scale, then one of them has to be (visually) expanded around its mean. The relabeling of the value axis has already accomplished the expansion you desire. $\endgroup$ – whuber Jan 28 '15 at 14:36
  • $\begingroup$ @whuber I beg to differ: What i'm asking for is a numerical method to visually expand the distribution. I fully acknowledge the two differing location axes (as I am directly referring to it above) and two differing value axes as well. I most certainly wish to compare them on the same scale and I believe that is easily evident more than once in the above discussion. I greatly appreciate your contribution nonetheless. $\endgroup$ – Reinstate Monica Jan 28 '15 at 15:35

1) Subtract the mean ("center" the RV),

2) divide by the std.dev. ("standardize", for multivariate data you need the SVD of the covariance matrix),

3) multiply by the new std. dev.,

4) add the mean.

  • $\begingroup$ I should mention that this technique is exact only for Gaussian distributions, or those that are described by the same (2) number of moments. $\endgroup$ – ocramz Jan 25 '15 at 17:35
  • 2
    $\begingroup$ (+1) Could you elaborate on this mysterious comment? Normally, the "shape" of a distribution consists of all properties not changed by shifts of locations or (positive) changes of scale. Because your recipe only involves location and scale changes, this makes it "exact" for all distributions that have finite standard deviations. Gaussians, moments, and parametrized families of distributions have no bearing on this. $\endgroup$ – whuber Jan 25 '15 at 21:06
  • $\begingroup$ @ocramz I edited the question, in hope it will be clearer now, as I'm afraid it had previously implied that I have the RV. All I have is the distribution data stored in a histogram. $\endgroup$ – Reinstate Monica Jan 26 '15 at 8:02
  • $\begingroup$ This solution remains correct for histograms. $\endgroup$ – whuber Jan 26 '15 at 10:43
  • $\begingroup$ Hi @whuber, Then maybe I'm missing something -- what is meant by dividing and multiplying as in (1) and (2)? Is going over the histogram and divide/multiply each cell suppose to make the distribution narrower/wider? $\endgroup$ – Reinstate Monica Jan 26 '15 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.