1) How does Matlab's gamfit function estimate fit parameters for input data set?
2) Gamfit uses MLEs while another fitting function, ezfit, uses the least-squares method (minimizing sum of squared residuals). If the parameters I get from fitting the data with either of these functions are not the same, this means that, obviously, MLE and LSE methods are not equivalent in this case? So based on this inherent difference in data fitting, I cannot expect to relate the obtained parameters in some way? (i.e. multiplying fit parameters found by gamfit by a constant, squaring, or performing some other consistent math manipulation to get to the values found by ezfit?
Background (all discussed functions are attached):
On gamfit: As I understood, the data input to gamfit is first approximated to the Weibull distribution, with those parameters then entered into function statsfminbx on lines 256-259 and said function then "maximizes the log-likelihood with respect to a and b". This is not clear to me, could someone explain why Weibull estimation is necessary? Compared to the function below, it is not clear which PDF of the gamma distribution is used by Matlab, does anyone know where I can find this?
On ezfit: With this function, you specify exactly the PDF of the distribution you'd like to estimate the fit parameters for given your data, and it computes them by minimizing the sum of squared residuals (pretty straight forward, using Matlab's fminsearch function). This is the PDF of gamma distribution I am inputting to fit data with:
Note: Comparing the two functions (ezfit vs gamfit), the resulting shape parameters (alpha) are relatively on the same scale of magnitude, while scale parameter beta found with ezfit is on the order of 10e-3, while with gamfit it is on the order of 10e2.