Legofit
infers population history from nucleotide site patterns.
|
#include "typedefs.h"
#include <gsl/gsl_rng.h>
Go to the source code of this file.
Macros | |
#define | DEF_BOOT_BLOCK_SIZE 500 |
Functions | |
Boot * | Boot_new (int nchr, long nsnp[nchr], long nrep, int npat, long blocksize, gsl_rng *rng) |
Constructor for class Boot. | |
void | Boot_free (Boot *self) |
Destructor. | |
void | Boot_add (Boot *self, int chr, long snpndx, int pat, double z) |
Add one site pattern contribution to a Boot structure. More... | |
void | Boot_aggregate (Boot *self, int rep, int npat, double count[npat]) |
Add to an array the site pattern counts from a bootstrap replicate. More... | |
void | Boot_print (const Boot *self, FILE *ofp) |
Print a Boot object. | |
void | Boot_sanityCheck (const Boot *self, const char *file, int line) |
void | confidenceBounds (double *lowBnd, double *highBnd, double confidence, long len, double v[len]) |
Calculate confidence bounds from a vector of values representing samples drawn from the sampling distribution of some estimator. More... | |
unsigned | Boot_multiplicity_slow (Boot *self, long snp, long rep) |
Header for boot.c.
void Boot_add | ( | Boot * | self, |
int | chr, | ||
long | snpndx, | ||
int | pat, | ||
double | z | ||
) |
Add one site pattern contribution to a Boot structure.
[in,out] | self | The Boot structure to modify. |
[in] | chr | The index of the chromosome to modify. |
[in] | snpndx | The index of the current snp. |
[in] | pat | The index of the current site pattern. |
[in] | z | the contribution of the snp to the site pattern. |
References Boot_multiplicity(), Boot::count, Boot::cum, and Boot::nrep.
void Boot_aggregate | ( | Boot * | self, |
int | rep, | ||
int | npat, | ||
double | count[npat] | ||
) |
Add to an array the site pattern counts from a bootstrap replicate.
[in] | self | Points to a Boot object. |
[in] | the | index of the bootstrap replicate |
[in] | npat | the number of site patterns |
[out] | count | An array of doubles. The function will add to count[i] the contribution of site pattern i in bootstrap replicate rep. |
References Boot::npat.
void confidenceBounds | ( | double * | lowBnd, |
double * | highBnd, | ||
double | confidence, | ||
long | len, | ||
double | v[len] | ||
) |
Calculate confidence bounds from a vector of values representing samples drawn from the sampling distribution of some estimator.
To calculate the lower bound (*lowBnd), the function calculates the total probability mass in the tails (1 - confidence) and divides this into two equal parts to find p, the probability mass in each tail. It then estimates a value L such that a fraction p of the data values are less than or equal to L. To find this value, the function uses linear interpolation between the sorted list of data values.
The upper bound (*highBnd) is calculated in an analogous fashion.
[out] | lowBnd,highBnd | Calculated results will be written into these memory locations. |
[in] | confidence | Fraction of sampling distribution that lies inside the confidence bounds. |
[in] | len | The number of values inf v. |
[in] | v | The vector of values. |