naginterfaces.library.correg.linregm_​var_​del

naginterfaces.library.correg.linregm_var_del(q, indx, rss)[source]

linregm_var_del deletes an independent variable from a general linear regression model.

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

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

Parameters
qfloat, array-like, shape

The results of the decomposition as returned by functions linregm_fit(), linregm_obs_edit(), linregm_var_add() or linregm_fit_onestep(), or previous calls to linregm_var_del.

indxint

Indicates which independent variable is to be deleted from the model.

rssfloat

The residual sum of squares for the full regression.

Returns
qfloat, ndarray, shape

The updated decomposition.

rssfloat

The residual sum of squares with the ()th variable removed. Note that the residual sum of squares will only be valid if the regression is of full rank, otherwise the residual sum of squares should be obtained using linregm_update().

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

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.

When selecting a linear regression model it is sometimes useful to drop independent variables from the model and to examine the resulting sub-model. linregm_var_del updates the decomposition used in the computation of the linear regression model. The decomposition may come from linregm_fit() or linregm_var_add(), or a previous call to linregm_var_del.

For the general linear regression model with independent variables fitted linregm_fit() or linregm_var_add() compute a decomposition of the (weighted) independent variables and form an upper triangular matrix and a vector . To remove an independent variable and have to be updated. The column of corresponding to the variable to be dropped is removed and the matrix is then restored to upper triangular form by applying a series of Givens rotations. The rotations are then applied to . Note only the first elements of are affected.

The method used means that while the updated values of and are computed an updated value of from the decomposition is not available so a call to linregm_var_add() cannot be made after a call to linregm_var_del.

linregm_update() can be used to calculate the parameter estimates, , from the information provided by linregm_var_del.

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