StochHMM  v0.34
Flexible Hidden Markov Model C++ Library and Application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
Probability Density Functions

Functions

double StochHMM::binomial_pdf (int k, int n, double p)
double StochHMM::binomial_pdf (int k, std::vector< double > param)
double StochHMM::beta_binomial_pdf (int k, int n, double a, double b)
double StochHMM::degenerate_pdf (double value, double k)
double StochHMM::discrete_uniform_pdf (int position, int a, int b)
double StochHMM::hypergeometric_pdf (int k, int n, int N, int m)
double StochHMM::poisson_binomial_pdf (int k, std::vector< double > &p)
double StochHMM::beta_negative_binomial_pdf (int k, int n, double a, double b)
double StochHMM::maxwell_boltzman_pdf (double x, double a)
double StochHMM::geometric_pdf (int k, double p)
double StochHMM::logarithmic_pdf (int k, double p)
double StochHMM::negative_binomial_pdf (int k, int r, double p)
double StochHMM::poisson_pdf (int k, double lambda)
double StochHMM::yule_simon_pdf (int k, double p)
double StochHMM::zipf_pdf (int k, int N, double s)
double StochHMM::zipf_mandelbrot_pdf (int k, int N, double s, double q)
double StochHMM::arcsine_pdf (double x)
double StochHMM::beta_pdf (double x, double a, double b)
double StochHMM::beta_pdf (double x, std::vector< double > param)
double StochHMM::logit_normal_pdf (double x, double mu, double sigma)
double StochHMM::continuous_uniform_pdf (double x, double a, double b)
double StochHMM::kumaraswamy_pdf (double x, double a, double b)
double StochHMM::raised_cosine_pdf (double x, double mu, double s)
double StochHMM::triangular_pdf (double x, double a, double b, double c)
double StochHMM::truncated_normal_pdf (double x, double mu, double sd, double a, double b)
double StochHMM::u_quadratic_pdf (double x, double a, double b)
double StochHMM::wigner_semicircle_pdf (double x, double r)
double StochHMM::beta_prime_pdf (double x, double a, double b)
double StochHMM::chi_pdf (double x, double k)
double StochHMM::chi_squared_pdf (double x, double k)
double StochHMM::inverse_chi_squared_pdf (double x, double v)
double StochHMM::scaled_inverse_chi_squared_pdf (double x, double v, double sigma_sqrd)
double StochHMM::dagum_pdf (double x, double p, double a, double b)
double StochHMM::exponential_pdf (double x, double lambda)
double StochHMM::f_pdf (double x, double d1, double d2)
double StochHMM::fishers_z_pdf (double x, double d1, double d2)
double StochHMM::folded_normal_pdf (double x, double mu, double sigma_sqrd)
double StochHMM::frechet_pdf (double x, double alpha, double s, double m)
double StochHMM::gamma_pdf (double x, double alpha, double beta)
double StochHMM::inv_gamma_pdf (double x, double alpha, double beta)
double StochHMM::half_normal_pdf (double x, double sigma)
double StochHMM::inv_gaussian_pdf (double x, double mu, double lambda)
double StochHMM::levy_pdf (double x, double mu, double scale)
double StochHMM::log_cauchy_pdf (double x, double mu, double sigma)
double StochHMM::log_laplace_pdf (double x, double mu, double b)
double StochHMM::log_logistic_pdf (double x, double a, double b)
double StochHMM::log_normal_pdf (double x, double mu, double sigma_sqrd)
double StochHMM::pareto_pdf (double x, double alpha, double x_m)
double StochHMM::nakagami_pdf (double x, double mu, double w)
double StochHMM::rayleigh_pdf (double x, double sigma)
double StochHMM::gumbel_type_two_pdf (double x, double a, double b)
double StochHMM::weibull_distribution (double x, double lambda, double k)
double StochHMM::cauchy_pdf (double x, double x_o, double gamma)
double StochHMM::gumbel_pdf (double x, double mu, double beta)
double StochHMM::generalized_normal_pdf (double x, double mu, double alpha, double beta)
double StochHMM::hyperbolic_secant_pdf (double x)
double StochHMM::laplace_pdf (double x, double mu, double b)
double StochHMM::logistic_pdf (double x, double mu, double s)
double StochHMM::standard_normal_pdf (double x)
double StochHMM::normal_pdf (double x, double mu, double sigma)
double StochHMM::students_t_pdf (double x, double v)
double StochHMM::gumbel_type_one_pdf (double x, double a, double b)
double StochHMM::generalized_extreme_value_pdf (double x, double mu, double sigma, double xi)
double StochHMM::generalized_pareto_pdf (double x, double mu, double sigma, double xi)
double StochHMM::dirichlet_pdf (const std::vector< double > &x, const std::vector< double > &alpha)
double StochHMM::multivariate_ewens_pdf (const std::vector< double > &x, const double theta)
double StochHMM::binomial_pdf (const double k, const std::vector< double > *param)
double StochHMM::beta_binomial_pdf (const double k, const std::vector< double > *param)
double StochHMM::degenerate_pdf (const double value, const std::vector< double > *param)
double StochHMM::discrete_uniform_pdf (const double position, const std::vector< double > *param)
double StochHMM::hypergeometric_pdf (const double k, const std::vector< double > *param)
double StochHMM::beta_negative_binomial_pdf (const double k, const std::vector< double > *param)
double StochHMM::maxwell_boltzman_pdf (const double x, const std::vector< double > *param)
double StochHMM::geometric_pdf (const double k, const std::vector< double > *param)
double StochHMM::logarithmic_pdf (const double k, const std::vector< double > *param)
double StochHMM::negative_binomial_pdf (const double k, const std::vector< double > *param)
double StochHMM::poisson_pdf (const double k, const std::vector< double > *param)
double StochHMM::yule_simon_pdf (const double k, const std::vector< double > *param)
double StochHMM::zipf_pdf (const double k, const std::vector< double > *param)
double StochHMM::zipf_mandelbrot_pdf (const double k, const std::vector< double > *param)
double StochHMM::arcsine_pdf (const double x, const std::vector< double > *param)
double StochHMM::beta_pdf (const double x, const std::vector< double > *param)
double StochHMM::logit_normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::continuous_uniform_pdf (const double x, const std::vector< double > *param)
double StochHMM::kumaraswamy_pdf (const double x, const std::vector< double > *param)
double StochHMM::raised_cosine_pdf (const double x, const std::vector< double > *param)
double StochHMM::triangular_pdf (const double x, const std::vector< double > *param)
double StochHMM::truncated_normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::u_quadratic_pdf (const double x, const std::vector< double > *param)
double StochHMM::wigner_semicircle_pdf (const double x, const std::vector< double > *param)
double StochHMM::beta_prime_pdf (const double x, const std::vector< double > *param)
double StochHMM::chi_pdf (const double x, const std::vector< double > *param)
double StochHMM::chi_squared_pdf (const double x, const std::vector< double > *param)
double StochHMM::inverse_chi_squared_pdf (const double x, const std::vector< double > *param)
double StochHMM::scaled_inverse_chi_squared_pdf (const double x, const std::vector< double > *param)
double StochHMM::dagum_pdf (const double x, const std::vector< double > *param)
double StochHMM::exponential_pdf (const double x, const std::vector< double > *param)
double StochHMM::f_pdf (const double x, const std::vector< double > *param)
double StochHMM::fishers_z_pdf (const double x, const std::vector< double > *param)
double StochHMM::folded_normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::frechet_pdf (const double x, const std::vector< double > *param)
double StochHMM::gamma_pdf (const double x, const std::vector< double > *param)
double StochHMM::inv_gamma_pdf (const double x, const std::vector< double > *param)
double StochHMM::half_normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::inv_gaussian_pdf (const double x, const std::vector< double > *param)
double StochHMM::levy_pdf (const double x, const std::vector< double > *param)
double StochHMM::log_cauchy_pdf (const double x, const std::vector< double > *param)
double StochHMM::log_laplace_pdf (const double x, const std::vector< double > *param)
double StochHMM::log_logistic_pdf (const double x, const std::vector< double > *param)
double StochHMM::log_normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::pareto_pdf (const double x, const std::vector< double > *param)
double StochHMM::nakagami_pdf (const double x, const std::vector< double > *param)
double StochHMM::rayleigh_pdf (const double x, const std::vector< double > *param)
double StochHMM::gumbel_type_two_pdf (const double x, const std::vector< double > *param)
double StochHMM::weibull_distribution (const double x, const std::vector< double > *param)
double StochHMM::cauchy_pdf (const double x, const std::vector< double > *param)
double StochHMM::gumbel_pdf (const double x, const std::vector< double > *param)
double StochHMM::generalized_normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::hyperbolic_secant_pdf (const double x, const std::vector< double > *param)
double StochHMM::laplace_pdf (const double x, const std::vector< double > *param)
double StochHMM::logistic_pdf (const double x, const std::vector< double > *param)
double StochHMM::standard_normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::normal_pdf (const double x, const std::vector< double > *param)
double StochHMM::students_t_pdf (const double x, const std::vector< double > *param)
double StochHMM::gumbel_type_one_pdf (const double x, const std::vector< double > *param)
double StochHMM::generalized_extreme_value_pdf (const double x, const std::vector< double > *param)
double StochHMM::generalized_pareto_pdf (const double x, const std::vector< double > *param)
double StochHMM::dirichlet_multi_pdf (const std::vector< double > *x, const std::vector< double > *param)
double StochHMM::ewens_multi_pdf (const std::vector< double > *x, const std::vector< double > *param)

