1
$\begingroup$

I'm plotting, in python (not related with this question), an histogram of 3200 made up weights and I'm told to compare it to a normal distribution.

image not needed but I guess helpful

The thing is I wanted to make the same plot but this time I didn't want to normalize the data. I figured out that if, to normalize the histogram, I divided every weight in 3200, maybe if I multiplied the Gaussian function by 3200 I'd get the plot I wanted. Turns out I got something like this:

enter image description here

I've been looking for an answer for hours, but since I've been working on this assignment all day I guess I can't really think outside the box. How should I treat the function so the peak matches the histogram? Why the multiplication by 3200 doesn't solve the issue? (that's my real question).

$\endgroup$
2
  • 5
    $\begingroup$ The Gaussian function is a probability density, so you need to multiply by the bin width to get a probability (and then multiply the Pr by the # data points, to get a count of "points/bin", rather than "points/kg"). Your Gaussian on the bottom looks finer-sampled, with multiple points per histogram bin, so this may be the issue? (e.g. multiply by 5 kg?) $\endgroup$
    – GeoMatt22
    Commented Apr 15, 2017 at 4:17
  • $\begingroup$ @GeoMatt That's a fine answer--why not post it as such? $\endgroup$
    – whuber
    Commented Apr 15, 2017 at 14:18

1 Answer 1

4
$\begingroup$

The Gaussian function is a probability density, so you need to multiply by the bin width to get a probability (and then multiply the Pr by the # data points, to get a count of "points/bin", rather than "points/kg").

Your Gaussian on the bottom looks finer-sampled, with multiple points per histogram bin, so this may be the issue?

In other words

$$\frac{80 \text{ points}}{\text{kg}}\times\frac{5\text{ kg}}{\text{bin}} = \frac{400 \text{ points}}{\text{bin}}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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