ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nmonte.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
7 #include <admodel.h>
8 
9 void generate_actual_multivariate_mixture(int nvar, const dvector& a,
10  const dvector& b, dmatrix& ch,long int& iseed, const double& lprob,
11  const dvector& w);
12 
13 double cumd_mixture_02(const double& x);
14 
15 void generate_actual_multivariate_cauchy(int nvar, const dvector& a,
16  const dvector& b, dmatrix& ch,long int& iseed, const double& lprob,
17  const dvector& w);
18 double log_likelihood_mixture_02(const double& x);
19 double log_likelihood_mixture(const double& x);
20 double inv_cumd_norm(const double& x);
21 double inv_cumd_norm_ln(const double& x);
22 double inv_cumd_norms(const double& x);
23 double cumd_norm(const double& x);
24 double ln_normal_tail_right(const double& x);
25 double ln_normal_tail_left(const double& x);
26 double ln_normal_tail(const double& x);
27 double better_rand(long int& iseed);
28 void get_bounded_mixture(double x1,double x2, const double& y,
29  const double& density, long int& iseed);
30 void get_bounded_cauchy(double x1,double x2, const double& y,
31  const double& density, long int& iseed);
32 void get_bounded_normal(double x1,double x2, const double& y,
33  const double& density, long int& iseed);
34 
35 void get_bounded_normal_virtual(double x1,double x2, const double& _y,
36  double& _log_density);
37 
38 dvector bounded_multivariate_normal(int nvar, const dvector& a1,
39  const dvector& b1, dmatrix& ch,long int& iseed);
40 
41 void generate_virtual_multivariate(int nvar, const dvector& a,
42  const dvector& b, const dmatrix& ch, const double& lprob, const dvector& eps);
43 
44 void generate_actual_multivariate(int nvar, const dvector& a, const dvector& b,
45  const dmatrix& ch, long int& iseed, const double& lprob, const dvector& w);
46 
48  dvector& b1, const dmatrix& ch, const dmatrix& ch3, const dmatrix& chinv,
49  const dmatrix& ch3inv, double contaminant,long int& iseed,
50  const double& lprob, const double& _lprob3, double& log_tprob,
51  const int& _outflag)
52 {
53  double& lprob3=(double&) _lprob3;
54  int& outflag=(int&) _outflag;
55  dvector w(1,nvar);
56  dvector a(1,nvar);
57  dvector b(1,nvar);
58  w.initialize();
59  double r = better_rand(iseed);
60  if (r>contaminant)
61  {
62  outflag=0;
63  a=a1;
64  b=b1;
65  generate_actual_multivariate(nvar,a,b,ch,iseed,lprob,w);
66  a=a1;
67  b=b1;
68  generate_virtual_multivariate(nvar,a,b,ch3,lprob3,ch3inv*w);
69  }
70  else
71  {
72  outflag=1;
73  a=a1;
74  b=b1;
75  generate_actual_multivariate(nvar,a,b,ch3,iseed,lprob3,w);
76  a=a1;
77  b=b1;
78  generate_virtual_multivariate(nvar,a,b,ch,lprob,chinv*w);
79  }
80  double tmpa=(lprob+.5*nvar);
81  double tmpb=(lprob3-nvar*log(3.0)+.5*nvar);
82  lprob3=lprob3-nvar*log(3.0);
83  //tprob=(1.-contaminant)*exp(tmpa)+contaminant*exp(tmpb);
84  if (tmpa>tmpb)
85  {
86  //tprob=exp(tmpa)*
87  //( (1.-contaminant)+contaminant*exp(tmpb-tmpa) );
88  log_tprob=tmpa+log((1.-contaminant)+contaminant*exp(tmpb-tmpa));
89  }
90  else
91  {
92  log_tprob=tmpb+log((1.-contaminant)*exp(tmpa-tmpb)+contaminant);
93  }
94  return w;
95 }
96 
98  dvector& b1, const dmatrix& _ch,long int& iseed, const double& lprob,
99  double& log_tprob, const int& _outflag)
100 {
101  dmatrix& ch=(dmatrix&)_ch;
102  int& outflag=(int&) _outflag;
103  dvector w(1,nvar);
104  dvector a(1,nvar);
105  dvector b(1,nvar);
106  w.initialize();
107  {
108  outflag=0;
109  a=a1;
110  b=b1;
111  generate_actual_multivariate_cauchy(nvar,a,b,ch,iseed,lprob,w);
112  }
113  double tmpa=(lprob+.5*nvar);
114  log_tprob=tmpa;
115  return w;
116 }
117 
119  const dvector& _b, dmatrix& ch,long int& iseed, const double& _lprob,
120  const dvector& _w)
121 {
122  double& lprob=(double&) _lprob;
123  dvector& a=(dvector&) _a;
124  dvector& b=(dvector&) _b;
125  dvector& w=(dvector&) _w;
126  double ah;
127  double bl;
128  dvector y(1,nvar);
129  lprob=0;
130  double log_density=0.0;;
131  for (int i=1;i<=nvar;i++)
132  {
133  ah=a(i)/ch(i,i);
134  bl=b(i)/ch(i,i);
135 
136  get_bounded_cauchy(ah,bl,y(i),log_density,iseed);
137  lprob += log_density;
138  for (int j=i;j<=nvar;j++)
139  {
140  double tmp=y(i)*ch(j,i);
141  w(j)+=tmp;
142  a(j)-=tmp;
143  b(j)-=tmp;
144  }
145  }
146 }
147 
149  dvector& b1, const dmatrix& _ch,long int& iseed, const double& lprob,
150  const int& _outflag)
151 {
152  dmatrix& ch=(dmatrix&)_ch;
153  int& outflag=(int&) _outflag;
154  dvector w(1,nvar);
155  dvector a(1,nvar);
156  dvector b(1,nvar);
157  w.initialize();
158  {
159  outflag=0;
160  a=a1;
161  b=b1;
162  generate_actual_multivariate_mixture(nvar,a,b,ch,iseed,lprob,w);
163  }
164  return w;
165 }
166 
168  const dvector& _b, dmatrix& ch,long int& iseed, const double& _lprob,
169  const dvector& _w)
170 {
171  double& lprob=(double&) _lprob;
172  dvector& a=(dvector&) _a;
173  dvector& b=(dvector&) _b;
174  dvector& w=(dvector&) _w;
175  double ah;
176  double bl;
177  dvector y(1,nvar);
178  lprob=0;
179  double log_density=0.0;;
180  for (int i=1;i<=nvar;i++)
181  {
182  ah=a(i)/ch(i,i);
183  bl=b(i)/ch(i,i);
184 
185  get_bounded_mixture(ah,bl,y(i),log_density,iseed);
186  lprob += log_density;
187  for (int j=i;j<=nvar;j++)
188  {
189  double tmp=y(i)*ch(j,i);
190  w(j)+=tmp;
191  a(j)-=tmp;
192  b(j)-=tmp;
193  }
194  }
195 }
196 
197 void generate_actual_multivariate(int nvar, const dvector& _a,
198  const dvector& _b, const dmatrix& ch, long int& iseed, const double& _lprob,
199  const dvector& _w)
200 {
201  double& lprob=(double&) _lprob;
202  dvector& a=(dvector&) _a;
203  dvector& b=(dvector&) _b;
204  dvector& w=(dvector&) _w;
205  double ah;
206  double bl;
207  dvector y(1,nvar);
208  lprob=0;
209  double log_density=0.0;
210  for (int i=1;i<=nvar;i++)
211  {
212  ah=a(i)/ch(i,i);
213  bl=b(i)/ch(i,i);
214 
215  get_bounded_normal(ah,bl,y(i),log_density,iseed);
216  lprob += log_density;
217  for (int j=i;j<=nvar;j++)
218  {
219  double tmp=y(i)*ch(j,i);
220  w(j)+=tmp;
221  a(j)-=tmp;
222  b(j)-=tmp;
223  }
224  }
225 }
226 
227 void generate_virtual_multivariate(int nvar, const dvector& _a,
228  const dvector& _b, const dmatrix& ch, const double& _lprob,
229  const dvector& eps)
230 {
231  double& lprob=(double&) _lprob;
232  dvector& a=(dvector&) _a;
233  dvector& b=(dvector&) _b;
234  double ah;
235  double bl;
236  dvector& y=(dvector&)(eps);
237  lprob=0;
238  double log_density;
239  for (int i=1;i<=nvar;i++)
240  {
241  ah=a(i)/ch(i,i);
242  bl=b(i)/ch(i,i);
243  get_bounded_normal_virtual(ah,bl,y(i),log_density);
244  lprob -= log_density;
245  for (int j=i;j<=nvar;j++)
246  {
247  double tmp=y(i)*ch(j,i);
248  a(j)-=tmp;
249  b(j)-=tmp;
250  }
251  }
252 }
253 
254 void get_bounded_cauchy(double x1,double x2, const double& _y,
255  const double& _log_density, long int& iseed)
256 {
257  double& log_density=(double&) _log_density;
258  double& y=(double&) _y;
259  //double lp1;
260  //double lp2;
261  //double v;
262  double w;
263  double u = better_rand(iseed);
264  {
265  double lower=cumd_cauchy(x1);
266  double upper=cumd_cauchy(x2);
267  w=-log(upper-lower);
268  u=u*.9998+.0001;
269  y = inv_cumd_cauchy(u*(upper-lower)+lower);
270  }
271  log_density=w-log(1+0.5*y*y);
272 }
273 
274 void get_bounded_mixture(double x1,double x2, const double& _y,
275  const double& _log_density, long int& iseed)
276 {
277  double& y=(double&) _y;
278  double& log_density=(double&) _log_density;
279  //double lp1;
280  //double lp2;
281  //double v;
282  double w;
283  double u = better_rand(iseed);
284  {
285  //double lower=cumd_mixture_02(x1);
286  //double upper=cumd_mixture_02(x2);
287  double lower=cumd_mixture(x1);
288  double upper=cumd_mixture(x2);
289  w=-log(upper-lower);
290  u=u*.9998+.0001;
291  //y = inv_cumd_mixture_02(u*(upper-lower)+lower);
292  y = inv_cumd_mixture(u*(upper-lower)+lower);
293  }
294  //log_density=w+log_likelihood_mixture_02(y);
295  log_density=w+log_likelihood_mixture(y);
296 }
297 
298 void get_bounded_normal(double x1,double x2, const double& _y,
299  const double& _log_density, long int& iseed)
300 {
301  double& y=(double&) _y;
302  double& log_density=(double&) _log_density;
303  double lp1;
304  double lp2;
305  double v;
306  double w;
307  double u = better_rand(iseed);
308  if (x2<-5.0)
309  {
310  lp1=ln_normal_tail(x1);
311  lp2=ln_normal_tail(x2);
312  v=exp(lp1-lp2);
313  w=-lp2-log(1.0-v);
314  y = inv_cumd_norm_ln( lp2 + log(u*(1.0-v)+v) );
315  }
316  else if (x1>5.0)
317  {
318  lp1=ln_normal_tail(x2);
319  lp2=ln_normal_tail(x1);
320  v=exp(lp1-lp2);
321  w=-lp2-log(1.0-v);
322  y = inv_cumd_norm_ln( lp2 + log(u*(1.0-v)+v) );
323  y = -y;
324  }
325  else
326  {
327  double lower=cumd_norm(x1);
328  double upper=cumd_norm(x2);
329  w=-log(upper-lower);
330  u=u*.9998+.0001;
331  y = inv_cumd_norm(u*(upper-lower)+lower);
332  }
333  log_density=w-0.5*y*y;
334 }
335 
336 void get_bounded_normal_virtual(double x1,double x2, const double& _y,
337  double& _log_density)
338 {
339  double& y=(double&) _y;
340  double& log_density=(double&) _log_density;
341  double lp1;
342  double lp2;
343  double v;
344  double w;
345  if (x2<-5.0)
346  {
347  lp1=ln_normal_tail(x1);
348  lp2=ln_normal_tail(x2);
349  v=exp(lp1-lp2);
350  w=-lp2-log(1.0-v);
351  }
352  else if (x1>5.0)
353  {
354  lp1=ln_normal_tail(x2);
355  lp2=ln_normal_tail(x1);
356  v=exp(lp1-lp2);
357  w=-lp2-log(1.0-v);
358  }
359  else
360  {
361  double lower=cumd_norm(x1);
362  double upper=cumd_norm(x2);
363  w=-log(upper-lower);
364  }
365  log_density=w-0.5*y*y;
366 }
367 
368 double ln_normal_tail(const double& x)
369 {
370  if (x<0) return ln_normal_tail_left(x);
371  return ln_normal_tail_right(x);
372 }
373 
374 double ln_normal_tail_left(const double& x)
375 {
376  if (x>-2.0)
377  {
378  cerr << "arugument of ln_normal_tail_left must be < -2.0 you have "
379  << x << endl;
380  ad_exit(1);
381  }
382  return ln_normal_tail_right(-x);
383 }
384 
385 double ln_normal_tail_right(const double& x)
386 {
387  if (x<2.0)
388  {
389  cerr << "arugument of ln_normal_tail_right must be > 2.0 you have "
390  << x << endl;
391  ad_exit(1);
392  }
393  const double a3=5;
394  const double a4=9;
395  const double a5=129;
396  double x2=x*x;
397  double lz=log(0.3989422804)-.5*x2;
398  double b1=x2+2;
399  double b2=b1*(x2+4);
400  double b3=b2*(x2+6);
401  double b4=b3*(x2+8);
402  double b5=b4*(x2+10);
403  double tmp=lz-log(x) +
404  log(1.0 -1.0/b1 +1.0/b2 - a3/b3 +a4/b4 -a5/b5);
405  return tmp;
406 }
407 
408 /*
409 Same as linad99/cumdist.cpp -> double inv_cumd_norm_inner(const double& x)
410 double inv_cumd_norm(const double& x)
411 {
412  const double c0=2.515517;
413  const double c1=0.802853;
414  const double c2=0.010328;
415  const double d1=1.432788;
416  const double d2=0.189269;
417  const double d3=0.001308;
418  if (x<=0 || x>=1.0)
419  {
420  cerr << "Illegal argument to inv_cumd_norm = " << x << endl;
421  return 0;
422  }
423 
424  if (x<0.5)
425  {
426  double t = sqrt(-2.*log(x));
427  double p=((c2*t+c1)*t+c0)/((((d3*t+d2)*t+d1)*t)+1)-t;
428  return p;
429  }
430  else if (x==0.5)
431  {
432  return 0.0;
433  }
434  else
435  {
436  double y=1.-x;
437  double t = sqrt(-2.*log(y));
438  double p=t-((c2*t+c1)*t+c0)/((((d3*t+d2)*t+d1)*t)+1);
439  return p;
440  }
441 }
442 */
443 
444 double inv_cumd_norm_ln(const double& x)
445 {
446  const double c0=2.515517;
447  const double c1=0.802853;
448  const double c2=0.010328;
449  const double d1=1.432788;
450  const double d2=0.189269;
451  const double d3=0.001308;
452  if (x>=0)
453  {
454  cerr << "Illegal argument to inv_cumd_norm = " << x << endl;
455  return 0;
456  }
457 
458  if (x<log(0.5))
459  {
460  double t = sqrt(-2.*x);
461  double p=((c2*t+c1)*t+c0)/((((d3*t+d2)*t+d1)*t)+1)-t;
462  return p;
463  }
464  else
465  {
466  double y;
467  if (x<-1.e-10)
468  {
469  y=log(1.-exp(x));
470  }
471  else
472  {
473  y=log(-x)*log(1.0+x*(0.5+0.1666666666667*x));
474  }
475  double t = sqrt(-2.*y);
476  double p=t-((c2*t+c1)*t+c0)/((((d3*t+d2)*t+d1)*t)+1);
477  return p;
478  }
479 }
480 
481 /*
482 Same as in linad99/cumdist.cpp
483 double cumd_norm(const double& x)
484 {
485  const double b1=0.319381530;
486  const double b2=-0.356563782;
487  const double b3=1.781477937;
488  const double b4=-1.821255978;
489  const double b5=1.330274429;
490  const double p=.2316419;
491  if (x>30.0)
492  {
493  return 1.0;
494  }
495  else if (x<-30.0)
496  {
497  return 0.0;
498  }
499  else if (x>=0)
500  {
501  double u=1./(1+p*x);
502  double y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
503  double z=1.0-0.3989422804*exp(-.5*x*x)*y;
504  return z;
505  }
506  else
507  {
508  double w=-x;
509  double u=1./(1+p*w);
510  double y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
511  double z=0.3989422804*exp(-.5*x*x)*y;
512  return z;
513  }
514 }
515 */
516 
517 double cumd_mixture_02(const double& x)
518 {
519  double w=0.0;
520  double w1=0.0;
521  double w2=0.0;
522  w1=cumd_norm(x);
523  w2=cumd_cauchy(x);
524  w=0.98*w1+.02*w2;
525  return w;
526 }
527 
528 
529 double cumd_mixture(const double& x)
530 {
531  double w=0.0;
532  double w1=0.0;
533  double w2=0.0;
534  w1=cumd_norm(x);
535  w2=cumd_cauchy(x);
536  w=0.95*w1+.05*w2;
537  return w;
538 }
539 
540 double log_likelihood_mixture(const double& x)
541 {
542  double y=0.5*x*x;
543  double w=log(0.379*exp(-y)+0.01254/(1.+y));
544  return w;
545 }
546 
547 
548 double log_likelihood_mixture_02(const double& x)
549 {
550  double y=0.5*x*x;
551  double w=log(0.391*exp(-y)+0.004502/(1.+y));
552  return w;
553 }
554 
555 
556 double inv_cumd_mixture(const double& zz)
557 {
558  if (zz<=0.5)
559  {
560  if (zz> 0.030328178) // 2.02
561  {
562  const double beta=0.2000006361;
563  const double a1= -1.20100758;
564  const double a2= 0.705759703;
565  const double a3= -0.3969207118;
566  const double a4= 0.1013877547;
567  const double b1= 0.4064582431;
568  const double b2= -1.313226944;
569  const double b3= -0.4745760236;
570  const double b4= 0.8704844718;
571  double t=2*zz;
572  double x=-log(t);
573  if (x>0) x=pow(x,beta);
574  double pred=inv_cumd_cauchy(zz);
575  double u=(((a4*x+a3)*x+a2)*x+a1)*x+1.0;
576  double v=(((b4*x+b3)*x+b2)*x+b1)*x+1.0;
577  return u/v*pred;
578  }
579  else if (zz>0.002235963385) // -10.0
580  {
581  const double beta=1.391943399;
582  const double a1=-0.3960836641;
583  const double a2=0.06458378977;
584  const double a3=-0.005347047973;
585  const double a4=0.0001938683488;
586  const double b1=0.1252881802;
587  const double b2=0.01855936157;
588  const double b3=-0.01768441436;
589  const double b4=0.001537604957;
590  double t=2*zz;
591  double x=-log(t);
592  if (x>0) x=pow(x,beta);
593  double pred=inv_cumd_cauchy(zz);
594  double u=(((a4*x+a3)*x+a2)*x+a1)*x+1.0;
595  double v=(((b4*x+b3)*x+b2)*x+b1)*x+1.0;
596  return u/v*pred;
597  }
598  else
599  {
600  return inv_cumd_cauchy(20.*zz);
601  }
602  }
603  else
604  {
605  return -inv_cumd_mixture(1-zz);
606  }
607 }
608 
609 double inv_cumd_mixture_02(const double& zz)
610 {
611  if (zz<=0.5)
612  {
613  if (zz> 0.030328178) // 2.02
614  {
615  const double beta=0.20000048;
616  const double a1=-2.1053015;
617  const double a2=2.4746767;
618  const double a3=-1.7449831;
619  const double a4=0.49304616;
620  const double b1=-0.27804868;
621  const double b2=-1.391687;
622  const double b3=1.0477872;
623  const double b4=-0.09850461;
624  double t=2*zz;
625  double x=-log(t);
626  if (x>0) x=pow(x,beta);
627  double pred=inv_cumd_cauchy(zz);
628  double u=(((a4*x+a3)*x+a2)*x+a1)*x+1.0;
629  double v=(((b4*x+b3)*x+b2)*x+b1)*x+1.0;
630  return u/v*pred;
631  }
632  else if (zz>0.002235963385) // -10.0
633  {
634  const double beta=1.2392131;
635  const double a1=-0.42498166;
636  const double a2=0.07016042;
637  const double a3=-0.0053910956;
638  const double a4=0.0001646762;
639  const double b1=0.18071484;
640  const double b2=0.00029307283;
641  const double b3=-0.014820049;
642  const double b4=0.0013084549;
643  double t=2*zz;
644  double x=-log(t);
645  if (x>0) x=pow(x,beta);
646  double pred=inv_cumd_cauchy(zz);
647  double u=(((a4*x+a3)*x+a2)*x+a1)*x+1.0;
648  double v=(((b4*x+b3)*x+b2)*x+b1)*x+1.0;
649  return u/v*pred;
650  }
651  else
652  {
653  return inv_cumd_cauchy(50.*zz);
654  }
655  }
656  else
657  {
658  return -inv_cumd_mixture_02(1-zz);
659  }
660 }
661 
662 /*
663 dvariable inv_cumd_norm(const prevariable& x)
664 {
665  const double c0=2.515517;
666  const double c1=0.802853;
667  const double c2=0.010328;
668  const double d1=1.432788;
669  const double d2=0.189269;
670  const double d3=0.001308;
671  if (x<=0 || x>=1.0)
672  {
673  cerr << "Illegal argument to inv_cumd_norm = " << x << endl;
674  return 0;
675  }
676 
677  if (x<0.5)
678  {
679  dvariable t = sqrt(-2.*log(x));
680  dvariable p=((c2*t+c1)*t+c0)/((((d3*t+d2)*t+d1)*t)+1)-t;
681  return p;
682  }
683  else if (x==0.5)
684  {
685  return 0.0;
686  }
687  else
688  {
689  dvariable y=1.-x;
690  dvariable t = sqrt(-2.*log(y));
691  dvariable p=t-((c2*t+c1)*t+c0)/((((d3*t+d2)*t+d1)*t)+1);
692  return p;
693  }
694 }
695 */
dvector bounded_multivariate_cauchy(int nvar, const dvector &a1, dvector &b1, const dmatrix &ch, long int &iseed, const double &lprob, double &log_tprob, const int &outflag)
Definition: nmonte.cpp:97
void get_bounded_mixture(double x1, double x2, const double &y, const double &density, long int &iseed)
Definition: nmonte.cpp:274
double inv_cumd_norm_ln(const double &x)
Definition: nmonte.cpp:444
#define x
double ln_normal_tail_right(const double &x)
Definition: nmonte.cpp:385
Vector of double precision numbers.
Definition: dvector.h:50
double ln_normal_tail_left(const double &x)
Definition: nmonte.cpp:374
double inv_cumd_norm(const double &x)
Description not yet available.
Definition: cumdist.cpp:78
double ln_normal_tail(const double &x)
Definition: nmonte.cpp:368
exitptr ad_exit
Definition: gradstrc.cpp:53
dvector bounded_multivariate_normal(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const double &_wght, const random_number_generator &rng)
double inv_cumd_norms(const double &x)
void get_bounded_normal_virtual(double x1, double x2, const double &_y, double &_log_density)
Definition: nmonte.cpp:336
double cumd_mixture_02(const double &x)
Definition: nmonte.cpp:517
double cumd_mixture(const double &x)
Definition: nmonte.cpp:529
void generate_actual_multivariate_cauchy(int nvar, const dvector &a, const dvector &b, dmatrix &ch, long int &iseed, const double &lprob, const dvector &w)
Definition: nmonte.cpp:118
prnstream & endl(prnstream &)
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2c.cpp:11
dvector bounded_multivariate_mixture(int nvar, const dvector &a1, dvector &b1, const dmatrix &_ch, long int &iseed, const double &lprob, const int &_outflag)
Definition: nmonte.cpp:148
dvector bounded_robust_multivariate_normal(int nvar, const dvector &a1, const dvector &b1, dmatrix &ch, const dmatrix &ch3, double contaminant, const double &_wght, random_number_generator &rng)
Definition: monte.cpp:256
double inv_cumd_mixture_02(const double &y)
Definition: nmonte.cpp:609
Description not yet available.
void generate_actual_multivariate_mixture(int nvar, const dvector &a, const dvector &b, dmatrix &ch, long int &iseed, const double &lprob, const dvector &w)
Definition: nmonte.cpp:167
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
double log_likelihood_mixture(const double &x)
Definition: nmonte.cpp:540
dvariable beta(const prevariable &a, const prevariable &b)
Beta density function.
Definition: vbeta.cpp:18
Description not yet available.
Definition: fvar.hpp:2819
void get_bounded_normal(double x1, double x2, const double &y, const double &density, long int &iseed)
Definition: nmonte.cpp:298
void initialize(void)
Initialze all elements of dvector to zero.
Definition: dvect5.cpp:10
double log_likelihood_mixture_02(const double &x)
Definition: nmonte.cpp:548
double inv_cumd_mixture(const double &y)
Definition: nmonte.cpp:556
#define w
double inv_cumd_cauchy(const double &x)
Description not yet available.
Definition: cumd_cau.cpp:49
double eps
Definition: ftweak.cpp:13
double cumd_cauchy(const double &x)
Description not yet available.
Definition: cumd_cau.cpp:17
double better_rand(long int &idum)
Description not yet available.
Definition: bet_rand.cpp:18
double cumd_norm(const double &x)
Culative normal distribution; constant objects.
Definition: cumdist.cpp:90
void generate_virtual_multivariate(int nvar, const dvector &a, const dvector &b, const dmatrix &ch, const double &lprob, const dvector &eps)
Definition: nmonte.cpp:227
void generate_actual_multivariate(int nvar, const dvector &a, const dvector &b, const dmatrix &ch, long int &iseed, const double &lprob, const dvector &w)
Definition: nmonte.cpp:197
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13
void get_bounded_cauchy(double x1, double x2, const double &y, const double &density, long int &iseed)
Definition: nmonte.cpp:254
d3_array pow(const d3_array &m, int e)
Description not yet available.
Definition: d3arr6.cpp:17