NAG FL Interface
g02dnf (linregm_estfunc)
1
Purpose
g02dnf gives the estimate of an estimable function along with its standard error.
2
Specification
Fortran Interface
Subroutine g02dnf ( |
ip, irank, b, cov, p, f, est, stat, sestat, t, tol, wk, ifail) |
Integer, Intent (In) |
:: |
ip, irank |
Integer, Intent (Inout) |
:: |
ifail |
Real (Kind=nag_wp), Intent (In) |
:: |
b(ip), cov(ip*(ip+1)/2), p(ip*ip+2*ip), f(ip), tol |
Real (Kind=nag_wp), Intent (Out) |
:: |
stat, sestat, t, wk(ip) |
Logical, Intent (Out) |
:: |
est |
|
C Header Interface
#include <nag.h>
void |
g02dnf_ (const Integer *ip, const Integer *irank, const double b[], const double cov[], const double p[], const double f[], logical *est, double *stat, double *sestat, double *t, const double *tol, double wk[], Integer *ifail) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
g02dnf_ (const Integer &ip, const Integer &irank, const double b[], const double cov[], const double p[], const double f[], logical &est, double &stat, double &sestat, double &t, const double &tol, double wk[], Integer &ifail) |
}
|
The routine may be called by the names g02dnf or nagf_correg_linregm_estfunc.
3
Description
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 or
g02ddf. 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
where
is a
by
diagonal matrix with nonzero diagonal elements,
being the rank of
, and
and
are
by
orthogonal matrices. This gives the solution
being the first
columns of
, i.e.,
,
being the first
columns of
, and
being the first
elements of
.
Details of the SVD are made available in the form of the matrix
:
as given by
g02daf and
g02ddf.
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 .
Given that
is estimable it can be estimated by
and its standard error calculated from the variance-covariance matrix of
,
, as
Also a
-statistic,
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.
4
References
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
5
Arguments
-
1:
– Integer
Input
-
On entry: , the number of terms in the linear model.
Constraint:
.
-
2:
– Integer
Input
-
On entry: , the rank of the independent variables.
Constraint:
.
-
3:
– Real (Kind=nag_wp) array
Input
-
On entry: the
ip values of the estimates of the parameters of the model,
.
-
4:
– Real (Kind=nag_wp) array
Input
-
On entry: 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:
– Real (Kind=nag_wp) array
Input
-
On entry: as returned by
g02daf and
g02ddf.
-
6:
– Real (Kind=nag_wp) array
Input
-
On entry: , the linear function to be estimated.
-
7:
– Logical
Output
-
On exit: indicates if the function was estimable.
- The function is estimable.
- The function is not estimable and stat, sestat and t are not set.
-
8:
– Real (Kind=nag_wp)
Output
-
On exit: if
,
stat contains the estimate of the function,
.
-
9:
– Real (Kind=nag_wp)
Output
-
On exit: if
,
sestat contains the standard error of the estimate of the function,
.
-
10:
– Real (Kind=nag_wp)
Output
-
On exit: if
,
t contains the
-statistic for the test of the function being equal to zero.
-
11:
– Real (Kind=nag_wp)
Input
-
On entry:
, the tolerance value used in the check for estimability.
If then , where is the machine precision, is used instead.
-
12:
– Real (Kind=nag_wp) array
Workspace
-
-
13:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended since useful values can be provided in some output arguments even when
on exit.
When the value or 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:
Note: in some cases g02dnf may return useful information.
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
-
On entry,
, i.e., model of full rank. 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 and
f.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
The computations are believed to be stable.
8
Parallelism and Performance
g02dnf 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.
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.
10
Example
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.
10.1
Program Text
10.2
Program Data
10.3
Program Results