#include <statdist.h>
Inheritance diagram for matvec::FDist:

Definition at line 227 of file statdist.h.
Public Methods | |
| FDist (const double df1, const double df2, const double nc=0.0) | |
| FDist (const FDist &u) | |
| void | display (void) const |
| void | reset (const double df1, const double df2, const double nc=0.0) |
| void | sample (Vector< double > &x) const |
| void | sample (doubleMatrix &x) const |
| double | sample (void) const |
| Vector< double > | sample (unsigned n) const |
| doubleMatrix | sample (unsigned m, unsigned n) const |
| double | mean (void) const |
| double | variance (void) const |
| double | nonc (void) const |
| double | pdf (const double x) const |
| double | cdf (const double x) const |
| double | mgf (const double t) const |
| double | inv (const double p) const |
| double | nonct (const double cv, const double p) const |
| double | parameter (const int k) const |
| void | parameter (const int k, const double x) |
| virtual const std::string | name (void) const |
| virtual double | nonct (const double cv, const double p) |
Protected Attributes | |
| double | df1_value |
| double | df2_value |
| double | nc_value |
| std::string | distname |
|
||||||||||||||||
|
Definition at line 231 of file statdist.h. References matvec::StatDistBase::distname, and reset().
|
|
|
Definition at line 233 of file statdist.h. References matvec::StatDistBase::distname, and reset().
00233 :StatDistBase() 00234 {distname="FDist";reset(u.df1_value,u.df2_value,u.nc_value);} |
|
|
Implements matvec::StatDistBase. Definition at line 248 of file statdist.h. References df1_value, df2_value, matvec::F_cdf(), and nc_value.
|
|
|
Implements matvec::StatDistBase. Definition at line 236 of file statdist.h. References df1_value, df2_value, matvec::StatDistBase::distname, and nc_value.
|
|
|
Implements matvec::StatDistBase. Definition at line 251 of file statdist.h. References df1_value, df2_value, matvec::F_inv(), and nc_value.
|
|
|
Implements matvec::StatDistBase. Definition at line 645 of file statdist.cpp. |
|
|
Implements matvec::StatDistBase. Definition at line 639 of file statdist.cpp. References df1_value, df2_value, and nc_value.
|
|
|
Definition at line 45 of file statdistbase.h. References matvec::StatDistBase::distname.
00045 {return distname;}
|
|
|
Definition at line 246 of file statdist.h. References nc_value.
00246 {return nc_value;}
|
|
||||||||||||
|
Definition at line 58 of file statdistbase.h.
00058 {std::cerr << "error\n"; return 0.0;}
|
|
||||||||||||
|
Definition at line 663 of file statdist.cpp. References df1_value, df2_value, and nc_value.
00665 {
00666 if (df2_value < 5) throw exception("FDist::variance(): not exist: df2 < 5");
00667 double x,v1,v2,t1,t2;
00668 v1 = df1_value;
00669 v2 = df2_value;
00670 x = v2 - 2.0;
00671 t1 = v2*v2*((v1+nc_value)*(v1+nc_value) + (v1+nc_value*2.0)*x);
00672 t2 = v1*v1*x*x*(v2 - 4.0);
00673 return t1/t2*2.0;
00674 }
00675
00676 double FDist::nonct(const double cv,const double p) const
00677 {
00678 if (p<0.0 || p>1.0) throw exception("FDist::nonct(): bad arg, value between (0,1) expected");
00679 double p2,ppf;
00680 if (df2_value >= 3) {
00681 ppf = df2_value/(df2_value -2.0);
00682 }
00683 else {
00684 ppf = 0.0;
00685 }
00686 double eps = 1.0e-6;
00687 double bot = 0.0;
00688 double top = ppf + 6000.0;
00689 int errcode = 0;
00690 while (top-bot > eps) {
00691 ppf = (top + bot)*0.5;
00692 p2 = F_cdf(cv,df1_value,df2_value,ppf,errcode);
|
|
||||||||||||
|
Implements matvec::StatDistBase. Definition at line 762 of file statdist.cpp.
00763 {
00764 par = df2_value;
00765 }
00766 else if (k==3) {
00767 par = nc_value;
00768 }
00769 else {
00770 throw exception("FDist::parameter(): bad arg value, 1(2,3) is expected");
00771 }
00772 return par;
00773 }
00774
00775 void FDist::parameter(const int k,const double x)
00776 {
00777 if (k==1) {
00778 if (x <= 0.0) {
00779 throw exception("FDist::parameter(): bad arg2, positives expected");
00780 }
00781 else {
00782 df1_value = x;
00783 }
00784 }
00785 else if (k==2) {
00786 if (x <= 0.0) {
00787 throw exception("FDist::parameter(): bad arg2, positives expected");
00788 }
00789 else {
00790 df2_value = x;
00791 }
|
|
|
Implements matvec::StatDistBase. Definition at line 744 of file statdist.cpp. References sample().
00744 {
00745 Vector<double> x(n);
00746 sample(x);
00747 return x;
00748 }
00749
00750 doubleMatrix FDist::sample(unsigned m,unsigned n) const
00751 {
00752 doubleMatrix x(m,n);
00753 sample(x);
00754 return x;
00755 }
00756
00757 double FDist::parameter(const int k) const
00758 {
00759 double par = 0.0;
00760 if (k==1) {
|
|
|
If U1 is distributed as
is called the non-central F distribution with r1 (integer) and r2 (integer) degrees of freedom and non-centrality parameter Implements matvec::StatDistBase. Definition at line 625 of file statdist.cpp. References df1_value, df2_value, and nc_value.
00634 {U_1/r_1}{U_2/r_2}
00635 \f]
00636 is called the non-central F distribution with r1 (integer) and r2 (integer) degrees of freedom and non-centrality parameter \f$\delta\f$ (real).
00637 */
|
|
||||||||||||||||
|
Definition at line 610 of file statdist.cpp. Referenced by FDist().
00611 {
00612 nc_value = x;
00613 }
00614 else {
00615 throw exception("tDist::parameter(): bad arg1");
00616 }
00617 }
00618
|
|
||||||||||||
|
Implements matvec::StatDistBase. Definition at line 737 of file statdist.cpp. References nc_value. |
|
|
Implements matvec::StatDistBase. Definition at line 730 of file statdist.cpp. References matvec::genf().
00730 {
00731 bot = x[i]; top = &bot[nc];
00732 while (bot < top ) *bot++ = genf(df1,df2);
00733 }
00734 }
00735 else {
|
|
|
Implements matvec::StatDistBase. Definition at line 241 of file statdist.h. References df1_value, df2_value, and matvec::genf(). Referenced by parameter().
|
|
|
Implements matvec::StatDistBase. Definition at line 708 of file statdist.cpp. References matvec::genf(), matvec::gennf(), and nc_value.
00708 {
00709 double *bot = x.begin();
00710 double *top = x.end();
00711 int df1 = static_cast<int>(df1_value);
00712 int df2 = static_cast<int>(df2_value);
00713 if (nc_value == 0.0) {
00714 while (bot < top ) *bot++ = genf(df1,df2);
00715 }
00716 else {
00717 while (bot < top ) *bot++ = gennf(df1,df2,nc_value);
00718 }
00719 }
00720
00721 void FDist::sample(doubleMatrix& x) const
00722 {
00723 int nr = x.num_rows();
00724 int nc = x.num_cols();
00725 double *bot,*top;
00726 unsigned i;
00727 int df1 = static_cast<int>(df1_value);
00728 int df2 = static_cast<int>(df2_value);
|
|
|
Implements matvec::StatDistBase. Definition at line 694 of file statdist.cpp.
00694 {
00695 top = ppf;
00696 }
00697 else if (p2 > p) {
00698 bot = ppf;
00699 }
00700 else {
00701 break;
00702 }
00703 }
00704 return ppf;
00705 }
00706
|
|
|
Implements matvec::StatDistBase. Definition at line 651 of file statdist.cpp.
00653 {
00654 throw exception("FDist:mgf(): not available yet");
00655 return 0.0;
00656 }
00657
00658 double FDist::mean(void) const
00659 {
00660 if (df2_value < 3 ) throw exception(" FDist::mean(): not exist: df2 < 3");
00661 return df2_value*(df1_value + nc_value)/(df1_value*(df2_value - 2.0));
|
|
|
Definition at line 229 of file statdist.h. Referenced by cdf(), display(), inv(), mgf(), nonct(), pdf(), and sample(). |
|
|
Definition at line 229 of file statdist.h. Referenced by cdf(), display(), inv(), mgf(), nonct(), pdf(), and sample(). |
|
|
|
Definition at line 229 of file statdist.h. Referenced by cdf(), display(), inv(), mgf(), nonc(), nonct(), pdf(), and sample(). |
1.2.16