How to: |
The NORMSINV function performs calculations on a standard normal distribution curve, finding the normalized value that forms the upper boundary of a percentile in a standard normal distribution curve. This is the inverse of NORMSDST. For information about NORMSDST, see NORMSDST: Calculating Standard Cumulative Normal Distribution.
The results of NORMSINV are returned as double-precision and are accurate to 6 significant digits.
NORMSINV(value, 'D8');
where:
Is a number between 0 and 1 (which represents a percentile in a standard normal distribution).
Is the required format for the result. The value returned by the function is double-precision. You can assign it to a field with any valid numeric format.
NORMSDST finds the percentile for the Z field. NORMSINV then returns this percentile to a normalized value:
DEFINE FILE GGPRODS -* CONVERT SIZE FIELD TO DOUBLE PRECISION X/D12.5 = SIZE; END TABLE FILE GGPRODS SUM X NOPRINT CNT.X NOPRINT -* CALCULATE MEAN AND STANDARD DEVIATION COMPUTE NUM/D12.5 = CNT.X; NOPRINT COMPUTE MEAN/D12.5 = AVE.X; NOPRINT COMPUTE VARIANCE/D12.5 = ((NUM*ASQ.X) - (X*X/NUM))/(NUM-1); NOPRINT COMPUTE STDEV/D12.5 = SQRT(VARIANCE); NOPRINT PRINT SIZE X NOPRINT -* COMPUTE NORMALIZED VALUES AND USE AS INPUT TO NORMSDST FUNCTION -* THEN USE RETURNED VALUES AS INPUT TO NORMSINV FUNCTION -* AND CONVERT BACK TO DATA VALUES COMPUTE Z/D12.5 = (X - MEAN)/STDEV; COMPUTE NORMSD/D12.5 = NORMSDST(Z, 'D8'); COMPUTE NORMSI/D12.5 = NORMSINV(NORMSD, 'D8'); COMPUTE DSIZE/D12 = NORMSI * STDEV + MEAN; BY PRODUCT_ID NOPRINT END
The output shows that NORMSINV is the inverse of NORMSDST and returns the original values:
Size Z NORMSD NORMSI DSIZE ---- - ------ ------ ----- 16 -.07298 .47091 -.07298 16 12 -.80273 .21106 -.80273 12 12 -.80273 .21106 -.80273 12 20 .65678 .74434 .65678 20 24 1.38654 .91721 1.38654 24 20 .65678 .74434 .65678 20 24 1.38654 .91721 1.38654 24 16 -.07298 .47091 -.07298 16 12 -.80273 .21106 -.80273 12 8 -1.53249 .06270 -1.53249 8
WebFOCUS |