g02gn Method
関数リスト一覧   NagLibrary Namespaceへ  ライブラリイントロダクション  本ヘルプドキュメントのchm形式版

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


public static void g02gn(
	int ip,
	int irank,
	double[] b,
	double[] cov,
	double[,] v,
	double[] f,
	out bool est,
	out double stat,
	out double sestat,
	out double z,
	double tol,
	out int ifail
Visual Basic (Declaration)
Public Shared Sub g02gn ( _
	ip As Integer, _
	irank As Integer, _
	b As Double(), _
	cov As Double(), _
	v As Double(,), _
	f As Double(), _
	<OutAttribute> ByRef est As Boolean, _
	<OutAttribute> ByRef stat As Double, _
	<OutAttribute> ByRef sestat As Double, _
	<OutAttribute> ByRef z As Double, _
	tol As Double, _
	<OutAttribute> ByRef ifail As Integer _
Visual C++
static void g02gn(
	int ip, 
	int irank, 
	array<double>^ b, 
	array<double>^ cov, 
	array<double,2>^ v, 
	array<double>^ f, 
	[OutAttribute] bool% est, 
	[OutAttribute] double% stat, 
	[OutAttribute] double% sestat, 
	[OutAttribute] double% z, 
	double tol, 
	[OutAttribute] int% ifail
static member g02gn : 
        ip:int * 
        irank:int * 
        b:float[] * 
        cov:float[] * 
        v:float[,] * 
        f:float[] * 
        est:bool byref * 
        stat:float byref * 
        sestat:float byref * 
        z:float byref * 
        tol:float * 
        ifail:int byref -> unit 


Type: System..::.Int32
On entry: p, the number of terms in the linear model.
Constraint: ip1.
Type: System..::.Int32
On entry: k, the rank of the dependent variables.
Constraint: 1irankip.
Type: array< System..::.Double >[]()[]
An array of size [ip]
On entry: the ip values of the estimates of the parameters of the model, β^.
Type: array< System..::.Double >[]()[]
An array of size [ip×ip+1/2]
On entry: 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-1] and the parameter estimate given in b[j-1], ji, is stored in cov[j×j-1/2+i-1].
Type: array< System..::.Double ,2>[,](,)[,]
An array of size [ldv, ip+7]
Note: ldv must satisfy the constraint: ldvip
On entry: as returned by g02ga, g02gb, g02gc and g02gd.
Type: array< System..::.Double >[]()[]
An array of size [ip]
On entry: f, the linear function to be estimated.
Type: System..::.Boolean %
On exit: indicates if the function was estimable.
The function is estimable.
The function is not estimable and stat, sestat and z are not set.
Type: System..::.Double %
On exit: if est=true, stat contains the estimate of the function, fTβ^
Type: System..::.Double %
On exit: if est=true, sestat contains the standard error of the estimate of the function, seF.
Type: System..::.Double %
On exit: if est=true, z contains the z statistic for the test of the function being equal to zero.
Type: System..::.Double
On entry: η, the tolerance value used in the check for estimability.
ε, where ε is the machine precision, is used instead.
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).


g02gn 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 g02ga, g02gb, g02gc or g02gd. 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 methods use a singular value decomposition (SVD) to find the parameter estimates, β^, and their variance-covariance matrix. Given the upper triangular matrix R obtained from the QR decomposition of the independent variables the SVD gives
R=Q* D 0 0 0 PT,
where D is a k by k diagonal matrix with nonzero diagonal elements, k being the rank of R, and Q* and P are p by p orthogonal matrices. This leads to a solution:
P1 being the first k columns of P, i.e., P=P1P0; Q*1 being the first k columns of Q*, and c1 being the first p elements of c.
Details of the SVD are made available in the form of the matrix P*:
P*= D-1 P1T P0T
as described by g02ga, g02gb, g02gc and g02gd.
A linear function of the parameters, F=fTβ, can be tested to see if it is estimable by computing ζ= P0T f. 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 F is estimable it can be estimated by fTβ^ and its standard error calculated from the variance-covariance matrix of β^, Cβ, as
Also a z statistic
z=fTβ^ seF ,
can be computed. The distribution of z will be approximately Normal.


Error Indicators and Warnings

Note: g02gn may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (ldv, wk) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry,ip<1,
On entry,irank=ip. In this case est is returned as true and all statistics are calculated.


Further Comments

The value of estimable functions is independent of the solution chosen from the many possible solutions. While g02gn may be used to estimate functions of the parameters of the model as computed by g02gk, βc, these must be expressed in terms of the original parameters, β. The relation between the two sets of parameters may not be straightforward.


A loglinear model is fitted to a 3 by 5 contingency table by g02gc. The model consists of terms for rows and columns. The table is:
141 67 114 79 39 131 66 143 72 35 36 14 38 28 16
The number of functions to be tested is read in, then the linear functions themselves are read in and tested with g02gn. The results of g02gn are printed.

Example program (C#): g02gne.cs

Example program data: g02gne.d

Example program results: g02gne.r

See Also