1
$\begingroup$

Data fitting is the process of fitting models to data and analyzing the accuracy of the fit. The models consist of common probability distribution (e.g. normal distribution). The data are two-dimensional arrays.

I want to know is there a way to do data fitting with a multivariate probability distribution function? I am familiar with both MATLAB and Python.

Also if there is an answer in R for it, it would help me.

$\endgroup$
4
  • $\begingroup$ I have used an R package to fit bivariate poisson in the past bivpois. I know there are packages for bivariate conway maxwell poisson too $\endgroup$
    – Fierce82
    Apr 24 at 9:14
  • $\begingroup$ @Fierce82 Is there any package in R that fits the PDF to data and shows which one has the best match? $\endgroup$
    – MOSTAJKIR
    Apr 24 at 10:36
  • $\begingroup$ check this excellent answer here stats.stackexchange.com/questions/132652/… $\endgroup$
    – Fierce82
    Apr 24 at 11:22
  • $\begingroup$ @Fierce82 I read the link. What is the link tries to say is about one-dimensional value. There is no information about fitting to multivariate probability distribution function. $\endgroup$
    – MOSTAJKIR
    Apr 24 at 12:50
1
$\begingroup$

First of all, it's not data fitting, but model fitting, since you fit a model to the data, not the other way around.

By fitting a model to the data, we mean finding such parameters of the model that make the model the most aligned with the data that it is trying to approximate. There are many ways of doing that, for example, you can minimize some kind of loss function between predictions made by a model and the data, but with a model defined in terms of a probability distribution, the more natural approach is to use maximum likelihood estimation, or Bayesian approach.

If the probability density function of your distribution if $f(\mathbf{X}, \theta)$, where $\theta$ is a parameter or a vector of parameters, for the distribution, then with the maximum likelihood you would use an optimizer to find

$$ \underset{\theta}{\operatorname{arg\,max}} \;\sum_i \,\log f(\mathbf{X}_i, \theta) $$

Technically, this is as simple as plugging in the likelihood function to optimizer function like R's optim. You can find an in-depth explanation and many worked examples in the link above.

$\endgroup$
2
  • $\begingroup$ I think I can't express my problem: There are data in two dimensional. There are bi-PDFs. I want to find which bi-PDF is good for this data. I think you say: There is a bi-PDF that must be fitted to data. Am I wrong? $\endgroup$
    – MOSTAJKIR
    Apr 24 at 18:07
  • $\begingroup$ @MOSTAJKIR you can still compare the likelihoods of different model, or even use a likelihood ratio test if you want to be more formal. $\endgroup$
    – Tim
    Apr 26 at 13:54

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.