The routine may be called by the names g02gkf or nagf_correg_glm_constrain.
3Description
g02gkf computes the estimates given a set of linear constraints for a generalized linear model which is not of full rank. It is intended for use after a call to g02gaf,g02gbf,g02gcforg02gdf.
In the case of a model not of full rank the routines use a singular value decomposition to find the parameter estimates, , and their variance-covariance matrix. Details of the SVD are made available in the form of the matrix :
as described by g02gaf,g02gbf,g02gcfandg02gdf. Alternative solutions can be formed by imposing constraints on the parameters. If there are parameters and the rank of the model is then constraints will have to be imposed to obtain a unique solution.
Let be a matrix of constraints, such that
then the new parameter estimates are given by:
and the variance-covariance matrix is given by
provided exists.
4References
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
McCullagh P and Nelder J A (1983) Generalized Linear Models Chapman and Hall
Searle S R (1971) Linear Models Wiley
5Arguments
1: – IntegerInput
On entry: , the number of terms in the linear model.
Constraint:
.
2: – IntegerInput
On entry: the number of constraints to be imposed on the parameters, .
On entry: contains the iconst constraints stored by column, i.e., the th constraint is stored in the th column of c.
6: – IntegerInput
On entry: the first dimension of the array c as declared in the (sub)program from which g02gkf is called.
Constraint:
.
7: – Real (Kind=nag_wp) arrayInput/Output
On entry: the parameter estimates computed by using the singular value decomposition, .
On exit: the parameter estimates of the parameters with the constraints imposed, .
8: – Real (Kind=nag_wp)Input
On entry: the estimate of the scale parameter.
For results from g02gafandg02gdf then s is the scale parameter for the model.
For results from g02gbfandg02gcf then s should be set to .
Constraint:
.
9: – Real (Kind=nag_wp) arrayOutput
On exit: the standard error of the parameter estimates in b.
10: – Real (Kind=nag_wp) arrayOutput
On exit: 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 .
11: – Real (Kind=nag_wp) arrayWorkspace
Note: a simple upper bound for the size of the workspace is .
12: – IntegerInput/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. 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).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
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.
7Accuracy
It should be noted that due to rounding errors an argument that should be zero when the constraints have been imposed may be returned as a value of order machine precision.
8Parallelism and Performance
g02gkf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g02gkf 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.
9Further Comments
g02gkf is intended for use in situations in which dummy () variables have been used such as in the analysis of designed experiments when you do not wish to change the parameters of the model to give a full rank model. The routine is not intended for situations in which the relationships between the independent variables are only approximate.
10Example
A loglinear model is fitted to a contingency table by g02gcf. The model consists of terms for rows and columns. The table is
The constraints that the sum of row effects and the sum of column effects are zero are then read in and the parameter estimates with these constraints imposed are computed by g02gkf and printed.