naginterfaces.library.correg.glm_​estfunc

naginterfaces.library.correg.glm_estfunc(irank, b, cov, v, f, tol=0.0)[source]

glm_estfunc gives the estimate of an estimable function along with its standard error from the results from fitting a generalized linear model.

For full information please refer to the NAG Library document for g02gn

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02gnf.html

Parameters
irankint

, the rank of the dependent variables.

bfloat, array-like, shape

The values of the estimates of the parameters of the model, .

covfloat, array-like, shape

The upper triangular part of the variance-covariance matrix of the parameter estimates given in . 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 .

vfloat, array-like, shape

As returned by glm_normal(), glm_binomial(), glm_poisson() and glm_gamma().

ffloat, array-like, shape

, the linear function to be estimated.

tolfloat, optional

The tolerance value used in the check for estimability, .

If then , where is the machine precision, is used instead.

Returns
estbool

Indicates if the function was estimable.

The function is estimable.

The function is not estimable and , and are not set.

statfloat

If , contains the estimate of the function,

sestatfloat

If , contains the standard error of the estimate of the function, .

zfloat

If , contains the statistic for the test of the function being equal to zero.

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

. In this case is returned as true and all statistics are calculated.

(errno )

Standard error of statistic ; this may be due to rounding errors if the standard error is very small or due to mis-specified inputs and .

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

glm_estfunc computes the estimates of an estimable function for a generalized linear model which is not of full rank. It is intended for use after a call to glm_normal(), glm_binomial(), glm_poisson() or glm_gamma(). 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 functions 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 diagonal matrix with nonzero diagonal elements, being the rank of , and and are orthogonal matrices. This leads to a 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 described by glm_normal(), glm_binomial(), glm_poisson() and glm_gamma().

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 distribution of will be approximately Normal.

References

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