SAS DISTRIBUTION FUNCTIONS                           SPH 7460 notes.001.1

The following functions in SAS are useful:

    1.  CINV(p, df, <,nc>):  Inverse of chi-square cumulative distribution;
        p = probability, df = degrees of freedom, nc = noncentrality parameter

    2.  FINV(p, ndf, ddf, <,nc>): Inverse of CDF for the F distribution;
        p = prob, ndf = numer degrees of freedom, ddf = denom degrees of freedom

    3.  GAMINV(p, a):  Inverse of the CDF for the gamma distribution.  "a" = shape parameter

    4.  GAMMA(x): The gamma function.  Note gamma(n) = (n - 1)!

    5.  LGAMMA(x): Natural log  of the gamma function

    6.  POISSON(m, n): CDF of a Poisson distribution.  m = mean, n = nonnegative integer

    7.  PROBBETA(x, a, b): CDF of a beta distribution.  x = value between 0 and 1,
        a, b are numeric shape parameters.  Example: if a = 1 and b = 1 then this is
        the uniform distribution (special case of the beta distribution) and
        PROBBETA(x, a, b) = x.

    8.  PROBBNML(p, n, m):  CDF for the binomial.  p = prob, n = number of trials,
        m = number of successes

    9.  PROBCHI(x, df): CDF for the chi-square distribution with df degrees of freedom

   10.  PROBF(x, ndf, ddf): CDF for the F distribution

   11.  PROBGAM(x, a) CDF for the gamma distribution with parameter "a".

   12.  PROBHYPR(N, K, n, x): CDF for the hypergeometric distribution; N = population size,
        K = number of items in the category of interest, n = integer sample size,
        x = integer random variable.

        Note max(i, K + n - N) le x le min(K, n).

        Two-by-two Table:

        ------------------
        |        |        |
        |   x    | K - x  |  K
        |        |        |
        -------------------
        |        |  N - n |
        |  n - x |- K + x |  N - K
        |        |        |
        ------------------
            n      N - n    N


   13.  PROBIT(p): Inverse of the standard normal CDF
        Example: PROBIT(.975) = 1.96

   14.  PROBNORM(x): Standard normal CDF.
        Example: PROBNORM(1.96) = 0.975

   15.  PROBT(x, df): CDF for the t distribution; df = degrees of freedom

   16.  TINV(p, df): Inverse of the CDF for the t distribution with df degrees of freedom



HOW TO GRAPH PDFs in SAS:

The following is an example of how to graph the pdf for the beta
distribution:

=======================================================================

options linesize = 80 ;
footnote "~john-c/5421/graph.a.distribution.sas &sysdate &systime" ;

FILENAME GRAPH 'gsas.grf' ;
LIBNAME  loc '' ;

OPTIONS  LINESIZE = 80 MPRINT ;

GOPTIONS
         RESET = GLOBAL
         ROTATE = PORTRAIT
         FTEXT = SWISSB
         DEVICE = PSCOLOR
         GACCESS = SASGASTD
         GSFNAME = GRAPH
         GSFMODE = REPLACE
         GUNIT = PCT BORDER
         CBACK = WHITE
         hsize = 18 cm vsize = 15 cm
         HTITLE = 2 HTEXT = 1 ;

*===================================================================== ;        

* Graph the pdf for the beta distribution ... ;

data beta ;


     a = 2 ; b = 3 ; n = 100 ;

     h = .001 ;

     do i = 0 to n ;

        x = i/n ;
        y = (probbeta(x + h, a, b) - probbeta(x, a, b)) / h ;

*    Note: this previous step is a numerical estimate of the   ;
*    derivative of the CDF for the beta distribution ...       ;

       output ;

     end ;

run ;

symbol i = j v = none c = black w = 4 h = 2 ;

proc gplot data = beta ;
     plot y * x ;
title1 H = 2 "Graph of the PDF for the BETA distribution" ;
title2 H = 2 "with Parameters 2, 3" ;
run ;

=======================================================================