LILLF
Performs Lilliefors test for an exponential or normal distribution.
Required Arguments
X — Vector of length NOBS containing the observations. (Input)
XMEAN — Sample mean. (Output)
STD — Sample standard deviation. (Output)
DIF — Maximum absolute difference between the empirical and the theoretical distributions. (Output)
PROB — Approximate probability of a greater DIF. (Output)
Probabilities less than 0.01 are reported as 0.01. Probabilities greater than 0.15 for the exponential distribution or greater than 0.10 for the normal distribution are reported as 0.5. Otherwise an approximate probability is computed.
NMISS — Number of missing (NaN, not a number) values. (Output)
Optional Arguments
NOBS — Number of observations. (Input)
NOBS must be greater than 4.
Default: NOBS = size (X,1).
IPDF — Distribution option. (Input)
IPDF = 0 means a test for normality is to be performed. IPDF = 1 means a test for the exponential distribution is to be performed.
Default: IPDF = 0.
FORTRAN 90 Interface
Generic: CALL LILLF (X, XMEAN, STD, DIF, PROB, NMISS [])
Specific: The specific interface names are S_LILLF and D_LILLF.
FORTRAN 77 Interface
Single: CALL LILLF (NOBS, X, IPDF, XMEAN, STD, DIF, PROB, NMISS)
Double: The double precision name is DLILLF.
Description
Routine LILLF computes Lilliefors test and its p‑values for either a normal distribution in which both the mean and variance are estimated, or an exponential distribution in which the mean is estimated. Routine LILLF uses a modified version of IMSL routine KSONE to compute the one‑sample two‑sided Kolmogorov‑Smirnov statistic D (DIF). p‑values are then computed for the exponential distribution via linear interpolation on the tabled values given by Stephens (1974). For the normal distribution, p‑values are computed using an analytic approximation given by Dallal and Wilkinson (1986). Because Stephens’ (1974) tables are in the inclusive range (0.01, 0.15) and Dallal and Wilkinson (1986) give approximations in the range (0.01, 0.10), if the computed probability of a greater D is less than 0.01, a level 1 message is issued (such messages are not generally printed, see the Reference Material) and the probability is set to 0.01. Similarly, if the probability is greater than 0.15 (0.10 for the normal), a level 1 message is issued and the p‑value is set to 0.50. Note that because parameters are estimated, p‑values in Lilliefors test are not the same as in the Kolmogorov‑Smirnov test.
Observations from exponential or normal distributions should not be tied. If tied observations are found, an informational message is printed. Printing of this message can be turned off via a call to routine ERSET as is discussed in the Reference Material.
A general reference for Lilliefors test is Conover (1980). The original reference for the test for normality is Lilliefors (1967), while Lilliefors (1969) introduces the test for the exponential distribution.
Comments
1. Workspace may be explicitly provided, if desired, by use of L2LLF/DL2LLF. The reference is:
CALL L2LLF (NOBS, X, IPDF, XMEAN, STD, DIF, PROB, NMISS, XWK)
The additional argument is:
XWK — Work vector of length NOBS.
2. Informational errors
Type
Code
Description
1
1
The computed probability of DIF is greater than 0.15 for an exponential distribution. PROB is set to 0.50.
1
2
The computed probability of DIF is less than the tabled probability of 0.01. PROB is set to 0.01.
1
3
The computed probability of DIF is greater than 0.10 for a normal distribution. PROB is set to 0.50.
1
4
The computed probability of DIF is less than 0.01. PROB is set to 0.01.
4
5
A negative value is encountered in X when IPDF = 1. Negative values are impossible for exponential distributions.
4
6
All elements in X are tied.
Example
The following example is taken from Conover (1980, page 358). It consists of 50 observations drawn at random from a telephone book. In this example, the null hypothesis is accepted. Note that the computed probability is outside the range (0.01, 0.10), and has thus been set to .50. Because many observations in X are tied, a warning message is issued. The printing of this message can be turned off through the use of routine ERSET (Reference Material).
 
USE LILLF_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NOBS
PARAMETER (NOBS=50)
!
INTEGER NMISS, NOUT
REAL DIF, PROB, STD, X(NOBS), XMEAN
!
DATA X/23, 23, 24, 27, 29, 31, 32, 33, 33, 35, 36, 37, 40, 42, &
43, 43, 44, 45, 48, 48, 54, 54, 56, 57, 58, 57, 58, 58, 58, &
59, 61, 61, 62, 63, 64, 65, 66, 68, 68, 70, 73, 73, 74, 75, &
77, 81, 87, 89, 93, 97/
!
CALL LILLF (X, XMEAN, STD, DIF, PROB, NMISS)
!
CALL UMACH (2, NOUT)
WRITE (NOUT,'('' XMEAN = '', F9.2, /, '' STD = '', F12.3, /, '// &
' '' DIF = '', F13.4, /, '' PROB = '', F12.4, /, '// &
' '' NMISS = '', I6)') XMEAN, STD, DIF, PROB, NMISS
END
Output
 
*** WARNING ERROR 3 from L4LLF. Two or more elements in X are tied.
Here is a traceback of subprogram calls in reverse order:
Routine name Error type Error code
------------ ---------- ----------
L4LLF 6 3 (Called internally)
L3LLF 0 0 (Called internally)
L2LLF 0 0 (Called internally)
LILLF 0 0
USER 0 0
XMEAN = 55.04
STD = 19.005
DIF = 0.0811
PROB = 0.5000
NMISS = 0
Published date: 03/19/2020
Last modified date: 03/19/2020