NAG Library Routine Document
G02DNF gives the estimate of an estimable function along with its standard error.
|SUBROUTINE G02DNF (
||IP, IRANK, B, COV, P, F, EST, STAT, SESTAT, T, TOL, WK, IFAIL)
||IP, IRANK, IFAIL
||B(IP), COV(IP*(IP+1)/2), P(IP*IP+2*IP), F(IP), STAT, SESTAT, T, TOL, WK(IP)
G02DNF computes the estimates of an estimable function for a general linear regression model which is not of full rank. It is intended for use after a call to G02DAF
. An estimable function is a linear combination of the parameters such that it has a unique estimate. For a full rank model all linear combinations of parameters are estimable.
In the case of a model not of full rank the routines use a singular value decomposition (SVD) to find the parameter estimates,
, and their variance-covariance matrix. Given the upper triangular matrix
obtained from the
decomposition of the independent variables the SVD gives
diagonal matrix with nonzero diagonal elements,
being the rank of
orthogonal matrices. This gives the solution
being the first
being the first
being the first
Details of the SVD are made available in the form of the matrix
as given by G02DAF
A linear function of the parameters, , can be tested to see if it is estimable by computing . If is zero, then the function is estimable; if not, the function is not estimable. In practice is tested against some small quantity .
is estimable it can be estimated by
and its standard error calculated from the variance-covariance matrix of
can be computed. The
-statistic will have a Student's
-distribution with degrees of freedom as given by the degrees of freedom for the residual sum of squares for the model.
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Hammarling S (1985) The singular value decomposition in multivariate statistics SIGNUM Newsl. 20(3) 2–25
Searle S R (1971) Linear Models Wiley
- 1: IP – INTEGERInput
On entry: , the number of terms in the linear model.
- 2: IRANK – INTEGERInput
On entry: , the rank of the independent variables.
- 3: B(IP) – REAL (KIND=nag_wp) arrayInput
: the IP
values of the estimates of the parameters of the model,
- 4: COV() – REAL (KIND=nag_wp) arrayInput
: the upper triangular part of the variance-covariance matrix of the IP
parameter estimates given in B
. They are stored packed by column, i.e., the covariance between the parameter estimate given in
and the parameter estimate given in
, is stored in
- 5: P() – REAL (KIND=nag_wp) arrayInput
: as returned by G02DAF
- 6: F(IP) – REAL (KIND=nag_wp) arrayInput
On entry: , the linear function to be estimated.
- 7: EST – LOGICALOutput
: indicates if the function was estimable.
- The function is estimable.
- The function is not estimable and STAT, SESTAT and T are not set.
- 8: STAT – REAL (KIND=nag_wp)Output
contains the estimate of the function,
- 9: SESTAT – REAL (KIND=nag_wp)Output
contains the standard error of the estimate of the function,
- 10: T – REAL (KIND=nag_wp)Output
-statistic for the test of the function being equal to zero.
- 11: TOL – REAL (KIND=nag_wp)Input
, the tolerance value used in the check for estimability.
- , where is the machine precision, is used instead.
- 12: WK(IP) – REAL (KIND=nag_wp) arrayWorkspace
- 13: IFAIL – INTEGERInput/Output
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, because for this routine the values of the output parameters may be useful even if
on exit, the recommended value is
. When the value is used it is essential to test the value of IFAIL 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
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Note: G02DNF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
|On entry,||. In this case EST is returned as true and all statistics are calculated.|
Standard error of statistic
; this may be due to rounding errors if the standard error is very small or due to mis-specified inputs COV
The computations are believed to be stable.
The value of estimable functions is independent of the solution chosen from the many possible solutions. While G02DNF may be used to estimate functions of the parameters of the model as computed by G02DKF
, these must be expressed in terms of the original parameters,
. The relation between the two sets of parameters may not be straightforward.
Data from an experiment with four treatments and three observations per treatment are read in. A model, with a mean term, is fitted by G02DAF
. The number of functions to be tested is read in, then the linear functions themselves are read in and tested with G02DNF. The results of G02DNF are printed.
9.1 Program Text
Program Text (g02dnfe.f90)
9.2 Program Data
Program Data (g02dnfe.d)
9.3 Program Results
Program Results (g02dnfe.r)