Patterns in static

Apophenia

Macros | Functions | Variables
apop_model.c File Reference

Functions

apop_modelapop_model_clear (apop_data *data, apop_model *model)
 
void apop_model_free (apop_model *free_me)
 
void apop_model_print (apop_model *print_me, FILE *ap)
 
void apop_model_show (apop_model *print_me)
 
apop_modelapop_model_copy (apop_model *in)
 
apop_modelapop_model_set_parameters_base (apop_model *in, double ap[])
 
apop_modelapop_estimate (apop_data *d, apop_model *m)
 
double apop_p (apop_data *d, apop_model *m)
 
double apop_log_likelihood (apop_data *d, apop_model *m)
 
void apop_score (apop_data *d, gsl_vector *out, apop_model *m)
 
 Apop_settings_init (Apop_settings_copy(apop_pm, Apop_varad_set(rng, NULL);Apop_varad_set(draws, 1e4);)
 
apop_modelapop_parameter_model (apop_data *d, apop_model *m)
 
int apop_model_metropolis_draw (double *out, gsl_rng *rng, apop_model *params)
 
int apop_draw (double *out, gsl_rng *r, apop_model *m)
 
void apop_prep (apop_data *d, apop_model *m)
 
apop_dataapop_predict (apop_data *d, apop_model *m)
 
double apop_cdf (apop_data *d, apop_model *m)
 
 Apop_settings_init (apop_cdf, Apop_varad_set(draws, 1e4);Apop_varad_set(rng, NULL);out->draws_refcount=malloc(sizeof(int));*out->draws_refcount=1;) Apop_settings_free(apop_cdf
 
 if (in->draws_made &&!--*in->draws_refcount) gsl_matrix_free(in-> draws_made)
 
 apop_model_free (in->cdf_model)
 

Variables

apop_modelapop_swap_model
 

Detailed Description

sets up the estimate structure which outputs from the various regressions and MLEs.

Function Documentation

int apop_model_metropolis_draw ( double *  out,
gsl_rng *  rng,
apop_model model 
)

The draw method for models estimated via apop_model_metropolis.

That method produces an apop_pmf, typically with a few thousand draws from the model in a batch. If you want to get a single next step from the Markov chain, use this.

A Markov chain works by making a new draw and then accepting or rejecting the draw. If the draw is rejected, the last value is reported as the next step in the chain. Users sometimes mitigate this repetition by making a batch of draws (say, ten at a time) and using only the last.

If you run this without first running apop_model_metropolis, I will run it for you, meaning that there will be an initial burn-in period before the first draw that can be reported to you. That run is done using model->data as input.

Parameters
outAn array of doubles, which will hold the draw, in the style of apop_draw.
rngA gsl_rng, already initialized, probably via apop_rng_alloc.
modelA model which was probably already run through apop_model_metropolis.
Returns
On return, out is filled with the next step in the Markov chain. The ->data element of the PMF model is extended to include the additional steps in the chain. If a proposal failed the model constraints, then return 1; else return 0. See the notes in the documentation for apop_model_metropolis.
  • After pulling the attached settings group, the parent model is ignored. One expects that base_model in the mcmc settings group == the parent model.
  • If your settings break the model parameters into several chunks, this function returns after stepping through all chunks.

Autogenerated by doxygen on Wed Oct 15 2014 (Debian 0.999b+ds3-2).