0
$\begingroup$

I have some data, and I used SmoothHistogram to obtain a curve.

enter image description here

Now I would like to pick up several points on the curve such that I can fit this curve to a function. I get stuck with picking up points. Can anyone help me with this?

$\endgroup$
3
  • $\begingroup$ Post the code you used to generate the plot please. $\endgroup$ – Bob Brooks Nov 21 '17 at 14:58
  • 1
    $\begingroup$ What function do you have in mind? I ask for two reasons: (1) If you have some particular probability density function in mind, you'd be better off using the original data and use maximum likelihood and (2) If you're considering a regression, note that the variance about the curve will not be equal across all values (which is usually the default assumption for most regression functions). $\endgroup$ – JimB Nov 21 '17 at 15:46
  • 1
    $\begingroup$ If your raw data is in x, then you can generate a list of points with skd = SmoothKernelDistribution[x]; Table[{y, PDF[skd, y]}, {y, 0, 10, 0.01}] (but adjusting the y values to match what you need). That way you have explicit control as to the values of y that you want the pdf to be evaluated. $\endgroup$ – JimB Nov 21 '17 at 15:50
1
$\begingroup$

If you just want the points, you can get them out of the Graphics object (remember that everything in Mathematica is a list of lists):

rands=RandomReal[1, 1000];
pts=SmoothHistogram[rands][[1, 2, 1, 3, 3, 1]]
ListPlot[pts]

ListPlot of the smoothed histogram points

$\endgroup$

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.