LETTR
Produces a letter value summary.
Required Arguments
X — Vector of length NOBS containing the data. (Input)
SUMRY — Vector of length NUM containing the summary letter values. (Output)
If NUM is 5, for example, SUMRY contains the minimum, the lower hinge (quartile), the median, the upper hinge, and the maximum, in that order.
NMISS — Number of missing values. (Output)
Optional Arguments
NOBS — Number of observations. (Input)
Default: NOBS = size (X,1).
NUM — Number of summary values. (Input)
NUM must be an odd integer greater than or equal to 3. A common value for NUM is 5.
Default: NUM = 5.
FORTRAN 90 Interface
Generic: CALL LETTR (X, SUMRY, NMISS [, …])
Specific: The specific interface names are S_LETTR and D_LETTR.
FORTRAN 77 Interface
Single: CALL LETTR (NOBS, X, NUM, SUMRY, NMISS)
Double: The double precision name is DLETTR.
Description
The routine LETTR computes the median (“M”), the minimum, the maximum, and other depths or “letter values”—hinges (“H”), eighths (“E”), sixteenths (“D”), etc.—as specified by NUM. If
NUM = 9, for example, the values in SUMRY correspond to min, D, E, H, M, H, E, D, and max, in that order. The use of letter values in summarizing a set of data is due to Tukey. Examples and discussion of the use of letter values are given by Tukey (1977, Chapter 2) and by Velleman and Hoaglin (1981, Chapter 2).
Comments
1. Workspace may be explicitly provided, if desired, by use of L2TTR/DL2TTR. The reference is:
CALL L2TTR (NOBS, X, NUM, SUMRY, NMISS, WK)
The additional argument is:
WK — Work vector of length NOBS.
2. Informational errors
Type |
Code |
Description |
3 |
3 |
The results are likely not to be meaningful if NUM is larger than the number of valid observations, (NOBS ‑ NMISS). |
4 |
4 |
The number of valid observations (NOBS ‑ NMISS) is not greater than zero. |
Example
In this example, LETTR is used to compute a letter value summary of the measurements (in inches) of precipitation in Minneapolis/St. Paul during the month of March for 30 consecutive years. These data were studied by Hinkley (1977) and by Velleman and Hoaglin (1981), pages 50 ‑ 53.
USE LETTR_INT
USE UMACH_INT
IMPLICIT NONE
INTEGER I, NMISS, NOBS, NOUT, NUM
REAL SUMRY(11), X(30)
!
DATA X/0.77, 1.74, 0.81, 1.20, 1.95, 1.20, 0.47, 1.43, 3.37,&
2.20, 3.00, 3.09, 1.51, 2.10, 0.52, 1.62, 1.31, 0.32, 0.59, &
0.81, 2.81, 1.87, 1.18, 1.35, 4.75, 2.48, 0.96, 1.89, 0.90, &
2.05/
!
CALL UMACH (2, NOUT)
NOBS = 30
NUM = 11
!
CALL LETTR (X, SUMRY, NMISS, NUM=NUM)
WRITE (NOUT,99998) SUMRY(6), (SUMRY(6-I),SUMRY(6+I),I=1,5)
99998 FORMAT (' Letter Values', /, ' Lower Upper', &
/, ' M ', F6.3, /, ' H ', F6.3, 6X, F6.3, /, &
' E ', F6.3, 6X, F6.3, /, ' D ', F6.3, 6X, F6.3, /, &
' ! ', F6.3, 6X, F6.3, /, ' m/M ', F6.3, 6X, F6.3)
WRITE (NOUT,99999) NMISS
99999 FORMAT (' There are ', I2, ' missing values.')
END
Output
Letter Values
Lower Upper
M 1.470
H 0.900 2.100
E 0.680 2.905
D 0.495 3.230
! 0.395 4.060
m/M 0.320 4.750
There are 0 missing values.