26 void sBinomial (std::vector<double>&dist,
int trials,
double prob){
30 double pmf=
bin_coef(trials,i)*pow(prob,i)*pow(1-prob,trials-i);
48 void cBinomial (std::vector<double>&dist,
int trials,
double prob){
52 double pmf=
bin_coef(trials,i)*pow(prob,i)*pow(1-prob,trials-i);
74 void sBetaBinomial (std::vector<double>& dist,
int trials,
double a,
double b){
77 double newAlpha = (double) i + a;
78 double newBeta = (double)(trials-i) + b;
101 void cBetaBinomial (std::vector<double>& dist,
int trials,
double a,
double b){
104 double newAlpha = (double) i + a;
105 double newBeta = (double)(trials-i) + b;
128 for (
int i=0;i<value;i++){
142 for (
int i=0;i<value;i++){
152 void sUniform (std::vector<double> &dist,
int lower,
int upper){
153 for(
int k=0;k<=upper;k++){
157 else if (k>=lower && k<=upper){
158 double val=(k-lower+1)/(upper-lower+1);
159 dist.push_back(1-val);
167 void cUniform (std::vector<double> &dist,
int lower,
int upper){
168 for(
int k=0;k<=upper;k++){
172 else if (k>=lower && k<=upper){
173 double val=(k-lower+1)/(upper-lower+1);
234 void sCauchy(std::vector<double> &dist,
double location,
double scale){
237 double val=1-((1/M_PI)*atan((i-location)/scale)+0.5);
253 double val = 1.0/tgamma(df/2.0);
265 for (
double i=1; i<
maximum;i++){
267 double val=1.0/tgamma(df/2.0);
273 if (fabs(val)<0.00001){
294 double val=exp(-1*lambda*i);
311 double val=1-exp(-1*lambda*i);
359 double val=1-
ribeta((dOne*i)/((dOne*i)+dTwo), dOne/2, dTwo/2);
375 double val=
ribeta((dOne*i)/((dOne*i)+dTwo), dOne/2, dTwo/2);
392 void sGamma(std::vector<double> &dist,
double shape,
double scale){
395 double val=1-
igamma_lower(shape, i/scale)/tgamma(shape);
407 void cGamma(std::vector<double> &dist,
double shape,
double scale){
427 double val=pow((1-p),i+1);
441 double val=1-pow((1-p),i+1);
457 void sLaplace(std::vector<double> &dist ,
double location,
double scale){
460 double val=(1/(2*scale))*exp(-1*(fabs(i-location)/scale));
472 void sLogNormal(std::vector<double> &dist,
double location,
double scale){
475 double val=0.5+0.5*(
erf((log(i-location)/sqrt(2*pow(scale,2)))));
492 double pmf=(-1/log(1-prob))*((pow(prob,i)/i));
506 void sLogistic(std::vector<double> &dist,
double location,
double scale){
509 double val=1-(1/(1+exp(-1*(i-location)/scale)));
525 double error=
erf(i/(sqrt(2)*scale));
526 double i_squared=-1*pow((
double)i,2);
527 double val=sqrt(2*(1/M_PI))*((double)i*exp(i_squared/(2*pow(scale,2)))/scale);
528 double boltz=1-(error-val);
533 dist.push_back(boltz);
543 double val=
ribeta(p, i+1, r);
590 void sNormal(std::vector<double> &dist,
double mean,
double stdev){
593 double val=1-(0.5*(1+
erf((i-mean)/sqrt(2*pow(stdev,2)))));
606 void sPareto(std::vector<double> &dist,
double shape,
double scale){
608 double val=pow((scale/(
double) i),shape);
620 void sPoisson(std::vector<double> &dist,
double lambda){
636 void sRayleigh(std::vector<double> &dist,
double sigma){
639 double val=exp((-1*(pow((
double) i, 2)))/(2*pow(sigma,2)));;
654 for(
int x=0;x<=b;x++){
658 else if (x>=a && x<=c){
659 val=pow((
double)(x-a),2)/((b-a)*(c-a));
660 dist.push_back(1-val);
663 val=pow((
double)(b-x),2)/((b-a)*(b-c));
674 void sUser (std::vector<double>&dist, std::vector<double> &prob_dist){
677 for(
int i=0;i<prob_dist.size();i++){
679 dist.push_back(c_df);
682 for(
int i=0; i<dist.size();i++){
689 void sWeibull(std::vector<double> &dist,
double shape,
double scale){
692 double val=exp(-1*pow(i/scale,shape));