NAG Library Routine Document
G08RAF
1 Purpose
G08RAF 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.
2 Specification
SUBROUTINE G08RAF ( |
NS, NV, NSUM, Y, IP, X, LDX, IDIST, NMAX, TOL, PRVR, LDPRVR, IRANK, ZIN, ETA, VAPVEC, PAREST, WORK, LWORK, IWA, IFAIL) |
INTEGER |
NS, NV(NS), NSUM, IP, LDX, IDIST, NMAX, LDPRVR, IRANK(NMAX), LWORK, IWA(NMAX), IFAIL |
REAL (KIND=nag_wp) |
Y(NSUM), X(LDX,IP), 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 regression parameters arising from the following model.
For random variables
we assume that, after an arbitrary monotone increasing differentiable transformation,
, the model
holds, where
is a known vector of explanatory variables and
is a vector of
unknown regression coefficients. The
are random variables assumed to be independent and identically distributed with a completely known distribution which can be one of the following: Normal, logistic, extreme value or double-exponential. In
Pettitt (1982) an estimate for
is proposed as
with estimated variance-covariance matrix
. The statistics
and
depend on the ranks
of the observations
and the density chosen for
.
The matrix
is the
by
matrix of explanatory variables. It is assumed that
is of rank
and that a column or a linear combination of columns of
is not equal to the column vector of
or a multiple of it. This means that a constant term cannot be included in the model
(1). The statistics
and
are found as follows. Let
have pdf
and let
. Let
be order statistics for a random sample of size
with the density
. Define
, then
. To define
we need
, where
is an
by
diagonal matrix with
and
is a symmetric matrix with
. In the case of the Normal distribution, the
are standard Normal order statistics and
, for
.
The analysis can also deal with ties in the data. Two observations are adjudged to be tied if
, where
TOL is a user-supplied tolerance level.
Various statistics can be found from the analysis:
(a) |
The score statistic . This statistic is used to test the hypothesis , see (e). |
(b) |
The estimated variance-covariance matrix of the score statistic in (a). |
(c) |
The estimate . |
(d) |
The estimated variance-covariance matrix of the estimate . |
(e) |
The statistic used to test . Under , has an approximate -distribution with degrees of freedom. |
(f) |
The standard errors of the estimates given in (c). |
(g) |
Approximate -statistics, i.e., for testing . For , has an approximate distribution. |
In many situations, more than one sample of observations will be available. In this case we assume the model
where
NS is the number of samples. In an obvious manner,
and
are the vector of observations and the design matrix for the
th sample respectively. Note that the arbitrary transformation
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
, where
and
with
,
and
defined as
,
and
above but for the
th sample.
The remaining statistics are calculated as for the one sample case.
4 References
Pettitt A N (1982) Inference for the linear model using a likelihood based on ranks J. Roy. Statist. Soc. Ser. B 44 234–243
5 Parameters
- 1: NS – INTEGERInput
On entry: the number of samples.
Constraint:
.
- 2: NV(NS) – INTEGER arrayInput
On entry: the number of observations in the
th sample, for .
Constraint:
, for .
- 3: NSUM – INTEGERInput
On entry: the total number of observations.
Constraint:
.
- 4: Y(NSUM) – REAL (KIND=nag_wp) arrayInput
On entry: the observations in each sample. Specifically, must contain the th observation in the th sample.
- 5: IP – INTEGERInput
On entry: the number of parameters to be fitted.
Constraint:
.
- 6: X(LDX,IP) – REAL (KIND=nag_wp) arrayInput
On entry: the design matrices for each sample. Specifically, must contain the value of the th explanatory variable for the th observation in the th sample.
Constraint:
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 G08RAF is called.
Constraint:
.
- 8: IDIST – INTEGERInput
On entry: the error distribution to be used in the analysis.
- Normal.
- Logistic.
- Extreme value.
- Double-exponential.
Constraint:
.
- 9: NMAX – INTEGERInput
On entry: the value of the largest sample size.
Constraint:
and .
- 10: TOL – REAL (KIND=nag_wp)Input
On entry: the tolerance for judging whether two observations are tied. Thus, observations and are adjudged to be tied if .
Constraint:
.
- 11: PRVR(LDPRVR,IP) – 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 , contains an estimate of the covariance between the th and th score statistics. For , contains an estimate of the covariance between the th and th parameter estimates.
- 12: LDPRVR – INTEGERInput
On entry: the first dimension of the array
PRVR as declared in the (sub)program from which G08RAF is called.
Constraint:
.
- 13: IRANK(NMAX) – INTEGER arrayOutput
On exit: for the one sample case,
IRANK contains the ranks of the observations.
- 14: ZIN(NMAX) – REAL (KIND=nag_wp) arrayOutput
On exit: for the one sample case,
ZIN contains the expected values of the function
of the order statistics.
- 15: ETA(NMAX) – REAL (KIND=nag_wp) arrayOutput
On exit: for the one sample case,
ETA contains the expected values of the function
of the order statistics.
- 16: VAPVEC() – 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
of the order statistics stored column-wise.
- 17: PAREST() – 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.
contains the value of the statistic.
The next
IP elements of
PAREST contain the standard errors of the parameter estimates.
Finally, the remaining
IP elements of
PAREST contain the
-statistics.
- 18: WORK(LWORK) – REAL (KIND=nag_wp) arrayWorkspace
- 19: LWORK – INTEGERInput
On entry: the dimension of the array
WORK as declared in the (sub)program from which G08RAF is called.
Constraint:
.
- 20: IWA(NMAX) – INTEGER arrayWorkspace
- 21: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. 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
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | , for some , , |
or | , |
or | , |
or | . |
On entry, | , |
or | . |
-
On entry, all the observations are adjudged to be tied. You are advised to check the value supplied for
TOL.
-
The matrix is either ill-conditioned or not positive definite. This error should only occur with extreme rankings of the data.
The matrix has at least one of its columns with all elements equal.
7 Accuracy
The computations are believed to be stable.
The time taken by G08RAF 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.
9 Example
A program to fit a regression model to a single sample of observations using two explanatory variables. The error distribution will be taken to be logistic.
9.1 Program Text
Program Text (g08rafe.f90)
9.2 Program Data
Program Data (g08rafe.d)
9.3 Program Results
Program Results (g08rafe.r)