Detailed Description

Univariate and Multivariate probability density functions for use in continuous emissions.


Function Documentation

double StochHMM::arcsine_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 228 of file PDF.h.

References StochHMM::arcsine_pdf().

{
return log(arcsine_pdf(x));
}
double StochHMM::arcsine_pdf ( double  x)

Arcsine probability distribution function

Parameters:
xvalue 0<=X<=1

Definition at line 242 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::arcsine_pdf().

{
if (x > 1.0 || x < 0.0 ){
std::cerr << "Arcsine PDF: Incorrect parameters\n";
exit(2);
}
return 1/(PI*sqrtf(x*(1-x)));
}
double StochHMM::beta_binomial_pdf ( int  k,
int  n,
double  a,
double  b 
)

Beta-Binomial probability mass function Beta-binomial Model

Parameters:
kValue
nNumber of trials
aalpha>0
bbeta>0

Definition at line 32 of file PDF.cpp.

References StochHMM::beta(), and StochHMM::bin_coef().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::beta_binomial_pdf().

{
double newAlpha = (double) k + a;
double newBeta = (double)(n-k) + b;
return bin_coef(n,k) * (beta(newAlpha,newBeta)/ beta(a,b));
}
double StochHMM::beta_binomial_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 120 of file PDF.h.

References StochHMM::beta_binomial_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(beta_binomial_pdf(k, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::beta_negative_binomial_pdf ( int  k,
int  n,
double  a,
double  b 
)

Beta negative binomial pdf

Parameters:
kValue or number of failures to get N successes
nNumber of successful trials
aShape parameter
bShape parameter

Definition at line 128 of file PDF.cpp.

References StochHMM::bin_coef().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::beta_negative_binomial_pdf().

{
double pmf = bin_coef(n+k-1, k);
pmf*=tgamma(a+n)*tgamma(b+k)*tgamma(a+b)/(tgamma(a+b+n+k)*tgamma(a)*tgamma(b));
return pmf;
}
double StochHMM::beta_negative_binomial_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 154 of file PDF.h.

References StochHMM::beta_negative_binomial_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(beta_negative_binomial_pdf(k, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::beta_pdf ( double  x,
std::vector< double >  param 
)

Definition at line 280 of file statistics.cpp.

References StochHMM::beta_pdf().

{
return beta_pdf(x,param[0],param[1]);
}
double StochHMM::beta_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 232 of file PDF.h.

References StochHMM::beta_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(beta_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::beta_pdf ( double  x,
double  a,
double  b 
)

Beta probability distribution function

Parameters:
xValue 0<x<1
aShape parameter a>0
bShape parameter b>0

Definition at line 255 of file PDF.cpp.

References StochHMM::betaPDF().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), StochHMM::beta_cdf(), and StochHMM::beta_pdf().

{
if (x > 1.0 || x < 0.0 || a <= 0.0 || b <= 0.0){
std::cerr << "Beta PDF: Incorrect parameters\n";
exit(2);
}
return betaPDF(x, a, b);
}
double StochHMM::beta_prime_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 307 of file PDF.h.

References StochHMM::beta_prime_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(beta_prime_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::beta_prime_pdf ( double  x,
double  a,
double  b 
)

Beta prime probability distribution function

Parameters:
xValue
aAlpha Shape parameter
bBeta Shape parameter

Definition at line 402 of file PDF.cpp.

References StochHMM::beta().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::beta_prime_pdf().

{
if (a<=0 || b<=0 || x<=0){
std::cerr << "Beta prime PDF: Incorrect parameters\n";
exit(2);
}
return (powf(x, a-1)*powf(1+x, -1*a-b))/ beta(a, b);
}
double StochHMM::binomial_pdf ( int  k,
int  n,
double  p 
)

Binomial probability mass function Binomial Distribution

Parameters:
[in]kNumber of successes
[in]nNumber of trials
[in]pProbability of success
Returns:
P(X = k) = Probability of k successes in n trials

Definition at line 21 of file PDF.cpp.

References StochHMM::bin_coef().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), StochHMM::binomial_cdf(), and StochHMM::binomial_pdf().

{
return bin_coef(n,k)*pow(p,k)*pow(1-p,n-k);
}
double StochHMM::binomial_pdf ( int  k,
std::vector< double >  param 
)
double StochHMM::binomial_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 112 of file PDF.h.

References StochHMM::binomial_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(binomial_pdf(k, (*param)[0], (*param)[2]));
}
double StochHMM::cauchy_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 510 of file PDF.h.

References StochHMM::cauchy_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(cauchy_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::cauchy_pdf ( double  x,
double  x_o,
double  gamma 
)

Cauchy probability distribution function

Parameters:
xValue
x_olocation parameter (place of peak)
gammascale parameter gamma>0

Definition at line 749 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::cauchy_pdf().

{
if (gamma <= 0){
std::cerr << "Cauchy PDF: Incorrect parameters\n";
exit(2);
}
return (1/PI)* (gamma)/(pow(x-x_o, 2)+pow(gamma,2));
}
double StochHMM::chi_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 315 of file PDF.h.

References StochHMM::chi_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(chi_pdf(x,(*param)[0]));
}
double StochHMM::chi_pdf ( double  x,
double  k 
)

Chi probability distribution function

Parameters:
xValue x>=0
kdegrees of freedom k>0

Definition at line 414 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::chi_pdf().

{
if (k<=0){
std::cerr << "Chi PDF: Incorrect parameters\n";
exit(2);
}
return (powf(2, 1-(k/2))*powf(x, k-1)*exp(-1*(powf(x, 2)/2)))/tgamma(k/2);
}
double StochHMM::chi_squared_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 323 of file PDF.h.

References StochHMM::chi_squared_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(chi_squared_pdf(x, (*param)[0]));
}
double StochHMM::chi_squared_pdf ( double  x,
double  k 
)

Chi-squared probability distribution function

Parameters:
kK>0
xx>0

Definition at line 426 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::chi_squared_pdf().

{
if ( k < 0 || x < 0){
std::cerr << "Chi-squared PDF: Incorrect parameters\n";
exit(2);
}
return (powf(x, (k/2)-1)*exp(-1*x/2))/(powf(2, k/2)*tgamma(k/2));
}
double StochHMM::continuous_uniform_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 248 of file PDF.h.

References StochHMM::continuous_uniform_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(continuous_uniform_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::continuous_uniform_pdf ( double  x,
double  a,
double  b 
)

Continuous Uniform probability distribution function

Parameters:
xValue or Position to calculate
aMinimum position
bMaximum position

Definition at line 281 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::continuous_uniform_pdf().

{
if (b<=a){
std::cerr << "Continuous uniform PDF: Incorrect parameters\n";
exit(2);
}
else if (x < a || x > b){
return 0.0f;
}
else{
return 1/(b-a);
}
}
double StochHMM::dagum_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 347 of file PDF.h.

References StochHMM::dagum_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(dagum_pdf(x, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::dagum_pdf ( double  x,
double  p,
double  a,
double  b 
)

Dagum probability distribution function

Parameters:
pShape parameter p>0
aShape parameter a>0
bShape parameter b>0
xValue x>0

Definition at line 473 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::dagum_pdf().

{
if ( p <= 0 || a <= 0 || b <= 0 || x <= 0){
std::cerr << "Dagum PDF: Incorrect parameters\n";
exit(2);
}
double pdf = (a*p)/x;
pdf *= powf(x/b, a*p)/powf(powf(x/b, a)+1 , p+1);
return pdf;
}
double StochHMM::degenerate_pdf ( double  value,
double  k 
)

Degenerate probability mass function Degenerate Distribution

Parameters:
[in]valueCurrent value
[in]kDegenerate value
Return values:
1if value == k
0if value !- k

Definition at line 44 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::degenerate_pdf().

{
if (value == k){
return 1.0;
}
else{
return 0.0;
}
}
double StochHMM::degenerate_pdf ( const double  value,
const std::vector< double > *  param 
)
inline

Definition at line 128 of file PDF.h.

References StochHMM::degenerate_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(degenerate_pdf(value, (*param)[0]));
}
double StochHMM::dirichlet_multi_pdf ( const std::vector< double > *  x,
const std::vector< double > *  param 
)
inline

Definition at line 599 of file PDF.h.

References StochHMM::dirichlet_pdf().

Referenced by StochHMM::StateFuncs::_loadMultivariatePdf().

{
return log(dirichlet_pdf(*x, *param));
}
double StochHMM::dirichlet_pdf ( const std::vector< double > &  x,
const std::vector< double > &  alpha 
)

Dirichlet Distribution

Parameters:
xVector of values
alphaconcentration parameters where a_i>0

Definition at line 921 of file PDF.cpp.

References StochHMM::sumVector().

Referenced by StochHMM::dirichlet_multi_pdf().

{
double gsum_alpha = tgamma(sumVector(alpha));
//Calc product of gamma transformed alpha values
double b_n(tgamma(alpha[0]));
for (size_t i=1; i < alpha.size(); ++i){
b_n*=tgamma(alpha[i]);
}
double b = 1 / (b_n/gsum_alpha); //Calculate B(alpha)
//Calculate final value by finding product of xi^(ai-1)
for (size_t i=0; i<alpha.size(); ++i){
b*=pow(x[i],alpha[i]-1);
}
return b;
}
double StochHMM::discrete_uniform_pdf ( int  position,
int  a,
int  b 
)

Discrete Uniform probability mass function Uniform Distribution

Parameters:
positionValue or Position to calculate
aMinimum position
bMaximum position
Return values:
1/(b-a+1)if position is between a and b
0if position is outside of interval a to b

Definition at line 61 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::discrete_uniform_pdf().

{
if (position<a || position>b){
return 0;
}
else{
return (double)1/(b-a+1);
}
}
double StochHMM::discrete_uniform_pdf ( const double  position,
const std::vector< double > *  param 
)
inline

Definition at line 136 of file PDF.h.

References StochHMM::discrete_uniform_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(discrete_uniform_pdf(position, (*param)[0], (*param)[1]));
}
double StochHMM::ewens_multi_pdf ( const std::vector< double > *  x,
const std::vector< double > *  param 
)
inline

Definition at line 604 of file PDF.h.

References StochHMM::multivariate_ewens_pdf().

Referenced by StochHMM::StateFuncs::_loadMultivariatePdf().

{
return log(multivariate_ewens_pdf(*x, (*param)[0]));
}
double StochHMM::exponential_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 355 of file PDF.h.

References StochHMM::exponential_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(exponential_pdf(x, (*param)[0]));
}
double StochHMM::exponential_pdf ( double  x,
double  lambda 
)

Exponential probability distribution function

Parameters:
lambdaRate or Inverse scale lambda>0
xValue x>=0

Definition at line 487 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::exponential_pdf().

{
if ( lambda <= 0 || x < 0 ){
std::cerr << "Exponential PDF: Incorrect parameters\n";
exit(2);
}
return lambda * exp (-1 * lambda * x);
}
double StochHMM::f_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 363 of file PDF.h.

References StochHMM::f_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(f_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::f_pdf ( double  x,
double  d1,
double  d2 
)

F-Distribution

Parameters:
xValue x>=0
d1Degree of freedom d1>0
d2Degree of freedom d2>0

Definition at line 501 of file PDF.cpp.

References StochHMM::beta().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::f_pdf().

{
if (x < 0 || d1 <= 0 || d2 <= 0){
std::cerr << "F Distribution PDF: Incorrect parameters\n";
exit(2);
}
double numerator = sqrtf((powf(d1*x, d1)*powf(d2, d2))/powf(d1*x+d2, d1+d2));
double denominator = x * beta(d1/2, d2/2);
return numerator / denominator;
}
double StochHMM::fishers_z_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 371 of file PDF.h.

References StochHMM::fishers_z_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(fishers_z_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::fishers_z_pdf ( double  x,
double  d1,
double  d2 
)

Fisher's z-distribution

Parameters:
xValue
d1Degree of freedom d1>0
d2Degree of freedom d2>0

Definition at line 516 of file PDF.cpp.

References StochHMM::beta().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::fishers_z_pdf().

{
if (d1 <= 0 || d2 <= 0){
std::cerr << "Fisher's z-Distribution PDF: Incorrect parameters\n";
exit(2);
}
double numerator = 2*powf(d1, d1/2)*powf(d2, d2/2)*exp(d1*x);
double denominator = beta(d1/2, d2/2) * powf(d1*exp(2*x)+d2, (d1+d2)/2);
return numerator/denominator;
}
double StochHMM::folded_normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 379 of file PDF.h.

References StochHMM::folded_normal_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(folded_normal_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::folded_normal_pdf ( double  x,
double  mu,
double  sigma_sqrd 
)

Folded Normal probability distribution function

Parameters:
xValue x>=0
muMean(location)
sigma_sqrdScale

Definition at line 531 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::folded_normal_pdf().

{
if (x < 0 || sigma_sqrd <= 0 ){
std::cerr << "Folded Normal PDF: Incorrect parameters\n";
exit(2);
}
double l_pdf = 1/(sqrtf(sigma_sqrd*2 * PI));
double l_temp = exp(-1* powf(-1*x-mu,2)/(2*sigma_sqrd));
double r_temp = exp(-1* powf(x-mu,2)/(2*sigma_sqrd));
return (l_pdf*l_temp) + (l_pdf *r_temp);
}
double StochHMM::frechet_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 387 of file PDF.h.

References StochHMM::frechet_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(frechet_pdf(x, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::frechet_pdf ( double  x,
double  alpha,
double  s,
double  m 
)

Frechet Probability distribution function

Parameters:
xValue X>m
alphaShape parameter a>0
sScale parameter s>0 (default s=1)
mLocation minimum (default m=0)

Definition at line 549 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::frechet_pdf().

{
if (alpha <= 0 || s <= 0 || x < m ){
std::cerr << "Frechet PDF: Incorrect parameters\n";
exit(2);
}
return (alpha/s)*powf((x-m)/s, -1-alpha) * exp(-1*powf((x-m)/s, -1*alpha));
}
double StochHMM::gamma_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 395 of file PDF.h.

References StochHMM::gamma_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(gamma_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::gamma_pdf ( double  x,
double  alpha,
double  beta 
)

Gamma probability distribution

Parameters:
xValue x>0
alphaShape parameter a>0
betaRate parameter b>0 *http://en.wikipedia.org/wiki/Gamma_distribution

Definition at line 563 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), StochHMM::chi2_pdf(), StochHMM::expon_pdf(), StochHMM::gamma_cdf(), and StochHMM::gamma_pdf().

{
if (x <= 0 || alpha <= 0 || beta <= 0){
std::cerr << "Gamma PDF: Incorrect parameters\n";
exit(2);
}
return (pow(beta,alpha)/tgamma(alpha))*pow(x,alpha-1)*exp(-beta*x);
}
double StochHMM::generalized_extreme_value_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 583 of file PDF.h.

References StochHMM::generalized_extreme_value_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(generalized_extreme_value_pdf(x, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::generalized_extreme_value_pdf ( double  x,
double  mu,
double  sigma,
double  xi 
)

Generalized extreme value probability distribution function

Parameters:
xValue;
mulocation parameter
sigmascale parameter
xishape parameter

Definition at line 868 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::generalized_extreme_value_pdf().

{
if (sigma <= 0){
std::cerr << "Generalized extreme value PDF: Incorrect parameters\n";
exit(2);
}
if (xi > 0 && (x < mu - (sigma/xi) || x == INFINITY)){
std::cerr << "Generalized extreme value PDF: Incorrect parameters\n";
exit(2);
}
else if (xi == 0 && (x == -INFINITY || x == INFINITY)){
std::cerr << "Generalized extreme value PDF: Incorrect parameters\n";
exit(2);
}
else if (xi > 0 && (x == -INFINITY || x > mu - (sigma/xi))){
std::cerr << "Generalized extreme value PDF: Incorrect parameters\n";
exit(2);
}
double t = (xi == 0 ) ? exp(-1*((x-mu)/sigma)) : pow(1+((x-mu)/sigma)*xi, -1/xi);
return (1/sigma)*pow(t,xi+1)*exp(-1*t);
}
double StochHMM::generalized_normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 527 of file PDF.h.

References StochHMM::generalized_normal_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(generalized_normal_pdf(x, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::generalized_normal_pdf ( double  x,
double  mu,
double  alpha,
double  beta 
)

Generalized Normal probability distribution function

Parameters:
xValue
muLocation parameter
alphascale parameter alpha>0
betashape parameter beta>0

Definition at line 791 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::generalized_normal_pdf().

{
if ( alpha < 0 || beta < 0){
std::cerr << "Generalized normal PDF: Incorrect parameters\n";
exit(2);
}
return beta/(2*alpha*tgamma(1/beta))*exp(-1*pow(abs(x-mu)/alpha, beta));
}
double StochHMM::generalized_pareto_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 591 of file PDF.h.

References StochHMM::generalized_pareto_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(generalized_pareto_pdf(x, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::generalized_pareto_pdf ( double  x,
double  mu,
double  sigma,
double  xi 
)

Generalized Pareto probability distribution function

Parameters:
xValue
muLocation parameter
sigmaScale parameteer
xiShape parameter

Definition at line 898 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::generalized_pareto_pdf().

{
if (xi >= 0 && x < mu){
std::cerr << "Generalized pareto PDF: Incorrect parameters\n";
exit(2);
}
if (xi < 0 && ( x < mu || x > (mu-sigma/xi))){
std::cerr << "Generalized pareto PDF: Incorrect parameters\n";
exit(2);
}
if (xi ==0){
return 1 - exp(-1*((x-mu)/sigma));
}
return 1 - pow(1+((xi*(x-mu))/sigma), -1/xi);
}
double StochHMM::geometric_pdf ( int  k,
double  p 
)

Geometric probability mass function

Parameters:
kValue or Trial of first success
pprobability of success

Definition at line 147 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::geometric_pdf().

{
return pow(1-p,k-1) * p;
}
double StochHMM::geometric_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 171 of file PDF.h.

References StochHMM::geometric_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(geometric_pdf(k, (*param)[0]));
}
double StochHMM::gumbel_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 518 of file PDF.h.

References StochHMM::gumbel_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(gumbel_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::gumbel_pdf ( double  x,
double  mu,
double  beta 
)

Gumbel Probability distribution function

Parameters:
xValue
muLocation parameter
betaScale parameter

Definition at line 764 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::gumbel_pdf().

{
if (beta <= 0){
std::cerr << "Gumbel PDF: Incorrect parameters\n";
exit(2);
}
double z = (x-mu)/beta;
return (1/beta)*exp(-1*(z)-exp(-1*z));
}
double StochHMM::gumbel_type_one_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 575 of file PDF.h.

References StochHMM::gumbel_type_one_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(gumbel_type_one_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::gumbel_type_one_pdf ( double  x,
double  a,
double  b 
)

Gumbel Type-2 Probability distribution function

Parameters:
xValue
a
bShape

Definition at line 858 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::gumbel_type_one_pdf().

{
return a*b*exp(-1*(b*exp(-1*a*x))+a*x);
}
double StochHMM::gumbel_type_two_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 491 of file PDF.h.

References StochHMM::gumbel_type_two_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return gumbel_type_two_pdf(x, (*param)[0], (*param)[1]);
}
double StochHMM::gumbel_type_two_pdf ( double  x,
double  a,
double  b 
)

Type 2 Gumbell Probability distribution function

Parameters:
xValue
aparameter
bshape parameter

Definition at line 714 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::gumbel_type_two_pdf().

{
if (x<=0 || x== INFINITY){
std::cerr << "Type 2 Gumbel PDF: Incorrect parameters\n";
exit(2);
}
return a*b*pow(x,-1*a-1) * exp(-1*b*pow(x,-1*a));
}
double StochHMM::half_normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 411 of file PDF.h.

References StochHMM::half_normal_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(half_normal_pdf(x, (*param)[0]));
}
double StochHMM::half_normal_pdf ( double  x,
double  sigma 
)

Half Normal probability distribution

Parameters:
xValue x>0
sigmaStandard Deviation sigma>0

Definition at line 587 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::half_normal_pdf().

{
if (x <= 0 || sigma <= 0){
std::cerr << "Half Normal PDF: Incorrect parameters\n";
exit(2);
}
return sqrt(2)/(sigma*sqrt(PI)) * exp(-1* pow(x,2)/(2*pow(sigma,2)));
}
double StochHMM::hyperbolic_secant_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 535 of file PDF.h.

References StochHMM::hyperbolic_secant_pdf().

{
return log(hyperbolic_secant_pdf(x));
}
double StochHMM::hyperbolic_secant_pdf ( double  x)

Hyperbolic secant probability distribution function

Parameters:
xValue

Definition at line 801 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::hyperbolic_secant_pdf().

{
return 0.5*pow(cosh((PI/2)*x),-1);
}
double StochHMM::hypergeometric_pdf ( int  k,
int  n,
int  N,
int  m 
)

Hypergeometric Cumulative Distribution Function

Parameters:
kValue or Number of successes
nNumber of draws from Population
NSize of population
mNumber of successes in Population

Definition at line 76 of file PDF.cpp.

References StochHMM::bin_coef().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::hypergeometric_pdf().

{
return (bin_coef(m, k)*bin_coef(N-m,n-k))/bin_coef(N, n);
}
double StochHMM::hypergeometric_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 144 of file PDF.h.

References StochHMM::hypergeometric_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(hypergeometric_pdf(k, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::inv_gamma_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 403 of file PDF.h.

References StochHMM::inv_gamma_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(inv_gamma_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::inv_gamma_pdf ( double  x,
double  alpha,
double  beta 
)

Inverse Gamma probability distribution

Parameters:
xValue x>0
alphaShape parameter x>0
betaScale parameter b>0

Definition at line 576 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::inv_gamma_pdf().

{
if (x <= 0 || alpha <= 0 || beta <= 0){
std::cerr << "Inverse Gamma PDF: Incorrect parameters\n";
exit(2);
}
return (pow(beta,alpha)/tgamma(alpha))*pow(x,-1*alpha-1)*exp(-beta/x);
}
double StochHMM::inv_gaussian_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 419 of file PDF.h.

References StochHMM::inv_gaussian_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(inv_gaussian_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::inv_gaussian_pdf ( double  x,
double  mu,
double  lambda 
)

Inverse Gaussian probability distribution

Parameters:
xValue x>0
muAverage u>0
lambdaShape parameter l>0

Definition at line 599 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::inv_gaussian_pdf().

{
if (x <= 0 || mu <= 0 || lambda <= 0){
std::cerr << "Inverse Gaussian PDF: Incorrect parameters\n";
exit(2);
}
return sqrt(lambda/(2*PI*pow(x, 3))) * exp((lambda*pow(x-mu,2))/(2*pow(mu,2)*x));
}
double StochHMM::inverse_chi_squared_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 331 of file PDF.h.

References StochHMM::inverse_chi_squared_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(inverse_chi_squared_pdf(x, (*param)[0]));
}
double StochHMM::inverse_chi_squared_pdf ( double  x,
double  v 
)

Inverse-Chi-squared probability distribution function

Parameters:
xValue x>0
vv>0

Definition at line 440 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::inverse_chi_squared_pdf().

{
if ( x <= 0 || v <= 0 ){
std::cerr << "Inverse Chi squared PDF: Incorrect parameters\n";
exit(2);
}
return (powf(2, -1*v/2)*powf(x, -1*(v/2)-1)*exp(-1/(2*x)))/tgamma(v/2);
}
double StochHMM::kumaraswamy_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 256 of file PDF.h.

References StochHMM::kumaraswamy_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(kumaraswamy_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::kumaraswamy_pdf ( double  x,
double  a,
double  b 
)

Kumaraswamy probability distribution function

Parameters:
x
aShape parameter
bShape parameter

Definition at line 298 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::kumaraswamy_pdf().

{
if (a <= 0 || b <= 0 || x < 0 || x > 1.0 ){
std::cerr << "Kumaraswamy PDF: Incorrect parameters\n";
exit(2);
}
return a * b * powf(x, a-1) * powf((1 - powf(x, a)),b-1);
}
double StochHMM::laplace_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 539 of file PDF.h.

References StochHMM::laplace_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(laplace_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::laplace_pdf ( double  x,
double  mu,
double  b 
)

Laplace Probability distribution function

Parameters:
xValue
muLocation Parameter
bShape parameter

Definition at line 810 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::laplace_pdf().

{
return 1/(2*b) * exp( -1 * abs(x-mu)/b);
}
double StochHMM::levy_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 427 of file PDF.h.

References StochHMM::levy_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(levy_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::levy_pdf ( double  x,
double  mu,
double  scale 
)

Levy probability distribution function

Parameters:
xValue x>= mu and x<INFINITY
mulocation parameter
scalescale parameter C>0

Definition at line 611 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::levy_pdf().

{
if (x < mu || x == INFINITY || scale <= 0){
std::cerr << "Levy PDF: Incorrect parameters\n";
exit(2);
}
return sqrt(scale/(2*PI)) * (exp((-1*scale)/(2*(x-mu)))/pow(x-mu,1.5));
}
double StochHMM::log_cauchy_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 435 of file PDF.h.

References StochHMM::log_cauchy_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(log_cauchy_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::log_cauchy_pdf ( double  x,
double  mu,
double  sigma 
)

Log Cauchy probability distribution function

Parameters:
xValue X>0 X<INFINITY;
muLocation
sigmascale parameter

Definition at line 623 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::log_cauchy_pdf().

{
if (x <= 0 || sigma <= 0 || x== INFINITY){
std::cerr << "Log Cauchy PDF: Incorrect parameters\n";
exit(2);
}
return (1/(x*PI))*(sigma/(pow(log(x-mu),2)+pow(sigma,2)));
}
double StochHMM::log_laplace_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 443 of file PDF.h.

References StochHMM::log_laplace_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(log_laplace_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::log_laplace_pdf ( double  x,
double  mu,
double  b 
)

Log Laplace probability distribution function

Parameters:
xValue
muparameter
bparameter

Definition at line 635 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::log_laplace_pdf().

{
if (x < mu){
return (1/(b*x))*exp(-1*((mu-log(x))/b));
}
return (1/(b*x))*exp(-1*((log(x)-mu)/b));
}
double StochHMM::log_logistic_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 451 of file PDF.h.

References StochHMM::log_logistic_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(log_logistic_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::log_logistic_pdf ( double  x,
double  a,
double  b 
)

Log logistic probability distribution function

Parameters:
xValue
alphascale parameter
betashape parameter

Definition at line 647 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::log_logistic_pdf().

{
if (x<0 || a < 0 || b < 0 || x == INFINITY){
std::cerr << "Log logistic PDF: Incorrect parameters\n";
exit(2);
}
return ((b/a)*pow(x/a,b-1))/pow(1+pow(x/a,b),2);
}
double StochHMM::log_normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 459 of file PDF.h.

References StochHMM::log_normal_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(log_normal_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::log_normal_pdf ( double  x,
double  mu,
double  sigma_sqrd 
)

Log Normal probability distribution function

Parameters:
xValue x>0 and x<INFINITY
muLog scaled location parameter
sigma_sqrdLog scaled scaling parameter

Definition at line 660 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::log_normal_pdf().

{
if (x < 0 || x == INFINITY || sigma_sqrd <= 0){
std::cerr << "Log Normal PDF: Incorrect parameters\n";
exit(2);
}
return (1/(x*sqrt(2*PI*sigma_sqrd)))*exp(-1* (pow(log(x)-mu,2))/(2*sigma_sqrd));
}
double StochHMM::logarithmic_pdf ( int  k,
double  p 
)

Logarithmic probability mass function

Parameters:
kValue
pProbability

Definition at line 155 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::logarithmic_pdf().

{
if (k<1 || p==1.0 || p==0.0){
std::cerr << "Logarithmic PDF Function: k must be >=1, 0<p<1\n";
exit(2);
}
return (1/log(1-p))*(pow(p,k)/k);
}
double StochHMM::logarithmic_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 179 of file PDF.h.

References StochHMM::logarithmic_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(logarithmic_pdf(k, (*param)[0]));
}
double StochHMM::logistic_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 547 of file PDF.h.

References StochHMM::logistic_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(logistic_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::logistic_pdf ( double  x,
double  mu,
double  s 
)

Logistic Probability distribution function

Parameters:
xValue
muLocation parameter
sShape parameter

Definition at line 818 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::logistic_pdf().

{
return (1/(4*s))*pow(cosh((x-mu)/s),-2);
}
double StochHMM::logit_normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 240 of file PDF.h.

References StochHMM::logit_normal_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(logit_normal_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::logit_normal_pdf ( double  x,
double  mu,
double  sigma 
)

Logit Normal probability distribution function

Parameters:
xValue
muMean
sigmaStd. deviation

Definition at line 268 of file PDF.cpp.

References StochHMM::logit(), and PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::logit_normal_pdf().

{
if (x >= 1.0 || x <= 0.0 || sigma <= 0.0){
std::cerr << "Logit Normal PDF: Incorrect parameters\n";
exit(2);
}
return (1/(sigma*sqrtf(2*PI)))*exp(-1*pow((logit(x)-mu),2)/(2*pow(sigma,2)))*(1/(x*(1-x)));
}
double StochHMM::maxwell_boltzman_pdf ( double  x,
double  a 
)

Maxwell-Boltzman Probability distribution function *a href = "http://en.wikipedia.org/wiki/Maxwell–Boltzmann_distribution">

Parameters:
aShape parameter a>0
xValue

Definition at line 139 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::maxwell_boltzman_pdf().

{
return sqrtf(2/PI)*(pow(x,2)*exp(-1*pow(x,2)/(2*pow(a, 2))))/pow(a,3);
}
double StochHMM::maxwell_boltzman_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 162 of file PDF.h.

References StochHMM::maxwell_boltzman_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(maxwell_boltzman_pdf(x, (*param)[0]));
}
double StochHMM::multivariate_ewens_pdf ( const std::vector< double > &  x,
const double  theta 
)

Multivariate Ewen's probability distribution function

Parameters:
x# of individual allele represented in sample
thetaParameter: details of evolutionary model

Definition at line 943 of file PDF.cpp.

References StochHMM::factorial().

Referenced by StochHMM::ewens_multi_pdf().

{
double n = factorial(x.size());
double d(theta);
for (size_t i=0; i < x.size() -1 ; ++i){
d *= theta + i;
}
double prob=1;
for(size_t i=0; i < x.size() ; ++i){
prob*= pow(theta,x[i]) / (pow(i,x[i]) * factorial(x[i]));
}
return (n/d) * prob;
}
double StochHMM::nakagami_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 475 of file PDF.h.

References StochHMM::nakagami_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(nakagami_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::nakagami_pdf ( double  x,
double  mu,
double  w 
)

Nakagami probability distribution function

Parameters:
xValue
mushape parameter
wspread parameter

Definition at line 689 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::nakagami_pdf().

{
if (x<=0 || mu < 0.5 || w <=0){
std::cerr << "Nakagami PDF: Incorrect parameters\n";
exit(2);
}
return (pow(2*mu,2)/(tgamma(mu)*pow(w, mu)))*pow(x,2*mu-1)*exp(-1*(mu/w)*pow(x,2));
}
double StochHMM::negative_binomial_pdf ( int  k,
int  r,
double  p 
)

Negative binomial probability mass function

Parameters:
rValue or Number of failures until experiment stopped
pSuccess probability in each experiment

Definition at line 167 of file PDF.cpp.

References StochHMM::bin_coef().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::negative_binomial_pdf().

{
if (r<=0 || p<0.0 || p > 1.0){
std::cerr << "Negative Binomial PMF: Incorrect parameters\n";
exit(2);
}
return bin_coef(k+r-1, k)*pow(1-p,r)*pow(p,k);
}
double StochHMM::negative_binomial_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 187 of file PDF.h.

References StochHMM::negative_binomial_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(negative_binomial_pdf(k, (*param)[0], (*param)[1]));
}
double StochHMM::normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 559 of file PDF.h.

References StochHMM::normal_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(normal_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::normal_pdf ( double  x,
double  mu,
double  sigma 
)

Normal probability distribution function

Parameters:
xValue
muLocation parameter(mean)
sigmaScaling parameter (standard deviation)

Definition at line 832 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), StochHMM::normal_pdf(), and StochHMM::standard_normal_pdf().

{
if (sigma <= 0){
std::cerr << "Normal PDF: Incorrect parameters\n";
exit(2);
}
return (1/(sigma*sqrt(2*PI)))* exp(-1*pow(x-mu, 2)/(2*pow(sigma, 2)));
}
double StochHMM::pareto_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 467 of file PDF.h.

References StochHMM::pareto_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(pareto_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::pareto_pdf ( double  x,
double  alpha,
double  x_m 
)

Pareto probability distribution function

Parameters:
xValue
alphashape parameter
x_mscale parameter

Definition at line 673 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::pareto_pdf().

{
if ( alpha <= 0 || x_m <= 0){
std::cerr << "Pareto PDF: Incorrect parameters\n";
exit(2);
}
if (x<x_m){
return 1;
}
return pow(x_m/x, alpha);
}
double StochHMM::poisson_binomial_pdf ( int  k,
std::vector< double > &  p 
)
double StochHMM::poisson_pdf ( int  k,
double  lambda 
)

Poisson probability mass function

Parameters:
kTrial of first success
lambdaProbability of success

Definition at line 179 of file PDF.cpp.

References StochHMM::factorial().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::poisson_pdf().

{
if (k<0 || lambda<=0){
std::cerr << "Poisson PMF: Incorrect parameters\n";
exit(2);
}
return (pow(lambda,(double)k)* exp(-1*lambda))/factorial(k);
}
double StochHMM::poisson_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 195 of file PDF.h.

References StochHMM::poisson_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(poisson_pdf(k, (*param)[0]));
}
double StochHMM::raised_cosine_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 264 of file PDF.h.

References StochHMM::raised_cosine_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(raised_cosine_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::raised_cosine_pdf ( double  x,
double  mu,
double  s 
)

Raised cosine probability distribution function

Parameters:
mu
sS>0
xu-s<=x<=u+s

Definition at line 310 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::raised_cosine_pdf().

{
if (s <= 0 || x < mu-s || x > mu+s){
std::cerr << "Raised cosine PDF: Incorrect parameters\n";
exit(2);
}
return 1/(2*s)*(1+cosf(PI*(x-mu)/s));
}
double StochHMM::rayleigh_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 483 of file PDF.h.

References StochHMM::rayleigh_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(rayleigh_pdf(x, (*param)[0]));
}
double StochHMM::rayleigh_pdf ( double  x,
double  sigma 
)

Rayleigh probability distribution function

Parameters:
xValue x>=0 and x<INFINITY
sigmaMode

Definition at line 702 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::rayleigh_pdf().

{
if (x<0 || x == INFINITY || sigma <= 0){
std::cerr << "Rayleigh PDF: Incorrect parameters\n";
exit(2);
}
return (x/pow(sigma, 2))*exp(-1*(pow(x,2))/(2*pow(sigma,2)));
}
double StochHMM::scaled_inverse_chi_squared_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 339 of file PDF.h.

References StochHMM::scaled_inverse_chi_squared_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(scaled_inverse_chi_squared_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::scaled_inverse_chi_squared_pdf ( double  x,
double  v,
double  sigma_sqrd 
)

Scaled Inverse Chi-squared probability distribution function

Parameters:
xValue x>0
vv>0
sigma_sqrdsigma_sqrd>0

Definition at line 453 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::scaled_inverse_chi_squared_pdf().

{
if (x <= 0 || v<=0 || sigma_sqrd <= 0 ){
std::cerr << "Scaled Inverse Chi-squared PDF: Incorrect paramenters\n";
exit(2);
}
double numerator = powf(sigma_sqrd*(v/2),v/2);
numerator *= exp((-1*v*sigma_sqrd)/(2*x));
double denominator = tgamma(v/2);
denominator *= powf(x, 1+(v/2));
return numerator/denominator;
}
double StochHMM::standard_normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 555 of file PDF.h.

References StochHMM::standard_normal_pdf().

{
}
double StochHMM::standard_normal_pdf ( double  x)

Standard Normal probability distribution function

Parameters:
xValue

Definition at line 824 of file PDF.cpp.

References StochHMM::normal_pdf().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::standard_normal_pdf().

{
return normal_pdf(x, 0, 1);
}
double StochHMM::students_t_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 567 of file PDF.h.

References StochHMM::students_t_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(students_t_pdf(x, (*param)[0]));
}
double StochHMM::students_t_pdf ( double  x,
double  v 
)

Student's t-probability distribution function

Parameters:
xValue
vDegrees of freedom

Definition at line 844 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::students_t_pdf().

{
if (v<=0){
std::cerr << "Student's t-PDF: Incorrect parameters\n";
exit(2);
}
double i = tgamma((v+1)/2)/(sqrt(v*PI)*tgamma(v/2));
return i * pow(1+(pow(x,2)/v),-1*(v+1)/2);
}
double StochHMM::triangular_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 272 of file PDF.h.

References StochHMM::triangular_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(triangular_pdf(x, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::triangular_pdf ( double  x,
double  a,
double  b,
double  c 
)

Triangular probability distribution function

Parameters:
aReal number
ba<b
ca<=c<=b
xa<=x<=b

Definition at line 323 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::triangular_pdf().

{
if (b<=a || c<=a || c>=b){
std::cerr << "Triangular PDF: Incorrect parameters\n";
exit(2);
}
if (x >= a && x <= c){
return 2*(x-a)/((b-a)*(c-a));
}
else if (x > c && x <= b){
return 2*(b-x)/((b-a)*(b-c));
}
else{
return 0;
}
}
double StochHMM::truncated_normal_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 280 of file PDF.h.

References StochHMM::truncated_normal_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(truncated_normal_pdf(x, (*param)[0], (*param)[1], (*param)[2], (*param)[3]));
}
double StochHMM::truncated_normal_pdf ( double  x,
double  mu,
double  sd,
double  a,
double  b 
)

Truncated Normal probability distribution function

Parameters:
aminimum value
bmaximum value
muMean
sdStandard deviation
xValue

Definition at line 349 of file PDF.cpp.

References StochHMM::beta(), StochHMM::beta_cdf(), and StochHMM::erf().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::truncated_normal_pdf().

{
if (sd<0 || x < a || x > b){
std::cerr << "Truncated normal PDF: Incorrect paramenters\n";
exit(2);
}
double alpha = (a-mu)/sd;
double beta = (b-mu)/sd;
double xi = (x-mu)/sd;
double alpha_cdf = (0.5*(1+erf((alpha-mu)/sqrt(2*pow(sd,2)))));
double beta_cdf = (0.5*(1+erf((beta-mu)/sqrt(2*pow(sd,2)))));
double z = beta_cdf - alpha_cdf;
return (0.5*(1+erf((xi-mu)/sqrt(2*pow(sd,2)))))/(sd * z);
}
double StochHMM::u_quadratic_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 288 of file PDF.h.

References StochHMM::u_quadratic_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(u_quadratic_pdf(x, (*param)[0], (*param)[1]));
}
double StochHMM::u_quadratic_pdf ( double  x,
double  a,
double  b 
)

U-quadratic probability distribution function

Parameters:
a
b
x

Definition at line 371 of file PDF.cpp.

References StochHMM::beta().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::u_quadratic_pdf().

{
if (b <= a || x < a || x > b){
std::cerr << "U-quadratic PDF: Incorrect parameters\n";
exit(2);
}
double alpha = 12 / powf(b-a, 3);
double beta = (b + a)/2;
return alpha * powf(x-beta, 2);;
}
double StochHMM::weibull_distribution ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 499 of file PDF.h.

References StochHMM::weibull_distribution().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(weibull_distribution(x, (*param)[0], (*param)[1]));
}
double StochHMM::weibull_distribution ( double  x,
double  lambda,
double  k 
)

Weibull Probability distribution function

Parameters:
xvalue
lambdascale parameter
kshape parameter

Definition at line 726 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::weibull_distribution().

{
if ( x==INFINITY || lambda <= 0 || k <= 0){
std::cerr << "Weibull PDF: Incorrect parameters\n";
exit(2);
}
if (x <0){
return 0.0;
}
return (k/lambda)*pow(x/lambda,k-1)*exp(-1*(pow(x/lambda, k)));
}
double StochHMM::wigner_semicircle_pdf ( const double  x,
const std::vector< double > *  param 
)
inline

Definition at line 296 of file PDF.h.

References StochHMM::wigner_semicircle_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(wigner_semicircle_pdf(x, (*param)[0]));
}
double StochHMM::wigner_semicircle_pdf ( double  x,
double  r 
)

Wigner semicircle probability distribution function

Parameters:
rradius R>0
xvalue

Definition at line 386 of file PDF.cpp.

References PI.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::wigner_semicircle_pdf().

{
if (r<=0){
std::cerr << "Wigner semicircle PDF: Incorrect parameters\n";
exit(2);
}
return (2/(PI*powf(r, 2)))*sqrtf(powf(r, 2) - powf(x, 2));
}
double StochHMM::yule_simon_pdf ( int  k,
double  p 
)

Yule-Simon probability mass function

Parameters:
k
pShape parameter

Definition at line 191 of file PDF.cpp.

References StochHMM::beta().

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::yule_simon_pdf().

{
if (k<1 || p<=0.0){
std::cerr << "Yule-Simon PMF: Incorrect parameters\n";
exit(2);
}
return p*beta(k, p+1);
}
double StochHMM::yule_simon_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 203 of file PDF.h.

References StochHMM::yule_simon_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(yule_simon_pdf(k, (*param)[0]));
}
double StochHMM::zipf_mandelbrot_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 218 of file PDF.h.

References StochHMM::zipf_mandelbrot_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(zipf_mandelbrot_pdf(k, (*param)[0], (*param)[1], (*param)[2]));
}
double StochHMM::zipf_mandelbrot_pdf ( int  k,
int  N,
double  s,
double  q 
)

Zipf-Mandelbrot probability mass function

Parameters:
kThe rank of element
NNumber of elements
sShape parameter (Exponent value)
qShape parameter

Definition at line 223 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::zipf_mandelbrot_pdf().

{
if (k<1 || N<1 || s<=0.0 || q<0.0){
std::cerr << "Zipf's PMF: Incorrect parameters\n";
exit(2);
}
double pmf = 1/pow((double)k+q,s);
double denom(0.0);
for (int n = 1; n < N; n++){
denom+=1/pow((double)n+q, s);
}
return pmf/denom;
}
double StochHMM::zipf_pdf ( int  k,
int  N,
double  s 
)

Zipf probability mass function

Parameters:
kThe rank of element
NNumber of elements
sShape parameter (Exponent value)

Definition at line 204 of file PDF.cpp.

Referenced by StochHMM::StateFuncs::_loadUnivariatePdf(), and StochHMM::zipf_pdf().

{
if (k<1 || N<1 || s<=0.0){
std::cerr << "Zipf's PMF: Incorrect parameters\n";
exit(2);
}
double pmf = 1/pow((double)k,s);
double denom(0.0);
for (int n = 1; n < N; n++){
denom+=1/pow((double)n, s);
}
return pmf/denom;
}
double StochHMM::zipf_pdf ( const double  k,
const std::vector< double > *  param 
)
inline

Definition at line 211 of file PDF.h.

References StochHMM::zipf_pdf().

{
if (param==NULL){
std::cerr << __FUNCTION__ << ": Missing parameters\n";
exit(2);
}
return log(zipf_pdf(k, (*param)[0], (*param)[1]));
}