1 | /* |
---|
2 | |
---|
3 | PhyML: a program that computes maximum likelihood phylogenies from |
---|
4 | DNA or AA homologous sequences. |
---|
5 | |
---|
6 | Copyright (C) Stephane Guindon. Oct 2003 onward. |
---|
7 | |
---|
8 | All parts of the source except where indicated are distributed under |
---|
9 | the GNU public licence. See http://www.opensource.org for details. |
---|
10 | |
---|
11 | */ |
---|
12 | |
---|
13 | #include <config.h> |
---|
14 | |
---|
15 | #ifndef STATS_H |
---|
16 | #define STATS_H |
---|
17 | |
---|
18 | #include "utilities.h" |
---|
19 | #include "free.h" |
---|
20 | #include "lk.h" |
---|
21 | #include "optimiz.h" |
---|
22 | #include "models.h" |
---|
23 | #include "eigen.h" |
---|
24 | |
---|
25 | |
---|
26 | phydbl *Covariance_Matrix(t_tree *tree); |
---|
27 | phydbl *Hessian(t_tree *tree); |
---|
28 | void Recurr_Hessian(t_node *a, t_node *b, int plus_minus, phydbl *inc, phydbl *res, int *is_ok, t_tree *tree); |
---|
29 | phydbl stdnormal_inv(phydbl p); |
---|
30 | phydbl Uni(); |
---|
31 | int Rand_Int(int min, int max); |
---|
32 | phydbl Ahrensdietergamma(phydbl alpha); |
---|
33 | phydbl Rgamma(phydbl shape, phydbl scale); |
---|
34 | phydbl Rexp(phydbl lambda); |
---|
35 | phydbl Bico(int n, int k); |
---|
36 | phydbl Factln(int n); |
---|
37 | phydbl Gammln(phydbl xx); |
---|
38 | phydbl Pbinom(int N, int ni, phydbl p); |
---|
39 | phydbl LnGamma (phydbl alpha); |
---|
40 | phydbl IncompleteGamma(phydbl x, phydbl alpha, phydbl ln_gamma_alpha); |
---|
41 | phydbl PointChi2 (phydbl prob, phydbl v); |
---|
42 | phydbl Bivariate_Normal_Density(phydbl x, phydbl y, phydbl mux, phydbl muy, phydbl sdx, phydbl sdy, phydbl rho); |
---|
43 | phydbl PointNormal (phydbl prob); |
---|
44 | int DiscreteGamma (phydbl freqK[], phydbl rK[],phydbl alfa, phydbl beta, int K, int median); |
---|
45 | phydbl Pnorm(phydbl x, phydbl mean, phydbl var); |
---|
46 | phydbl Dnorm_Moments(phydbl x, phydbl mean, phydbl var); |
---|
47 | phydbl Dnorm(phydbl x, phydbl mean, phydbl sd); |
---|
48 | phydbl Pgamma(phydbl x, phydbl shape, phydbl scale); |
---|
49 | phydbl Dgamma_Moments(phydbl x, phydbl mean, phydbl var); |
---|
50 | phydbl Dgamma(phydbl x, phydbl shape, phydbl scale); |
---|
51 | phydbl LnFact(int n); |
---|
52 | int Choose(int n, int k); |
---|
53 | phydbl Ppois(phydbl x, phydbl param); |
---|
54 | phydbl Dexp(phydbl x, phydbl param); |
---|
55 | phydbl Dpois(phydbl x, phydbl param); |
---|
56 | phydbl Rand_Normal_Deviate(phydbl mean, phydbl sd); |
---|
57 | phydbl Rnorm(phydbl mean, phydbl sd); |
---|
58 | phydbl *Rnorm_Multid(phydbl *mu, phydbl *cov, int dim); |
---|
59 | phydbl Rnorm_Trunc(phydbl mean, phydbl sd, phydbl min, phydbl max, int *err); |
---|
60 | phydbl *Rnorm_Multid_Trunc(phydbl *mean, phydbl *cov, phydbl *min, phydbl *max, int dim); |
---|
61 | phydbl *Hessian_Log(t_tree *tree); |
---|
62 | void Recurr_Hessian_Log(t_node *a, t_node *d, int plus_minus, phydbl *inc, phydbl *res, int *is_ok, t_tree *tree); |
---|
63 | phydbl Log_Det(int *is_ok, t_tree *tree); |
---|
64 | phydbl Dnorm_Trunc(phydbl x, phydbl mean, phydbl sd, phydbl lo, phydbl up); |
---|
65 | phydbl Normal_Trunc_Mean(phydbl mu, phydbl sd, phydbl min, phydbl max); |
---|
66 | phydbl Constraint_Normal_Trunc_Mean(phydbl wanted_mu, phydbl sd, phydbl min, phydbl max); |
---|
67 | phydbl Dnorm_Multi(phydbl *x, phydbl *mu, phydbl *cov, int size, int _log); |
---|
68 | phydbl Dnorm_Multi_Given_InvCov_Det(phydbl *x, phydbl *mu, phydbl *invcov, phydbl det, int size, int _log); |
---|
69 | phydbl Prop_Log_Dnorm_Multi_Given_InvCov_Det(phydbl *x, phydbl *mu, phydbl *invcov, phydbl det, int size); |
---|
70 | phydbl Log_Dnorm(phydbl x, phydbl mean, phydbl sd, int *err); |
---|
71 | phydbl tt800(); |
---|
72 | phydbl Pnorm_Ihaka_Derived_From_Cody(phydbl x); |
---|
73 | int Matinv(phydbl *x, int n, int m, int verbose); |
---|
74 | phydbl *Matrix_Mult(phydbl *A, phydbl *B, int nra, int nca, int nrb, int ncb); |
---|
75 | phydbl *Matrix_Transpose(phydbl *A, int dim); |
---|
76 | void Normal_Conditional(phydbl *mu, phydbl *cov, phydbl *a, int n, short int *is_1, int n1, phydbl *cond_mu, phydbl *cond_var); |
---|
77 | void Normal_Conditional_Unsorted(phydbl *mu, phydbl *cov, phydbl *a, int n, short int *is_1, int n1, phydbl *cond_mu, phydbl *cond_cov); |
---|
78 | phydbl Matrix_Det(phydbl *A, int size, int _log); |
---|
79 | void Get_Reg_Coeff(phydbl *mu, phydbl *cov, phydbl *a, int n, short int *is_1, int n1, phydbl *reg_coeff); |
---|
80 | phydbl Rnorm_Trunc_Inverse(phydbl mean, phydbl sd, phydbl min, phydbl max, int *error); |
---|
81 | phydbl Norm_Trunc_Sd(phydbl mu, phydbl sd, phydbl a, phydbl b); |
---|
82 | phydbl Norm_Trunc_Mean(phydbl mu, phydbl sd, phydbl a, phydbl b); |
---|
83 | int Norm_Trunc_Mean_Sd(phydbl mu, phydbl sd, phydbl a, phydbl b, phydbl *trunc_mu, phydbl *trunc_sd); |
---|
84 | phydbl Log_Dnorm_Trunc(phydbl x, phydbl mean, phydbl sd, phydbl lo, phydbl up, int *err); |
---|
85 | phydbl Pnorm_Marsaglia(phydbl x); |
---|
86 | int Iter_Matinv(phydbl *x, int n, int m, int verbose); |
---|
87 | phydbl Dorder_Unif(phydbl x, int r, int n, phydbl min, phydbl max); |
---|
88 | phydbl Covariance(phydbl *x, phydbl *y, int n); |
---|
89 | phydbl *Rnorm_Multid_Trunc_Constraint(phydbl *mu, phydbl *cov, phydbl *min, phydbl *max, phydbl *lambda, phydbl k, phydbl *res, int len); |
---|
90 | phydbl *Gradient(t_tree *tree); |
---|
91 | phydbl *Hessian_Seo(t_tree *tree); |
---|
92 | void Integrated_Brownian_Bridge_Moments(phydbl x_beg, phydbl x_end, |
---|
93 | phydbl y_beg, phydbl y_end, |
---|
94 | phydbl sd, phydbl *mean, phydbl *var); |
---|
95 | void PMat_MGF_Gamma(phydbl *Pij, phydbl shape, phydbl scale, phydbl scaling_fact, t_mod *mod); |
---|
96 | void Integrated_Geometric_Brownian_Bridge_Moments(phydbl T, phydbl A, phydbl B, phydbl u, phydbl *mean, phydbl *var); |
---|
97 | void Integrated_Geometric_Brownian_Bridge_Mean(phydbl T, phydbl A, phydbl B, phydbl u, phydbl *mean); |
---|
98 | void Integrated_Geometric_Brownian_Bridge_Var(phydbl T, phydbl A, phydbl B, phydbl u, phydbl *mean); |
---|
99 | int Sample_i_With_Proba_pi(phydbl *pi, int len); |
---|
100 | phydbl Quantile(phydbl *x, int len, phydbl p); |
---|
101 | phydbl Prob(phydbl *x, int len, phydbl z); |
---|
102 | phydbl Inverse_Truncated_Normal(phydbl y, phydbl mu, phydbl sigma, phydbl lim_inf, phydbl lim_sup); |
---|
103 | phydbl Progressive_EXP(phydbl x); |
---|
104 | int *Permutate(int len); |
---|
105 | phydbl Mantel(phydbl *x, phydbl *y, int nrow, int ncol); |
---|
106 | phydbl Weighted_Mean(phydbl *x, phydbl *w, int l); |
---|
107 | |
---|
108 | #endif |
---|