Patterns in static

Apophenia

Macros | Functions | Variables
apop_missing_data.c File Reference

Macros

#define Switch_back
 

Functions

apop_dataapop_data_listwise_delete (apop_data *d, char inplace)
 
apop_modelapop_ml_impute (apop_data *d, apop_model *mvn)
 

Variables

apop_modelapop_swap_model = &(apop_model){"Model with data and params swapped", .estimate=i_est, .p = i_p, .log_likelihood=i_ll, .constraint = i_constraint}
 

Detailed Description

Some missing data handlers.

Function Documentation

apop_data* apop_data_listwise_delete ( apop_data d,
char  inplace 
)

If there is an NaN anywhere in the row of data (including the matrix, the vector, the weights, and the text) then delete the row from the data set.

  • If every row has an NaN, then this returns NULL.
  • If apop_opts.nan_string is not NULL, then I will make case-insensitive comparisons to the text elements to check for bad data as well.
  • If inplace = 'y', then I'll free each element of the input data set and refill it with the pruned elements. I'll still take up (up to) twice the size of the data set in memory during the function. If every row has an NaN, then your apop_data set will end up with NULL vector, matrix, .... if inplace = 'n', then the original data set is left unmolested.
  • I only look at the first page of data (i.e. the more element is ignored).
  • This function uses the Designated initializers syntax for inputs.
Parameters
dThe data, with NaNs
inplaceIf 'y', clear out the pointer-to-apop_data that you sent in and refill with the pruned data. If 'n', leave the set alone and return a new data set. Default='n'.
Returns
A (potentially shorter) copy of the data set, without NaNs. If inplace=='y', a pointer to the input, which was shortened in place. If the entire data set is cleared out, then this will be NULL.
apop_model* apop_ml_impute ( apop_data d,
apop_model mvn 
)

Impute the most likely data points to replace NaNs in the data, and insert them into the given data. That is, the data set is modified in place.

How it works: this uses the machinery for apop_model_fix_params. The only difference is that this searches over the data space and takes the parameter space as fixed, while basic fix params model searches parameters and takes data as fixed. So this function just does the necessary data-parameter switching to make that happen.

Parameters
dThe data set. It comes in with NaNs and leaves entirely filled in.
mvnA parametrized apop_model from which you expect the data was derived. if NULL, then I'll use the Multivariate Normal that best fits the data after listwise deletion.
Returns
An estimated apop_ml_impute_model. Also, the data input will be filled in and ready to use.

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