-1
$\begingroup$

I would like to make a SmoothHistogram of some data. Inside SmoothHistogram I want to use the option "PDF" to show then distribution of data. As of my knowledge, in a PDF function, the integral under the curve equals 1. This is what I want, however, my y-axis values in SmoothHistogram are much too large.

data={0.153457, 0.169579, 0.19935, 0.224533, 0.108625, 0.229975, 0.184321, \
0.122864, 0.215802, 0.337952, 0.286443, 0.259728, 0.414498, 0.199196, \
0.266116, 0.114337, 0.330806, 0.156401, 0.181194, 0.135593, 0.228657, \
0.400646, 0.292136, 0.437125, 0.21675, 0.229839, 0.379615, 0.220315, \
0.246973, 0.158653, 0.198648, 0.286902, 0.208426, 0.231079, 0.133473, \
0.211609, 0.159706, 0.155913, 0.25107, 0.203233, 0.177335, 0.354139, \
0.236015, 0.373966, 0.40232, 0.194855, 0.350513, 0.233385, 0.234951, \
0.279452}

SmoothHistogram[data , Automatic, "PDF"]

enter image description here

As you can see, the y-axis is >1, which is not possible in a PDF function.

Many thanks in advance!

$\endgroup$

closed as off-topic by corey979, happy fish, Wjx, J. M. will be back soon Apr 6 '17 at 14:40

  • The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ "...$y$-axis is $>1$, which is not possible in a PDF function..." - well... Plot[PDF[NormalDistribution[0, 1/20], x] // Evaluate, {x, -3, 3}, PlotRange -> All] $\endgroup$ – J. M. will be back soon Apr 6 '17 at 8:30
  • 2
    $\begingroup$ The integral of the curve could still be 1, I dont see a problem there. $\endgroup$ – Mauricio Fernández Apr 6 '17 at 8:30
  • $\begingroup$ I agree! Sorry. Then I want something else. I want on the y-axis to be shown the fraction that a specific x data point has out of the total data. Maybe SmoothHistogram is the wrong representation altogether. $\endgroup$ – Niki Apr 6 '17 at 8:35
  • 1
    $\begingroup$ PDF is the probability density function. There is no reason it should not be greater than 1 at some point. Say, ff it's equal to 5 in a strip with width 0.1, it means that there is 0.5 probability that the RV will fall into that strip. The total probability, of all possibilities, is equal to 1, like in the example. From your description it seems you want the option "Probability" like in Mauricio's answer. However, this is not a valid option for a SmoothHistogram, so you might need to construct your own function. $\endgroup$ – corey979 Apr 6 '17 at 9:30
  • 3
    $\begingroup$ I'm voting to close this question as off-topic because the OP didn't grasp the underlying maths. $\endgroup$ – corey979 Apr 6 '17 at 9:31
2
$\begingroup$

How about this?

Histogram[data, 20, "Probability"]

enter image description here

$\endgroup$

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