23 const int& level_index,
int index)
35 double tmp=fval(mmin);
38 for (i=mmin+1;i<=mmax;i++)
58 for (i=mmin+1;i<=mmax;i++)
60 integral+=fval(i)*(xs(i)-xs(i-1));
62 cout << integral <<
endl;
69 left_bd(level_index)=xs(lower);
70 right_bd(level_index)=xs(upper);
74 if (fval(lb)>=fval(rb) || rb==fval.
indexmax())
78 xdiff=xs(lb)-xs(lb-1);
83 xdiff=xs(minind+1)-xs(minind);
85 double incr=fval(lb)*xdiff/integral;
87 if ( incr >= (siglevel(level_index)-isum))
89 double diff = siglevel(level_index) - isum;
90 double delta=diff/incr;
93 left_bd(level_index)=xs(lb)-delta*(xdiff);
97 left_bd(level_index)=xs(fval.
indexmin());
99 right_bd(level_index)=xs(rb);
107 xdiff=xs(rb)-xs(rb-1);
108 double incr=fval(rb)*xdiff/integral;
110 if ( incr >= (siglevel(level_index)-isum) ||
113 double diff = siglevel(level_index) - isum;
114 double delta=diff/incr;
115 left_bd(level_index)=xs(lb);
116 right_bd(level_index)=xs(rb)+delta*(xdiff);
127 const int& level_index,
int index)
138 for (ii=lb+1;ii<=ub;ii++)
140 tmpsum+=fval(ii)*(xs(ii)-xs(ii-1));
144 for (ii=lb+1;ii<=ub;ii++)
146 xdiff=xs(ii)-xs(ii-1);
147 double incr=fval(ii)*xdiff/tmpsum;
148 double fdiff = 1.-siglevel(level_index) - isum;
151 double delta=fdiff/incr;
152 left_bd(level_index)=xs(ii)+delta*xdiff;
159 for (ii=ub-1;ii>=lb;ii--)
161 xdiff=xs(ii+1)-xs(ii);
162 double incr=fval(ii)*xdiff/tmpsum;
163 double fdiff = 1.-siglevel(level_index) - isum;
166 double delta=fdiff/incr;
167 right_bd(level_index)=xs(ii)+delta*xdiff;
void get_onesided_intervals(const dvector &left_bd, const dvector &right_bd, dmatrix &ms, const dvector &xs, const dvector &siglevel, const int &level_index, dvector &xdist, int index)
int xxxmin(const int x, const int y)
Vector of double precision numbers.
int indexmin() const
Get minimum valid index.
void get_confidence_interval(const dvector &left_bd, const dvector &right_bd, dmatrix &ms, const dvector &xs, const dvector &siglevel, const int &level_index, dvector &xdist, int index)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
prnstream & endl(prnstream &)
int indexmax() const
Get maximum valid index.
Description not yet available.
Description not yet available.
int xxxmax(const int x, const int y)