hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_correg_linregm_constrain (g02dk)

Purpose

nag_correg_linregm_constrain (g02dk) calculates the estimates of the parameters of a general linear regression model for given constraints from the singular value decomposition results.

Syntax

[b, se, cov, ifail] = g02dk(p, c, b, rss, idf, 'ip', ip, 'iconst', iconst)
[b, se, cov, ifail] = nag_correg_linregm_constrain(p, c, b, rss, idf, 'ip', ip, 'iconst', iconst)

Description

nag_correg_linregm_constrain (g02dk) 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 to nag_correg_linregm_fit (g02da) or nag_correg_linregm_update (g02dd).
In the case of a model not of full rank the functions use a singular value decomposition (SVD) to find the parameter estimates, β̂svdβ^svd, and their variance-covariance matrix. Details of the SVD are made available in the form of the matrix P*P*:
P* =
(D1 P1T )
P0T
,
P*= D-1 P1T P0T ,
as described by nag_correg_linregm_fit (g02da) and nag_correg_linregm_update (g02dd).
Alternative solutions can be formed by imposing constraints on the parameters. If there are pp parameters and the rank of the model is kk, then nc = pknc=p-k constraints will have to be imposed to obtain a unique solution.
Let CC be a pp by ncnc matrix of constraints, such that
CTβ = 0
CTβ=0
then the new parameter estimates β̂cβ^c are given by
β̂c = Aβ̂svd;
= (IP0(CTP0)1)β̂svd,
β^c =Aβ^svd; =(I-P0(CTP0)-1)β^svd,
where II is the identity matrix, and the variance-covariance matrix is given by
AP1D2P1TAT,
AP1D-2P1TAT,
provided (CTP0)1(CTP0)-1 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

Parameters

Compulsory Input Parameters

1:     p(ip × ip + 2 × ipip×ip+2×ip) – double array
2:     c(ldc,iconst) – double array
ldc, the first dimension of the array, must satisfy the constraint ldcipldcip.
The iconst constraints stored by column, i.e., the iith constraint is stored in the iith column of c.
3:     b(ip) – double array
ip, the dimension of the array, must satisfy the constraint ip1ip1.
The parameter estimates computed by using the singular value decomposition, β̂svdβ^svd.
4:     rss – double scalar
The residual sum of squares as returned by nag_correg_linregm_fit (g02da) or nag_correg_linregm_update (g02dd).
Constraint: rss > 0.0rss>0.0.
5:     idf – int64int32nag_int scalar
The degrees of freedom associated with the residual sum of squares as returned by nag_correg_linregm_fit (g02da) or nag_correg_linregm_update (g02dd).
Constraint: idf > 0idf>0.

Optional Input Parameters

1:     ip – int64int32nag_int scalar
Default: The dimension of the array b and the first dimension of the array c. (An error is raised if these dimensions are not equal.)
pp, the number of terms in the linear model.
Constraint: ip1ip1.
2:     iconst – int64int32nag_int scalar
Default: The second dimension of the array c.
The number of constraints to be imposed on the parameters, ncnc.
Constraint: 0 < iconst < ip0<iconst<ip.

Input Parameters Omitted from the MATLAB Interface

ldc wk

Output Parameters

1:     b(ip) – double array
The parameter estimates of the parameters with the constraints imposed, β̂cβ^c.
2:     se(ip) – double array
The standard error of the parameter estimates in b.
3:     cov(ip × (ip + 1) / 2ip×(ip+1)/2) – double array
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 b(i)bi and the parameter estimate given in b(j)bj, jiji, is stored in cov((j × (j1) / 2 + i))cov(j×(j-1)/2+i).
4:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,ip < 1ip<1,
oriconst0iconst0,
oriconstipiconstip,
orldc < ipldc<ip,
orrss0.0rss0.0,
oridf0idf0.
  ifail = 2ifail=2
c does not give a model of full rank.

