Question

Actually, I have a vector of real numbers (for example 1*300). I am looking for a snippet of code in c++ for fitting a probability distribution function to this vector.

Afterward, I want to use this pdf for calculating the probability of any entry of this vector. It is possible to create a histogram for this vector (which looks to be an easier solution), but I need to do quantization for that which I don't like that.

Even more, I have another vector of real numbers with the same size. I would like to fit a 2D joint probability for these two vectors. The result will be used similarly for calculating the probability of any joint entry of two vectors.

Thanks in advance for your replies.

Was it helpful?

Solution

I am looking for a snippet of code in c++ for fitting a probability distribution function to this vector.

If you want to fit a probability function to a given data, then you have two options.

Parametric methods.

To describe a probability you have to calculate a parameters that describes this probability. This can be done with method of moments or maximum likelihood method. Maximum likelihood is very flexible.

So usually we calculate estimation of mean and variance ( i.e. for normal distribution) from a given data and these parameters are enough to describe probability.

Non - parametric methods.

Transformation of cumulative distribution function is being fitted to data ( which may also need to be transformed).

examples

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top