Legofit
infers population history from nucleotide site patterns.
Macros | Functions
boot.h File Reference

Header for boot.c. More...

#include "typedefs.h"
#include <gsl/gsl_rng.h>

Go to the source code of this file.

Macros

#define DEF_BOOT_BLOCK_SIZE   500
 

Functions

BootBoot_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)
 

Detailed Description

Header for boot.c.

Author
Alan R. Rogers

Function Documentation

◆ Boot_add()

void Boot_add ( Boot self,
int  chr,
long  snpndx,
int  pat,
double  z 
)

Add one site pattern contribution to a Boot structure.

Parameters
[in,out]selfThe Boot structure to modify.
[in]chrThe index of the chromosome to modify.
[in]snpndxThe index of the current snp.
[in]patThe index of the current site pattern.
[in]zthe contribution of the snp to the site pattern.

References Boot_multiplicity(), Boot::count, Boot::cum, and Boot::nrep.

◆ Boot_aggregate()

void Boot_aggregate ( Boot self,
int  rep,
int  npat,
double  count[npat] 
)

Add to an array the site pattern counts from a bootstrap replicate.

Parameters
[in]selfPoints to a Boot object.
[in]theindex of the bootstrap replicate
[in]npatthe number of site patterns
[out]countAn array of doubles. The function will add to count[i] the contribution of site pattern i in bootstrap replicate rep.

References Boot::npat.

◆ confidenceBounds()

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.

Parameters
[out]lowBnd,highBndCalculated results will be written into these memory locations.
[in]confidenceFraction of sampling distribution that lies inside the confidence bounds.
[in]lenThe number of values inf v.
[in]vThe vector of values.
Side Effects:\n Sorts the vector v.