NAG CL Interface
g08rbc (rank_​regsn_​censored)

Settings help

CL Name Style:


1 Purpose

g08rbc 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

#include <nag.h>
void  g08rbc (Nag_OrderType order, Integer ns, const Integer nv[], const double y[], Integer p, const double x[], Integer pdx, const Integer icen[], double gamma, Integer nmax, double tol, double prvr[], Integer pdprvr, Integer irank[], double zin[], double eta[], double vapvec[], double parest[], NagError *fail)
The function may be called by the names: g08rbc, nag_nonpar_rank_regsn_censored or nag_rank_regsn_censored.

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×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 [Y(rj),Y(rj+1)], with Y0=-, Y(n+1)=+ and Y(1)<<Y(n) 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-FL(y)] 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×q diagonal matrix B and q×q symmetric matrix A be given by B-A=-lR(θ=0). Then various statistics can be found from the analysis.
  1. (a)The score statistic XTa. This statistic is used to test the hypothesis H0:β=0 (see (e)).
  2. (b)The estimated variance-covariance matrix of the score statistic in (a).
  3. (c)The estimate β^R=MXTa.
  4. (d)The estimated variance-covariance matrix M=(XT(B-A)X) −1 of the estimate β^R.
  5. (e)The χ2 statistic Q=β^RM-1​ ​β^r=aTX(XT(B-A)X) −1XTa, used to test H0:β=0. Under H0, Q has an approximate χ2-distribution with p degrees of freedom.
  6. (f)The standard errors Mii 1/2 of the estimates given in (c).
  7. (g)Approximate z-statistics, i.e., Zi=β^Ri/se(β^Ri) for testing H0:βi=0. For i=1,2,,n, Zi has an approximate N(0,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=1nsXT(Bk-Ak)Xk  
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 Arguments

1: order Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: ns Integer Input
On entry: the number of samples.
Constraint: ns1.
3: nv[ns] const Integer Input
On entry: the number of observations in the ith sample, for i=1,2,,ns.
Constraint: nv[i-1]1, for i=1,2,,ns.
4: y[dim] const double Input
Note: the dimension, dim, of the array y must be at least ( i=1 ns nv[i-1]).
On entry: the observations in each sample. Specifically, y[ k=1 i-1 nv[k-1]+j-1] must contain the jth observation in the ith sample.
5: p Integer Input
On entry: the number of parameters to be fitted.
Constraint: p1.
6: x[dim] const double Input
Note: the dimension, dim, of the array x must be at least
  • max(1,pdx×p) when order=Nag_ColMajor;
  • max(1,( i=1 ns nv[i-1])×pdx) when order=Nag_RowMajor.
where X(i,j) appears in this document, it refers to the array element
  • x[(j-1)×pdx+i-1] when order=Nag_ColMajor;
  • x[(i-1)×pdx+j-1] when order=Nag_RowMajor.
On entry: the design matrices for each sample. Specifically, X( k=1 i-1 nv[k-1] + 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: pdx Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
Constraints:
  • if order=Nag_ColMajor, pdx( i=1 ns nv[i-1]);
  • if order=Nag_RowMajor, pdxp.
8: icen[dim] const Integer Input
Note: the dimension, dim, of the array icen must be at least ( i=1 ns nv[i-1]).
On entry: defines the censoring variable for the observations in y.
icen[i-1]=0
If y[i-1] is uncensored.
icen[i-1]=1
If y[i-1] is censored.
Constraint: icen[i-1]=0 or 1, for i=1,2,,( i=1 ns nv[i-1]).
9: gamma double 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 Integer Input
On entry: the value of the largest sample size.
Constraint: nmax=max1ins(nv[i-1]) and nmax>p.
11: tol double 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: prvr[dim] double Output
Note: the dimension, dim, of the array prvr must be at least
  • max(1,pdprvr×p) when order=Nag_ColMajor;
  • max(1,p+1×pdprvr) when order=Nag_RowMajor.
where PRVR(i,j) appears in this document, it refers to the array element
  • prvr[(j-1)×pdprvr+i-1] when order=Nag_ColMajor;
  • prvr[(i-1)×pdprvr+j-1] when order=Nag_RowMajor.
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 1ijp, PRVR(i,j) contains an estimate of the covariance between the ith and jth score statistics. For 1jip-1, PRVR(i+1,j) contains an estimate of the covariance between the ith and jth parameter estimates.
13: pdprvr Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array prvr.
Constraints:
  • if order=Nag_ColMajor, pdprvrp+1;
  • if order=Nag_RowMajor, pdprvrp.
14: irank[nmax] Integer Output
On exit: for the one sample case, irank contains the ranks of the observations.
15: zin[nmax] double Output
On exit: for the one sample case, zin contains the expected values of the function g(.) of the order statistics.
16: eta[nmax] double Output
On exit: for the one sample case, eta contains the expected values of the function g(.) of the order statistics.
17: vapvec[nmax×(nmax+1)/2] double Output
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: parest[4×p+1] double Output
On exit: the statistics calculated by the function.
The first p components of parest contain the score statistics.
The next p elements contain the parameter estimates.
parest[2×p] contains the value of the χ2 statistic.
The next p elements of parest contain the standard errors of the parameter estimates.
Finally, the remaining p elements of parest contain the z-statistics.
19: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, ns=value.
Constraint: ns1.
On entry, p=value.
Constraint: p1.
NE_INT_2
On entry, nmax=value and p=value.
Constraint: nmax>p.
On entry, pdprvr=value and p=value.
Constraint: pdprvrp+1.
On entry, pdx=value and p=value.
Constraint: pdxp.
On entry, pdx=value and sum nv[i-1]=value.
Constraint: pdx the sum of nv[i-1].
NE_INT_ARRAY_ELEM_CONS
On entry, value elements of icen are out of range.
Constraint: icen[i]=0 or 1, for all i.
On entry, value elements of nv​ are ​<1.
Constraint: nv[i]1.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_MAT_ILL_DEFINED
The matrix XT(B-A)X is either ill-conditioned or not positive definite. This error should only occur with extreme rankings of the data.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_OBSERVATIONS
On entry, all the observations were adjudged to be tied. You are advised to check the value supplied for tol.
NE_REAL
On entry, gamma=value.
Constraint: gamma0.0.
On entry, tol=value.
Constraint: tol>0.0.
NE_REAL_ARRAY_ELEM_CONS
On entry, for j=value, X(i,j)=value for all i.
Constraint: X(i,j)X(i+1,j) for at least one i.
NE_SAMPLE
On entry, maxinv[i]=value and nmax=value.
Constraint: maxinv[i]=nmax.

7 Accuracy

The computations are believed to be stable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g08rbc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g08rbc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

The time taken by g08rbc 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 (g08rbce.c)

10.2 Program Data

Program Data (g08rbce.d)

10.3 Program Results

Program Results (g08rbce.r)