NRCES
Computes maximum likelihood estimates of the mean and variance from grouped and/or censored normal data.
Required Arguments
XRT — Vector of length NOBS containing either the exact value of the data or the right endpoint of the censoring interval for interval-censored or right-censored data. (Input)
See the argument ICEN.
XLT — Vector of length NOBS containing the left endpoint of the censoring interval for interval-censored or left-censored data. (Input)
See the argument ICEN. XLT is not used if there is no left censoring.
ICEN — Vector of length NOBS containing the censoring codes. (Input)
The values in ICEN indicate the meaning of the values in XRT and/or XLT.
ICEN(I) |
Censoring |
0 |
Exact response at XRT(I). |
1 |
Right censored. The response is greater than XRT(I). |
2 |
Left censored. The response is less than or equal to XLT(I). |
3 |
Interval censored. The response is greater than XRT(I), but less than or equal to XLT(I). |
XMEAN — Estimate of the mean. (Input/Output if INIT = 0; output otherwise)
XSIGMA — Estimate of the standard deviation. (Input/Output if INIT = 0; output otherwise)
VXM — Estimate of the variance of the mean estimate. (Output)
VXS — Estimate of the variance of the variance estimate. (Output)
COVXMS — Estimate of the covariance of the mean and the variance estimates. (Output)
NUMBER — Vector of length 4 containing the numbers of observations having the various censoring properties. (Output)
NUMBER(1) is the number of exact observations. NUMBER(2) is the number of observations specified by a lower bound (right censored). NUMBER(3) is the number of observations specified by a upper bound (left censored). NUMBER(4) is the number of observations specified by an interval.
Optional Arguments
NOBS — Number of observations. (Input)
Default: NOBS = size (XRT,1).
EPSM — Convergence criterion for the mean estimate. (Input)
See the argument EPSSIG. If EPSM is not positive, EPSM = 0.00001 is assumed.
Default: EPSM = .00001.
EPSSIG — Convergence criterion for the variance estimate. (Input)
Convergence is assumed when the relative change in the mean estimate is less than EPSM and the relative change in the variance estimate is less than EPSSIG . If EPSSIG is not positive, EPSSIG = 0.00001 is assumed.
Default: EPSSIG = .00001.
MAXITS — Maximum number of iterations allowed. (Input)
A typical value of MAXITS is 25.
Default: MAXITS = 25.
INIT — Initialization option. (Input)
Default: INIT = 1.
INIT |
Action |
0 |
On input, XMEAN and XSIGMA contain initial estimates of the parameters. |
1 |
If there are enough exactly specified data, initial estimates are obtained from it; and, if there are not enough such data, fixed starting values (XRT(1) for the mean and 1.0 for the variance) are used. |
FORTRAN 90 Interface
Generic: CALL NRCES (XRT, XLT, ICEN, XMEAN, XSIGMA, VXM, VXS, COVXMS,
NUMBER [, …])
Specific: The specific interface names are S_NRCES and D_NRCES.
FORTRAN 77 Interface
Single: CALL NRCES (NOBS, XRT, XLT, ICEN, EPSM, EPSSIG, MAXITS, INIT, XMEAN, XSIGMA, VXM, VXS, COVXMS, NUMBER)
Double: The double precision name is DNRCES.
Description
The routine NRCES computes maximum likelihood estimates of the mean and variance of a normal population, using a sample that may be censored. An observation whose value is known exactly is input in XRT, and the corresponding element in ICEN is set to 0. If an observation is known only by a lower bound, we say the observation is right censored; the lower bound is input in XRT, and the corresponding element in ICEN is set to 1. If an observation is known only by an upper bound, we say the observation is left censored; the upper bound is input in XLT, and the corresponding element in ICEN is set to 2. If an observation is known only by two bounds, we say the observation is interval censored; the lower bound is input in XRT, the upper bound is input in XLT, and the corresponding element in ICEN is set to 3.
Newton-Raphson iterations are used to find a stationary point of the likelihood function, and the Hessian at that point is used to estimate the variances and covariance of the estimates of the population mean and variance. If the numerical derivative of the estimate of the variance increases on nine consecutive iterations, the process is deemed divergent and a terminal error is issued. The iterations begin at user-supplied values if INIT is set to 0.
Example
This example uses an artificial data set consisting of 18 observations. The first 12 observations are known exactly; the next three are known only by a lower bound; the next two, by an upper bound; and the last one, by two bounds.
USE NRCES_INT
USE UMACH_INT
IMPLICIT NONE
INTEGER NOBS
PARAMETER (NOBS=18)
!
INTEGER ICEN(NOBS), INIT, MAXITS, NOUT, NUMBER(4)
REAL COVXMS, EPSM, EPSSIG, VXM, VXS, XLT(NOBS), XMEAN, &
XRT(NOBS), XSIGMA
!
DATA XRT/4.5, 5.4, 3.9, 5.1, 4.6, 4.8, 2.9, 6.3, 5.5, 4.6, 4.1, &
5.2, 3.2, 4.0, 3.1, 0.0, 0.0, 2.2/
DATA XLT/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
0.0, 0.0, 0.0, 0.0, 5.1, 3.8, 2.5/
DATA ICEN/0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3/
!
CALL UMACH (2, NOUT)
EPSM = 0.01
EPSSIG = 0.01
MAXITS = 25
INIT = 1
CALL NRCES (XRT, XLT, ICEN, XMEAN, XSIGMA, VXM, VXS, COVXMS, &
NUMBER, EPSM=EPSM, EPSSIG=EPSSIG)
WRITE (NOUT,99999) XMEAN, XSIGMA, VXM, VXS, COVXMS, NUMBER
99999 FORMAT (' Estimate of mean: ', F8.4, &
/, ' Estimate of variance: ', F8.4, &
/, ' Estimate of variance of mean estimate: ', F8.4, &
/, ' Estimate of variance of variance estimate: ', F8.4, &
/, ' Estimate of covariance of mean and variance:', F8.4, &
/, ' Number of exact observations: ', I4, &
/, ' Number of right-censored observations: ', I4, &
/, ' Number of left-censored observations: ', I4, &
/, ' Number of interval-censored observations: ', I4)
END
Output
Estimate of mean: 4.4990
Estimate of standard deviation: 1.2304
Estimate of variance of mean estimate: 0.0819
Estimate of variance of variance estimate: -0.0494
Estimate of covariance of mean and variance: -0.0019
Number of exact observations: 12
Number of right-censored observations: 3
Number of left-censored observations: 2
Number of interval-censored observations: 1