Note: please be advised that this routine is classed as ‘experimental’ and its interface may be developed further in the future. Please see
Section 4 in How to Use the NAG Library
for further information.
The routine may be called by the names g22ybf or nagf_blgm_lm_describe_data.
3Description
Let denote a data matrix with observations on independent variables, denoted . The th independent variable, can be classified as either binary, categorical, ordinal or continuous, where:
Binary
can take the value or .
Categorical
can take one of distinct values or levels. Each level represents a discrete category but does not necessarily imply an ordering. The value used to represent each level is, therefore, arbitrary and, by convention and for convenience, is taken to be the integers from to .
Ordinal
As with a categorical variable can take one of distinct values or levels. However, unlike a categorical variable, the levels of an ordinal variable imply an ordering and hence the value used to represent each level is not arbitrary. For example, implies a value that is twice as large as .
Continuous
can take any real value.
g22ybf returns a G22 handle containing a description of a data matrix, . The data matrix makes no distinction between binary, ordinal or continuous variables.
A name can also be assigned to each variable. If names are not supplied then the default vector of names, is used.
4References
None.
5Arguments
1: – Type (c_ptr)Input/Output
On entry: must be set to c_null_ptr, alternatively an existing G22 handle may be supplied in which case this routine will destroy the supplied G22 handle as if g22zaf had been called.
On exit: holds a G22 handle to the internal data structure containing a description of the data matrix, . You must not change the G22 handle other than through the routines in Chapter G22.
2: – IntegerInput
On entry: , the number of observations in the data matrix, .
Constraint:
.
3: – IntegerInput
On entry: , the number of variables in the data matrix, .
Constraint:
.
4: – Integer arrayInput
On entry: contains the number of levels associated with the th variable of the data matrix, for .
If the th variable is binary, ordinal or continuous, should be set to ; otherwise should be set to the number of levels associated with the th variable and the corresponding column of the data matrix is assumed to take the value to .
Constraint:
, for .
5: – IntegerInput
On entry: the number of variable names supplied in vnames.
Constraint:
or .
6: – Character(*) arrayInput
On entry: if ,
must contain the name of the th variable, for . If , vnames is not referenced.
The names supplied in vnames should be at most characters long and be unique. If a name longer than characters is supplied it will be truncated.
Variable names must not contain any of the characters +.*-:^()@.
7: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, hddesc is not c_null_ptr or a recognised G22 handle.
On entry, . Constraint: .
On entry, . Constraint: .
On entry, and . Constraint: .
On entry, and . Constraint: or .
On entry, variable name contains one more invalid characters, .
On entry, variable names and are not unique, and .
On entry, variable names and are not unique (possibly due to truncation), and . Maximum variable name length is .
At least one variable name was truncated to characters. Each truncated name is unique and will be used in all output.
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
Not applicable.
8Parallelism and Performance
g22ybf is not threaded in any implementation.
9Further Comments
9.1Internal Changes
Internal changes have been made to this routine as follows:
At Mark 27: Functionality has been expanded allowing the routine to be used with g02jhf. An additional argument has been added to the interface and some of the error exits have been renumbered.
For details of all known issues which have been reported for the NAG Library please refer to the Known Issues.
10Example
This example performs a linear regression using g02daf. The linear regression model is defined via a text string which is parsed using g22yaf. The corresponding design matrix associated with the model and the dataset described via a call to g22ybf is generated using g22ycf.
Verbose labels for the parameters of the model are constructed using information returned in vinfo by g22ydf.
As well as the optional parameters common to all G22 handles described in g22zmfandg22znf, a number of additional optional parameters can be specified for a G22 handle holding the description of a data matrix as returned by g22ybf in hddesc.
Each writeable optional parameter has an associated default value; to set any of them to a non-default value, use g22zmf. The value of an optional parameter can be queried using g22znf.
The remainder of this section can be skipped if you wish to use the default values for all optional parameters.
The following is a list of the optional parameters available. A full description of each optional parameter is provided in Section 11.1.