naginterfaces.library.correg.linregm_estfunc¶
- naginterfaces.library.correg.linregm_estfunc(irank, b, cov, p, f, tol=0.0)[source]¶
linregm_estfunc
gives the estimate of an estimable function along with its standard error.For full information please refer to the NAG Library document for g02dn
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02dnf.html
- Parameters
- irankint
, the rank of the independent 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 .
- pfloat, array-like, shape
As returned by
linregm_fit()
andlinregm_update()
.- 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, .
- tfloat
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: .
- (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 .
- Warns
- NagAlgorithmicWarning
- (errno )
On entry, , i.e., model of full rank. In this case is returned as true and all statistics are calculated.
- 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.
linregm_estfunc
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 tolinregm_fit()
orlinregm_update()
. 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 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
linregm_fit()
andlinregm_update()
.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.
- 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