Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

cdf_29.c

Go to the documentation of this file.
00001 #include "cdflib.h"
00002 void cumf(double *f,double *dfn,double *dfd,double *cum,double *ccum)
00003 /*
00004 **********************************************************************
00005  
00006      void cumf(double *f,double *dfn,double *dfd,double *cum,double *ccum)
00007                     CUMulative F distribution
00008  
00009  
00010                               Function
00011  
00012  
00013      Computes  the  integral from  0  to  F of  the f-density  with DFN
00014      and DFD degrees of freedom.
00015  
00016  
00017                               Arguments
00018  
00019  
00020      F --> Upper limit of integration of the f-density.
00021                                                   F is DOUBLE PRECISION
00022  
00023      DFN --> Degrees of freedom of the numerator sum of squares.
00024                                                   DFN is DOUBLE PRECISI
00025  
00026      DFD --> Degrees of freedom of the denominator sum of squares.
00027                                                   DFD is DOUBLE PRECISI
00028  
00029      CUM <-- Cumulative f distribution.
00030                                                   CUM is DOUBLE PRECISI
00031  
00032      CCUM <-- Compliment of Cumulative f distribution.
00033                                                   CCUM is DOUBLE PRECIS
00034  
00035  
00036                               Method
00037  
00038  
00039      Formula  26.5.28 of  Abramowitz and   Stegun   is  used to  reduce
00040      the cumulative F to a cumulative beta distribution.
00041  
00042  
00043                               Note
00044  
00045  
00046      If F is less than or equal to 0, 0 is returned.
00047  
00048 **********************************************************************
00049 */
00050 {
00051 #define half 0.5e0
00052 #define done 1.0e0
00053 static double dsum,prod,xx,yy;
00054 static int ierr;
00055 static double T1,T2;
00056 /*
00057      ..
00058      .. Executable Statements ..
00059 */
00060     if(!(*f <= 0.0e0)) goto S10;
00061     *cum = 0.0e0;
00062     *ccum = 1.0e0;
00063     return;
00064 S10:
00065     prod = *dfn**f;
00066 /*
00067      XX is such that the incomplete beta with parameters
00068      DFD/2 and DFN/2 evaluated at XX is 1 - CUM or CCUM
00069      YY is 1 - XX
00070      Calculate the smaller of XX and YY accurately
00071 */
00072     dsum = *dfd+prod;
00073     xx = *dfd/dsum;
00074     if(xx > half) {
00075         yy = prod/dsum;
00076         xx = done-yy;
00077     }
00078     else  yy = done-xx;
00079     T1 = *dfd*half;
00080     T2 = *dfn*half;
00081     bratio(&T1,&T2,&xx,&yy,ccum,cum,&ierr);
00082     return;
00083 #undef half
00084 #undef done
00085 } /* END */
 

Powered by Plone

This site conforms to the following standards: