naginterfaces.library.correg.linregm_constrain¶
- naginterfaces.library.correg.linregm_constrain(p, c, b, rss, idf)[source]¶
linregm_constrain
calculates the estimates of the parameters of a general linear regression model for given constraints from the singular value decomposition results.For full information please refer to the NAG Library document for g02dk
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02dkf.html
- Parameters
- pfloat, array-like, shape
As returned by
linregm_fit()
andlinregm_update()
.- cfloat, array-like, shape
The constraints stored by column, i.e., the th constraint is stored in the th column of .
- bfloat, array-like, shape
The parameter estimates computed by using the singular value decomposition, .
- rssfloat
The residual sum of squares as returned by
linregm_fit()
orlinregm_update()
.- idfint
The degrees of freedom associated with the residual sum of squares as returned by
linregm_fit()
orlinregm_update()
.
- Returns
- bfloat, ndarray, shape
The parameter estimates of the parameters with the constraints imposed, .
- sefloat, ndarray, shape
The standard error of the parameter estimates in .
- covfloat, ndarray, 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 .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
does not give a model of full rank.
- 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_constrain
computes the estimates given a set of linear constraints for a general linear regression model which is not of full rank. It is intended for use after a call tolinregm_fit()
orlinregm_update()
.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. Details of the SVD are made available in the form of the matrix :
as described by
linregm_fit()
andlinregm_update()
.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
where is the identity matrix, and the variance-covariance matrix is given by
provided exists.
- 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