SAS Functions for Statistical Distributions

PROBBETA: probability values from a beta distribution

PROBBETA(x,a,b)

where 0<-x<= 1 and 0<a,b.

This function returns probability values from a beta distribution. The a and b values are the shape parameters of the beta distribution, and x is the value at which the distribution is to be evaluated. The density is:

The incomplete beta function may be obtained from this function by multiplying the beta probability by values of the complete beta function, which may be computed from the GAMMA function.

This function is related to many of the.common distributions of statistics and also has applications in analyzing order statistics (see Michael and Schucany, 1979).

PROBBNML: probability values from a binomial distribution PROBBNML(p,n,m)

where 0<-p<- 1, l<-n, 0<~m<=n.

This function returns the probability that an observation from a binomial distribution with parameters p and n is less than or equal to m. The binomial probability parameter is p, and n is the degree of the binomial distribution. A single term in the binomial distribution can be obtained as the difference of two values of the cumulative binomial distribution.

If X = PROBBNML(p,n,m), then:

Example:

PROBBNML(.5, 10, 4) = .37695

PROBCHI: computes probability values for the chi-square distributions

PROBCH I(x, df)

The PROBCHI function computes the probability that a random variable with a central chi-square distribution, with df degrees of freedom, falls below the x value given.

PROBF: the probability for the F distribution

PRO BF(x, ndf,ddf)

The PROBF function computes the probability that a random variable with an F distribution, with ndf numerator degrees of freedom and ddf denominator degrees of freedom, falls below the x value given. To find the significance level, use:

1 - PROBF(x, ndf, ddf).

This function accepts noninteger degrees of freedom.

PROBGAM: probability values for the gamma distribution

PROBGAM(x, eta)

The PROBGAM function computes the probability that a random variable with a gamma distribution with shape parameter r/falls below the x value given. The GAMINV function is the function inverse of PROBGAM.

The density is:

where is the shape parameter.

PROBHYPR: probabilities from a hypergeometric distribution

PROBHYPR(n n,k,n,x, or)

where:

l<=nn

l<=k<=nn

l<=n<=nn

MAX(O,k +n-nn) <= x <= MIN(k,n)

This function return~ the probability that an observation from a hypergeometric distribution with total sample nn, margins n and k, and odds ratio or is less than or equal to x. The or argument can be omitted; if it is, the or parameter is assumed to be 1.

Example:

PROBHYPR(10,5,3,2) = .9167

PROBHYPR(10,5,3,2, 1.5) = .8541

PROBNEGB: probability values for the negative binomial distribution

PROBNEGB(p,n,m)

where 0<= p<- 1, 1 <- n, and 0<= m.

This function returns the probability that an observation from a negative binomial distribution with parameters p and n is less than or equal to m. The binomial probability parameter is p and n is the degree of the negative binomial distribution. The value of a single term in the negative binomial distribution can be obtained by a difference of two values of the cumulative distribution.

If X= PROBNEGB(p,n,m) then:

Example:

PROBNEGB(.5,2,1)= .5

PROBNORM: computes probabilities for normal distributions PROBNORM(x)

The PROBNORM function computes the probability that a random variable with a normal (0,1) distribution falls below the x value given. This function is equivalent to:

The PROBIT function is the function inverse of PROBNORM.

Examples:

PROBNORM(O) = .5

PROBNORM(1.96) = .975

PROBT: the probability for the t distribution function

PROBT(x, df)

The PROBT function computes the probability that a random variable with a Student's t distribution with dfdegrees of freedom falls below the x value given. For a two-tailed test, compute the significance level by:

(1 - PROBT(ABS(x),DF))*2

This function accepts noninteger degrees of freedom.

Example:

PROBT(.9,5) = 0.795

Statistical Computing

1) Use the TPROB and/or TINV commands in SAS to generate and plot data creating the bell shaped student-t distribution curve.

Example: YES.DATA

Data;

do i=1 to 20;

t=1.5+i/10;

p=probt(t,9);

output;

end;

proc print;

proc plot;

plot p*t;

run;

2) Create a table of t-statistic values with their degrees of freedom and probabilities displayed.

Example: creating a beautiful T-table in SAS (output on green paper at computing center)

Data;

do t=0 to 4.2 by .001;

ndf=1;

array df df1-df30;

do over df;

df=1-probt(t,ndf);

ndf=ndf+1;

end;

output;

end;

proc print; id t; var df1-df10;

proc print; id t; var df11-df20;

proc print;id t; var df21-df30;

run;

Inverting a Matrix in SAS

SAS

proc iml;

xTx={5 3 2, 8 4 5, 7 9 1};

print xTx;

IxTx=INV(xTx);

print IxTx;

quit;

Inverting a Matrix in SPEAKEZ

SPEAKEZ

XTX=MATRIX(3,3: 5,3,2,8,4,5,7,9,1);

INVERSE(XTX);

quit;

help math;

help statistics;

help inverse;

help probt;

help users;

NDPRINT and POLIST are both READY mode commands.

NDPRINT FUN.DATA will cause the printer in the computing center to print the contests of the physical sequential (PS) data set FUN.DATA.

NDPRINT PDS.DATA(HTWT) will cause the printer in the computing center to print the contents of the single member. HTWT of a partitioned organization data set.

POLIST prints all members contents of a partitioned organization (PO) data set like PDS.DATA: