![]() |
|
Most of these distributions are typically used for testing purposes. For such a situation, you don't need the models here. Given a statistic of the right properties, you can find the odds that the statistic is above or below a cutoff on the t-, F, or chi-squared distribution using the apop_test function.
In that world, those three distributions are actually parameter free. The data is assumed to be normalized to be based on a mean zero, variance one process, you get the degrees of freedom from the size of the data, and the distribution is fixed.
For modeling purposes, more could be done. For example, the t-distribution is a favorite proxy for Normal-like situations where there are fat tails relative to the Normal (i.e., high kurtosis). Or, you may just prefer not to take the step of normalizing your data---one could easily rewrite the theorems underlying the t-distribution without the normalizations.
In such a case, the researcher would not want to fix the
, because
indicates the fatness of the tails, which has some optimal value given the data. Thus, there are two modes of use for these distributions:
apop_data *t_for_testing = apop_estimate(data, apop_t)
---will return exactly the type of
-distribution one would use for testing. For the Wishart distribution, the
is fixed in this form, but the covariance matrix is estimated from the data.
via maximum likelihood.Apop_settings_add_group(&apop_t, apop_mle, data); apop_data *t_for_description = apop_estimate(data, apop_t);
df works for all four distributions here; df2 makes sense only for the
,
For the Wishart, the degrees of freedom and covariance matrix are always estimated via MLE.
The
distribution, for descriptive purposes. If you want to test a hypothesis, you probably don't need this, and should instead use apop_test. See notes in t-, chi-squared, F-, Wishart distributions.
The F distribution, for descriptive purposes. If you want to test a hypothesis, you probably don't need this, and should instead use apop_test. See notes in t-, chi-squared, F-, Wishart distributions.
The t distribution, for descriptive purposes. If you want to test a hypothesis, you probably don't need this, and should instead use apop_test. See notes in t-, chi-squared, F-, Wishart distributions.
The Wishart distribution, which is currently somewhat untested.
Here's the likelihood function.
is the dimension of the data and covariance matrix,
is the degrees of freedom,
is the
matrix of Wishart parameters, and
is the
matrix whose likelihood is being evaluated.
is the multivariate gamma function.

An example for random draws:
gsl_matrix *rmatrix = gsl_marix_alloc(10, 10); gsl_rng *r = apop_rng_alloc(8765); for (int i=0; i< 1e8; i++){ apop_draw(rmatrix->data, r, apop_wishart); do_math_with_matrix(rmatrix); }
See also notes in t-, chi-squared, F-, Wishart distributions.