I have a few data point, that I can interpolate into a distribution. I want to be able to generate points that follow this distribution, but Mathematica does not seem to be happy.
Here is my code:
data = {{-493.394, 2.68462}, {-439.841, 0.817059}, {-392.376,
8.56566}, {-346.081, 9.54882}, {-292.772, 21.9888}, {-245.355,
37.5084}, {-194.096, 55.3625}, {-147.557, 58.1818}, {-95.0778,
87.6094}, {-49.8689, 85.9708}, {5.78225, 99.1785}, {51.3327,
71.4299}, {103.873, 73.3692}, {151.79, 43.5556}, {203.562,
32.7452}, {248.295, 13.67}, {304.263, 10.4961}, {348.899,
5.15376}, {400.756, 4.98765}, {448.088, 0.95174}};
Then I interpolate it
interpolation = Interpolation[data]
Now, what I want is to define the distribution
pdf = ProbabilityDistribution[interpolation, {v, -480, 440}];
And finally generate the points:
newdata = RandomVariate[pdf, 1000]
Unfortunately, this gives this error.
InterpolatingFunction::nomthd: There is no method RandomType for InterpolatingFunction objects.
RandomVariate::udist: The specification
InterpolatingFunction[{{-493.394,448.088}},{5,7,0,{20},{4},0,0,0,0,Automatic,
{},{},False},<<1>>,{Developer`PackedArrayForm,{0,<<20>>},
{2.68462,0.817059,8.56566,9.54882,21.9888,37.5084,
<<9>>,13.67,10.4961,5.15376,4.98765,0.95174}},{Automatic}] is not a random
distribution recognized by the system.
What should I do? Just to clarify, I don't have the initial dataset, I just have the numerical values for the distribution.
Thanks,
Lina