![]() |
|
The MLE functions. Call them with an apop_model.
This file includes a number of distributions and models whose parameters one would estimate using maximum likelihood techniques.
It has (more-or-less) a single public function: apop_maximum_likelihood, and you don't even need to use that one, because the apop_estimate function defaults to using it if there is no model-specific estimation routine provided.
At the bottom are the maximum likelihood procedures themselves. There are four: Newton-type derivative methods, the no-derivative version, the with-derivative version, and the simulated annealing routine.
| void apop_estimate_parameter_t_tests | ( | apop_model * | est | ) |
For many, it is a knee-jerk reaction to a parameter estimation to test whether each individual parameter differs from zero. This function does that.
| est | The apop_estimate, which includes pre-calculated parameter estimates, var-covar matrix, and the original data set. |
Returns nothing. At the end of the routine, the est->parameters->matrix includes a set of t-test values: p value, confidence (=1-pval), t statistic, standard deviation, one-tailed Pval, one-tailed confidence.
| apop_mle_settings* apop_mle_settings_init | ( | apop_mle_settings | in | ) |
Initialize an apop_mle_settings struct.
| apop_data* apop_model_hessian | ( | apop_data * | data, | |
| apop_model * | model, | |||
| double | delta | |||
| ) |
Numerically estimate the matrix of second derivatives of the parameter values. The math is simply a series of re-evaluations at small differential steps. [Therefore, it may be expensive to do this for a very computationally-intensive model.]
| data | The data at which the model was estimated | |
| model | The model, with parameters already estimated | |
| delta | the step size for the differentials. The current default is around 1e-3. |
This function uses the Designated initializers syntax for inputs.
| apop_data* apop_model_numerical_covariance | ( | apop_data * | data, | |
| apop_model * | model, | |||
| double | delta | |||
| ) |
Produce the covariance matrix for the parameters of an estimated model via the derivative of the score function at the parameter. I.e., I find the second derivative via apop_model_hessian , and take the negation of the inverse.
I follow Efron and Hinkley in using the estimated information matrix---the value of the information matrix at the estimated value of the score---not the expected information matrix that is the integral over all possible data. See Pawitan 2001 (who cribbed a little off of Efron and Hinkley) or Klemens 2008 (who directly cribbed off of both) for further details.
| data | The data by which your model was estimated | |
| model | A model whose parameters have been estimated. | |
| delta | The differential by which to step for sampling changes. (default currently = 1e-3) |
model->covariance != NULL, I'll set it to the result as well.This function uses the Designated initializers syntax for inputs.
| apop_model apop_model_for_infomatrix |
{"Ad hoc model for working out the information matrix.",
.log_likelihood = apop_fn_for_infomatrix}