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_72.c

Go to the documentation of this file.
00001 #include "cdflib.h"
00002 double stvaln(double *p)
00003 /*
00004 **********************************************************************
00005  
00006      double stvaln(double *p)
00007                     STarting VALue for Neton-Raphon
00008                 calculation of Normal distribution Inverse
00009  
00010  
00011                               Function
00012  
00013  
00014      Returns X  such that CUMNOR(X)  =   P,  i.e., the  integral from -
00015      infinity to X of (1/SQRT(2*PI)) EXP(-U*U/2) dU is P
00016  
00017  
00018                               Arguments
00019  
00020  
00021      P --> The probability whose normal deviate is sought.
00022                     P is DOUBLE PRECISION
00023  
00024  
00025                               Method
00026  
00027  
00028      The  rational   function   on  page 95    of Kennedy  and  Gentle,
00029      Statistical Computing, Marcel Dekker, NY , 1980.
00030  
00031 **********************************************************************
00032 */
00033 {
00034 static double xden[5] = {
00035     0.993484626060e-1,0.588581570495e0,0.531103462366e0,0.103537752850e0,
00036     0.38560700634e-2
00037 };
00038 static double xnum[5] = {
00039     -0.322232431088e0,-1.000000000000e0,-0.342242088547e0,-0.204231210245e-1,
00040     -0.453642210148e-4
00041 };
00042 static int K1 = 5;
00043 static double stvaln,sign,y,z;
00044 /*
00045      ..
00046      .. Executable Statements ..
00047 */
00048     if(!(*p <= 0.5e0)) goto S10;
00049     sign = -1.0e0;
00050     z = *p;
00051     goto S20;
00052 S10:
00053     sign = 1.0e0;
00054     z = 1.0e0-*p;
00055 S20:
00056     y = sqrt(-(2.0e0*log(z)));
00057     stvaln = y+devlpl(xnum,&K1,&y)/devlpl(xden,&K1,&y);
00058     stvaln = sign*stvaln;
00059     return stvaln;
00060 } /* END */
 

Powered by Plone

This site conforms to the following standards: