G08RBF (PDF version)
G08 Chapter Contents
G08 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G08RBF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

G08RBF calculates the parameter estimates, score statistics and their variance-covariance matrices for the linear model using a likelihood based on the ranks of the observations when some of the observations may be right-censored.

2  Specification

SUBROUTINE G08RBF ( NS, NV, NSUM, Y, IP, X, LDX, ICEN, GAMMA, NMAX, TOL, PRVR, LDPRVR, IRANK, ZIN, ETA, VAPVEC, PAREST, WORK, LWORK, IWA, IFAIL)
INTEGER  NS, NV(NS), NSUM, IP, LDX, ICEN(NSUM), NMAX, LDPRVR, IRANK(NMAX), LWORK, IWA(4*NMAX), IFAIL
REAL (KIND=nag_wp)  Y(NSUM), X(LDX,IP), GAMMA, TOL, PRVR(LDPRVR,IP), ZIN(NMAX), ETA(NMAX), VAPVEC(NMAX*(NMAX+1)/2), PAREST(4*IP+1), WORK(LWORK)

3  Description

Analysis of data can be made by replacing observations by their ranks. The analysis produces inference for the regression model where the location parameters of the observations, θi, for i=1,2,,n, are related by θ=Xβ. Here X is an n by p matrix of explanatory variables and β is a vector of p unknown regression parameters. The observations are replaced by their ranks and an approximation, based on Taylor's series expansion, made to the rank marginal likelihood. For details of the approximation see Pettitt (1982).
An observation is said to be right-censored if we can only observe Yj* with Yj*Yj. We rank censored and uncensored observations as follows. Suppose we can observe Yj, for j=1,2,,n, directly but Yj*, for j=n+1,,q and nq, are censored on the right. We define the rank rj of Yj, for j=1,2,,n, in the usual way; rj equals i if and only if Yj is the ith smallest amongst the Y1,Y2,,Yn. The right-censored Yj*, for j=n+1,n+2,,q, has rank rj if and only if Yj* lies in the interval Yrj,Yrj+1, with Y0=-, Yn+1=+ and Y1<<Yn the ordered Yj, for j=1,2,,n.
The distribution of the Y is assumed to be of the following form. Let FL y=ey/1+ey, the logistic distribution function, and consider the distribution function Fγy defined by 1-Fγ=1-FLy 1/γ . This distribution function can be thought of as either the distribution function of the minimum, X1,γ, of a random sample of size γ-1 from the logistic distribution, or as the Fγy-logγ being the distribution function of a random variable having the F-distribution with 2 and 2γ-1 degrees of freedom. This family of generalized logistic distribution functions Fγ.;0γ< naturally links the symmetric logistic distribution γ=1 with the skew extreme value distribution (limγ0) and with the limiting negative exponential distribution (limγ). For this family explicit results are available for right-censored data. See Pettitt (1983) for details.
Let lR denote the logarithm of the rank marginal likelihood of the observations and define the q×1 vector a by a=lRθ=0, and let the q by q diagonal matrix B and q by q symmetric matrix A be given by B-A=-lRθ=0. Then various statistics can be found from the analysis.
(a) The score statistic XTa. This statistic is used to test the hypothesis H0:β=0 (see (e)).
(b) The estimated variance-covariance matrix of the score statistic in (a).
(c) The estimate β^R=MXTa.
(d) The estimated variance-covariance matrix M=XTB-AX -1 of the estimate β^R.
(e) The χ2 statistic Q=β^RM-1​ ​β^r=aTXXTB-AX -1XTa, used to test H0:β=0. Under H0, Q has an approximate χ2-distribution with p degrees of freedom.
(f) The standard errors Mii 1/2 of the estimates given in (c).
(g) Approximate z-statistics, i.e., Zi=β^Ri/seβ^Ri for testing H0:βi=0. For i=1,2,,n, Zi has an approximate N0,1 distribution.
In many situations, more than one sample of observations will be available. In this case we assume the model,
hk Yk = XkT β+ek ,   k=1,2,,NS ,  
where NS is the number of samples. In an obvious manner, Yk and Xk are the vector of observations and the design matrix for the kth sample respectively. Note that the arbitrary transformation hk can be assumed different for each sample since observations are ranked within the sample.
The earlier analysis can be extended to give a combined estimate of β as β^=Dd, where
D-1=k=1NSXTBk-AkXk  
and
d=k= 1NS XkT ak ,  
with ak, Bk and Ak defined as a, B and A above but for the kth sample.
The remaining statistics are calculated as for the one sample case.

4  References

Kalbfleisch J D and Prentice R L (1980) The Statistical Analysis of Failure Time Data Wiley
Pettitt A N (1982) Inference for the linear model using a likelihood based on ranks J. Roy. Statist. Soc. Ser. B 44 234–243
Pettitt A N (1983) Approximate methods using ranks for regression with censored data Biometrika 70 121–132

5  Parameters

1:     NS – INTEGERInput
On entry: the number of samples.
Constraint: NS1.
2:     NVNS – INTEGER arrayInput
On entry: the number of observations in the ith sample, for i=1,2,,NS.
Constraint: NVi1, for i=1,2,,NS.
3:     NSUM – INTEGERInput
On entry: the total number of observations.
Constraint: NSUM= i=1 NS NVi .
4:     YNSUM – REAL (KIND=nag_wp) arrayInput
On entry: the observations in each sample. Specifically, Y k=1 i-1 NVk+j  must contain the jth observation in the ith sample.
5:     IP – INTEGERInput
On entry: the number of parameters to be fitted.
Constraint: IP1.
6:     XLDXIP – REAL (KIND=nag_wp) arrayInput
On entry: the design matrices for each sample. Specifically, X k=1 i-1 NVk + j l  must contain the value of the lth explanatory variable for the jth observations in the ith sample.
Constraint: X must not contain a column with all elements equal.
7:     LDX – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which G08RBF is called.
Constraint: LDXNSUM.
8:     ICENNSUM – INTEGER arrayInput
On entry: defines the censoring variable for the observations in Y.
ICENi=0
If Yi is uncensored.
ICENi=1
If Yi is censored.
Constraint: ICENi=0 or 1, for i=1,2,,NSUM.
9:     GAMMA – REAL (KIND=nag_wp)Input
On entry: the value of the parameter defining the generalized logistic distribution. For GAMMA0.0001, the limiting extreme value distribution is assumed.
Constraint: GAMMA0.0.
10:   NMAX – INTEGERInput
On entry: the value of the largest sample size.
Constraint: NMAX=max1iNSNVi and NMAX>IP.
11:   TOL – REAL (KIND=nag_wp)Input
On entry: the tolerance for judging whether two observations are tied. Thus, observations Yi and Yj are adjudged to be tied if Yi-Yj<TOL.
Constraint: TOL>0.0.
12:   PRVRLDPRVRIP – REAL (KIND=nag_wp) arrayOutput
On exit: the variance-covariance matrices of the score statistics and the parameter estimates, the former being stored in the upper triangle and the latter in the lower triangle. Thus for 1ijIP, PRVRij contains an estimate of the covariance between the ith and jth score statistics. For 1jiIP-1, PRVRi+1j contains an estimate of the covariance between the ith and jth parameter estimates.
13:   LDPRVR – INTEGERInput
On entry: the first dimension of the array PRVR as declared in the (sub)program from which G08RBF is called.
Constraint: LDPRVRIP+1.
14:   IRANKNMAX – INTEGER arrayOutput
On exit: for the one sample case, IRANK contains the ranks of the observations.
15:   ZINNMAX – REAL (KIND=nag_wp) arrayOutput
On exit: for the one sample case, ZIN contains the expected values of the function g. of the order statistics.
16:   ETANMAX – REAL (KIND=nag_wp) arrayOutput
On exit: for the one sample case, ETA contains the expected values of the function g. of the order statistics.
17:   VAPVECNMAX×NMAX+1/2 – REAL (KIND=nag_wp) arrayOutput
On exit: for the one sample case, VAPVEC contains the upper triangle of the variance-covariance matrix of the function g. of the order statistics stored column-wise.
18:   PAREST4×IP+1 – REAL (KIND=nag_wp) arrayOutput
On exit: the statistics calculated by the routine.
The first IP components of PAREST contain the score statistics.
The next IP elements contain the parameter estimates.
PAREST2×IP+1 contains the value of the χ2 statistic.
The next IP elements of PAREST contain the standard errors of the parameter estimates.
Finally, the remaining IP elements of PAREST contain the z-statistics.
19:   WORKLWORK – REAL (KIND=nag_wp) arrayWorkspace
20:   LWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which G08RBF is called.
Constraint: LWORKNMAX×IP+1.
21:   IWA4×NMAX – INTEGER arrayWorkspace
22:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,NS<1,
orTOL0.0,
orNMAXIP,
orLDPRVR<IP+1,
orLDX<NSUM,
orNMAXmax1iNS NVi,
orNVi0 for some i, i=1,2,,NS,
orNSUMi=1NSNVi,
orIP<1,
orGAMMA<0.0,
orLWORK<NMAX×IP+1.
IFAIL=2
On entry,ICENi0 or 1, for some 1iNSUM.
IFAIL=3
On entry, all the observations are adjudged to be tied. You are advised to check the value supplied for TOL.
IFAIL=4
The matrix XTB-AX is either ill-conditioned or not positive definite. This error should only occur with extreme rankings of the data.
IFAIL=5
On entry,at least one column of the matrix X has all its elements equal.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

The computations are believed to be stable.

8  Parallelism and Performance

G08RBF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G08RBF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

The time taken by G08RBF depends on the number of samples, the total number of observations and the number of parameters fitted.
In extreme cases the parameter estimates for certain models can be infinite, although this is unlikely to occur in practice. See Pettitt (1982) for further details.

10  Example

This example fits a regression model to a single sample of 40 observations using just one explanatory variable.

10.1  Program Text

Program Text (g08rbfe.f90)

10.2  Program Data

Program Data (g08rbfe.d)

10.3  Program Results

Program Results (g08rbfe.r)


G08RBF (PDF version)
G08 Chapter Contents
G08 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015