1
$\begingroup$

Let's say I have some set of data which is not a "normal" distribution of data, meaning it does not hold a Gaussian, exponential, or other neat formulaic look. Here's an example of data where the PDF I want to create is based on the solid black line, within the red vertical lines: Histogram of data for creating PDF

Given that I already have the data, how can I create a PDF for this?

Next, I want to compare the data represented by the blue dots, and test whether it will look like the black line if I add some parameter. Say the black line is represented by $F(x)$ and the blue dots are represented by $G(x)$. I want to test:

$G(x) = P1*F(x)$

And I'd like to know what P1 is such that it is the best fit.

$\endgroup$
  • 1
    $\begingroup$ If P1 is any number other than 1, then G(x) won't be a PDF (probability density function - it won't integrate to 1). Might this question be better addressed at CrossValidated StackExchange first for the necessary statistical method and then back here for how that method might be implemented? $\endgroup$ – JimB Jul 5 '17 at 14:46
3
$\begingroup$

If one doesn't know the functional form of a pdf and has a fair amount of data, then a nonparametric density estimate is definitely the way to go. (Finding a parametric density with a parsimonious number of parameters doesn't help if the fit is poor.)

Here is some generated data somewhat similar to what you have above:

data = 18 + 100 RandomVariate[BetaDistribution[1, 1.6], 1000];
Histogram[data, {4}]

Histogram of sample data

A nonparametric density estimate for such bounded data is found as follows:

skd = SmoothKernelDistribution[data, Automatic, {"Bounded", {15, 120}, "Gaussian"}];
Plot[PDF[skd, x], {x, 15, 120}, PlotRange -> {{15, 120}, {0, .015}}]

Nonparametric density estimate

Another estimated pdf can be constructed from the second set of data and plotted on the same figure. (Much cleaner and useful than attempting to overlay histograms.)

$\endgroup$
  • $\begingroup$ Thank you so much! For what it's worth, I did: Histogram[data, Automatic,"PDF"] to be able to compare to the generated PDF in the same plot. $\endgroup$ – Matt Stein Jul 5 '17 at 20:11

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.