CDFP
Prints a sample cumulative distribution function (CDF), a theoretical CDF, and confidence band information.
Required Arguments
CDF — User‑supplied FUNCTION to compute the cumulative distribution function. The form is CDF(P), where
P — Sample point. (Input)
CDF — Theoretical probability at the point P or integral of the probability density function at the point P. (Output)
X —Vector of length NOBS containing the sample. (Input)
Optional Arguments
NOBS — Number of observations. (Input)
Default: NOBS = size (X,1).
N12 —Confidence band option. (Input)
If N12 = 0, then no confidence bands are printed. If N12 = 1, then positive or upper one‑sided confidence band information is printed. If N12 = –1, then negative or lower one‑sided confidence band information is printed. If N12 = 2, then two‑sided confidence band information is printed.
Default: N12 = 2.
N95 —Confidence band option. (Input)
If N95 = 95, the 95‑percent band is desired. Otherwise, the 99‑percent band is desired.
Default: N95 = 95.
IPRINT — Print option. (Input)
If IPRINT = 1, then CDFP prints the sample CDF, the theoretical CDF, and the confidence band on the CDF. If IPRINT = 0, then the above information will not be printed.
Default: IPRINT = 1.
FORTRAN 90 Interface
Generic: CALL CDFP (CDF, X [, …])
Specific: The specific interface names are S_CDFP and D_CDFP.
FORTRAN 77 Interface
Single: CALL CDFP (CDF, NOBS, X, N12, N95, IPRINT)
Double: The double precision name is DCDFP.
Description
When IPRINT = 1, CDFP prints the sample cumulative distribution function (CDF), the theoretical CDF, and confidence bands on the CDF. The theoretical CDF will be plotted with or without the confidence band information. The sample CDF is calculated. The theoretical CDF is calculated by calling the user supplied FUNCTION subprogram CDF. Asymptotic critical values are used (from the Smirnov tables) for confidence interval calculations.
Comments
1. Workspace may be explicitly provided, if desired, by use of C2FP/DC2FP. The reference is:
CALL C2FP (CDF, NOBS, X, N12, N95, IPRINT, WKX, WK)
The additional arguments are as follows:
WKX — Vector of length NOBS containing the sorted data X in ascending order. (Output)
WK — Vector of length 4 * NOBS containing confidence band values. (Output)
WK may be dimensioned 3 * NOBS instead of 4 * NOBS for a lower or upper confidence band.
2. Note that sample CDFs are step functions.
3. Confidence bands are plotted around the sample CDF.
4. Output is written to the unit specified by the routine
UMACH (see the
Reference Material section in this manual ).
5. Printing starts on a new page with default page width 78 columns and default page length 60 rows. The user may change these values by calling the routine
PGOPT in advance.
Example
This example prints and plots the sample CDF, the theoretical CDF, and the two‑sided 95 percent band information using 70 observations. Routines
RNSET and
RNUN are called to generate these uniform (0, 1) random numbers.
USE PGOPT_INT
USE RNSET_INT
USE RNUN_INT
USE CDFP_INT
IMPLICIT NONE
INTEGER IPAGE, ISEED, NOBS
PARAMETER (NOBS=70)
REAL CDF, X(NOBS)
EXTERNAL CDF
!
ISEED = 123457
! Two-sided confidence band option.
! 95-percent band option.
! Set page width and length.
IPAGE = 78
CALL PGOPT (-1, IPAGE)
IPAGE=40
CALL PGOPT (-2, IPAGE)
! Initialize the seed.
CALL RNSET (ISEED)
! Generate pseudo-random numbers from
! a uniform (0,1) distribution.
CALL RNUN (X)
! Plot
CALL CDFP (CDF, X, IPRINT=0)
END
!
REAL FUNCTION CDF (X)
REAL X
!
CDF = X
RETURN
END
Output
Cumulative Sample and Theoretical CDFs
+::::::::::::::::+::::::::::::::::+::::::::::::::4444:4MM
0.95 + 44 M2+
. 44 MM .
. 44 4 2M1 .
. 44 4 22 1 33
0.80 + 44 2 11 33+
. 4 4 22 1 33 3 .
. 4 22 1 11 33 .
P . 44 2 1 1 3 .
r 0.65 + 4 4 2 1 33 +
o . 4 22 1 1 3 .
b . 4 22 1 1 33 .
a . 44 4 2 11 33 .
b 0.50 + 4 4 22 11 33 +
i . 4 4 221 1 33 .
l . 4 4 11 3 3 .
i . 444 2M 11 33 .
t 0.35 + 4 4 2 1 33 +
y . 44 1 M1 3 3 3 .
. 44 1 MM 33 .
. 4 112 33 .
0.20 + 4 122 33 +
.4 M 2 33 3 .
. 11M2 33 .
. 1 M2 33 .
0.05 + MM 33 +
+MM3:3333:3::::::+::::::::::::::::+::::::::::::::::+:::::
0.0 0.3 0.6 0.9
Sample Values
Sample CDF = 1 Theoretical CDF = 2
Confidence bands = 3 and 4