vg
tools for working with variation graphs
Namespaces | Functions
statistics.cpp File Reference
#include "statistics.hpp"

Namespaces

 vg
 

Functions

double vg::median (std::vector< int > &v)
 
void vg::wellford_update (size_t &count, double &mean, double &M2, double new_val)
 
pair< double, double > vg::wellford_mean_var (size_t count, double mean, double M2, bool sample_variance)
 
double vg::Phi (double x)
 The standard normal cumulative distribution function. More...
 
double vg::Phi_inv (double quantile)
 Inverse CDF of a standard normal distribution. Must have 0 < quantile < 1. More...
 
double vg::lognormal_pdf (double x, double mu, double sigma)
 Probability density function or log-normal distribution. More...
 
double vg::slope (const std::vector< double > &x, const std::vector< double > &y)
 
double vg::fit_zipf (const vector< double > &y)
 
double vg::fit_fixed_shape_max_exponential (const vector< double > &x, double shape, double tolerance=1e-8)
 Returns the MLE rate parameter for the distribution of (shape) iid exponential RVs. More...
 
double vg::fit_fixed_rate_max_exponential (const vector< double > &x, double rate, double tolerance=1e-8)
 Returns the MLE estimate for the number of iid exponential RVs the data are maxima of. More...
 
pair< double, double > vg::fit_max_exponential (const vector< double > &x, double tolerance=1e-8)
 Returns the MLE rate and shape parameters of a max exponential. More...
 
double vg::max_exponential_log_likelihood (const vector< double > &x, double rate, double shape, double location=0.0)
 The log likelihood of a max exponential with the given parameters on the given data. More...
 
pair< double, double > vg::fit_weibull (const vector< double > &x)
 Returns an estimate of the rate and shape parameters of a Weibull distribution. More...
 
tuple< double, double, double > vg::fit_offset_weibull (const vector< double > &x, double tolerance=1e-8)
 Returns an estimate of the rate, shape, and location (minimum value) of a 3-parameter Weibull distribution. More...
 
double vg::weibull_log_likelihood (const vector< double > &x, double scale, double shape, double location=0.0)
 Returns the log likelihood of some data generated by a Weibull distribution. More...
 
double vg::golden_section_search (const function< double(double)> &f, double x_min, double x_max, double tolerance=1e-8)
 Returns a local maximum of a function within an interval. More...
 
double vg::phred_to_prob (uint8_t phred)
 Convert 8-bit Phred quality score to probability of wrongness, using a lookup table. More...
 
double vg::phred_for_at_least_one (size_t p, size_t n)
 
double vg::prob_for_at_least_one (size_t p, size_t n)
 
vector< vector< double > > vg::transpose (const vector< vector< double >> &A)
 A shitty set of linear algebra functions. More...
 
vector< vector< double > > vg::matrix_multiply (const vector< vector< double >> &A, const vector< vector< double >> &B)
 
vector< double > vg::matrix_multiply (const vector< vector< double >> &A, const vector< double > &b)
 
vector< vector< double > > vg::matrix_invert (const vector< vector< double >> &A)
 
vector< double > vg::regress (const vector< vector< double >> &X, vector< double > &y)
 Returns the coefficients of a regression (does not automatically compute constant) More...
 

Detailed Description

Contains implementations of statistical functions