Accuracy

It should be noted that due to rounding errors a parameter that should be zero when the constraints have been imposed may be returned as a value of order machine precision.

Further Comments

nag_correg_linregm_constrain (g02dk) is intended for use in situations in which dummy (0101) 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 function is not intended for situations in which the relationships between the independent variables are only approximate.

Example

function nag_correg_linregm_constrain_example
p = [1.135198279858991;
     1.13078348304906;
     1.234006904805161;
     1.228003039942231;
     1.263332232672042;
     3.872983346207417;
     1.732050807568878;
     1.732050807568878;
     1.732050807568877;
     1.64780261914309e-16;
     0.2309401076758503;
     8.35089227579159e-18;
     -1.238223776129407e-17;
     7.900875770685859e-17;
     -0.447213595499958;
     0.0577350269189626;
     0.2871305767251709;
     0.2022129403845741;
     -0.3559016137228031;
     0.447213595499958;
     0.05773502691896256;
     0.03726461792122844;
     0.271286303307133;
     0.4183480487454616;
     0.447213595499958;
     0.05773502691896257;
     0.1515575558927682;
     -0.4677758485215264;
     0.0906424999201606;
     0.447213595499958;
     0.05773502691896258;
     -0.4759527505391677;
     -0.005723395170180857;
     -0.153088934942819;
     0.4472135954999578];
c = [0;
     1;
     1;
     1;
     1];
b = [30.55666666666667;
     5.446666666666673;
     6.743333333333336;
     11.04666666666667;
     7.32];
rss = 22.2268;
idf = int64(8);
[bOut, se, covar, ifail] = nag_correg_linregm_constrain(p, c, b, rss, idf)
 

bOut =

   38.1958
   -2.1925
   -0.8958
    3.4075
   -0.3192


se =

    0.4812
    0.8334
    0.8334
    0.8334
    0.8334


covar =

    0.2315
   -0.0000
    0.6946
    0.0000
   -0.2315
    0.6946
    0.0000
   -0.2315
   -0.2315
    0.6946
    0.0000
   -0.2315
   -0.2315
   -0.2315
    0.6946


ifail =

                    0


function g02dk_example
p = [1.135198279858991;
     1.13078348304906;
     1.234006904805161;
     1.228003039942231;
     1.263332232672042;
     3.872983346207417;
     1.732050807568878;
     1.732050807568878;
     1.732050807568877;
     1.64780261914309e-16;
     0.2309401076758503;
     8.35089227579159e-18;
     -1.238223776129407e-17;
     7.900875770685859e-17;
     -0.447213595499958;
     0.0577350269189626;
     0.2871305767251709;
     0.2022129403845741;
     -0.3559016137228031;
     0.447213595499958;
     0.05773502691896256;
     0.03726461792122844;
     0.271286303307133;
     0.4183480487454616;
     0.447213595499958;
     0.05773502691896257;
     0.1515575558927682;
     -0.4677758485215264;
     0.0906424999201606;
     0.447213595499958;
     0.05773502691896258;
     -0.4759527505391677;
     -0.005723395170180857;
     -0.153088934942819;
     0.4472135954999578];
c = [0;
     1;
     1;
     1;
     1];
b = [30.55666666666667;
     5.446666666666673;
     6.743333333333336;
     11.04666666666667;
     7.32];
rss = 22.2268;
idf = int64(8);
[bOut, se, covar, ifail] = g02dk(p, c, b, rss, idf)
 

bOut =

   38.1958
   -2.1925
   -0.8958
    3.4075
   -0.3192


se =

    0.4812
    0.8334
    0.8334
    0.8334
    0.8334


covar =

    0.2315
   -0.0000
    0.6946
    0.0000
   -0.2315
    0.6946
    0.0000
   -0.2315
   -0.2315
    0.6946
    0.0000
   -0.2315
   -0.2315
   -0.2315
    0.6946


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013