NAG CL Interface
g22ybc (lm_​describe_​data)

Note: please be advised that this function 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.
Settings help

CL Name Style:


1 Purpose

g22ybc describes a data matrix.

2 Specification

#include <nag.h>
void  g22ybc (void **hddesc, Integer nobs, Integer nvar, const Integer levels[], Integer lvnames, const char *vnames[], NagError *fail)
The function may be called by the names: g22ybc or nag_blgm_lm_describe_data.

3 Description

Let D denote a data matrix with n observations on md independent variables, denoted V1, V2, , Vmd . The jth independent variable, Vj can be classified as either binary, categorical, ordinal or continuous, where:
Binary
Vj can take the value 1 or 0.
Categorical
Vj can take one of Lj 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 1 to Lj.
Ordinal
As with a categorical variable Vj can take one of Lj 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, Vj=4 implies a value that is twice as large as Vj=2.
Continuous
Vj can take any real value.
g22ybc returns a G22 handle containing a description of a data matrix, D. 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, {'V1','V2',} is used.

4 References

None.

5 Arguments

1: hddesc void ** Input/Output
On entry: must be set to NULL, alternatively an existing G22 handle may be supplied in which case this function will destroy the supplied G22 handle as if g22zac had been called.
On exit: holds a G22 handle to the internal data structure containing a description of the data matrix, D. You must not change the G22 handle other than through the functions in Chapter G22.
2: nobs Integer Input
On entry: n, the number of observations in the data matrix, D.
Constraint: nobs0.
3: nvar Integer Input
On entry: md, the number of variables in the data matrix, D.
Constraint: nvar0.
4: levels[nvar] const Integer Input
On entry: levels[j-1] contains the number of levels associated with the jth variable of the data matrix, for j=1,2,,nvar.
If the jth variable is binary, ordinal or continuous, levels[j-1] should be set to 1; otherwise levels[j-1] should be set to the number of levels associated with the jth variable and the corresponding column of the data matrix is assumed to take the value 1 to levels[j-1].
Constraint: levels[i-1]1, for i=1,2,,nvar.
5: lvnames Integer Input
On entry: the number of variable names supplied in vnames.
Constraint: lvnames=0 or nvar.
6: vnames[lvnames] const char * Input
On entry: if vnames is not NULL, vnames[j-1] must contain the name of the jth variable, for j=1,2,,nvar. If lvnames=0, vnames is not referenced and may be NULL.
The names supplied in vnames should be at most 50 characters long and be unique. If a name longer than 50 characters is supplied it will be truncated.
Variable names must not contain any of the characters +.*-:^()@.
7: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_ARRAY_SIZE
On entry, lvnames=value and nvar=value.
Constraint: lvnames=0 or nvar.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_HANDLE
On entry, hddesc is not NULL or a recognised G22 handle.
NE_INT
On entry, nobs=value.
Constraint: nobs0.
On entry, nvar=value.
Constraint: nvar0.
NE_INT_ARRAY
On entry, j=value and levels[j-1]=value.
Constraint: levels[i-1]1.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_INVALID_FORMAT
On entry, variable name i contains one more invalid characters, i=value.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_NON_UNIQUE
On entry, variable names i and j are not unique (possibly due to truncation), i=value and j=value.
Maximum variable name length is 50.
On entry, variable names i and j are not unique, i=value and j=value.
NW_TRUNCATED
At least one variable name was truncated to 50 characters. Each truncated name is unique and will be used in all output.

7 Accuracy

Not applicable.

8 Parallelism and Performance

g22ybc is not threaded in any implementation.

9 Further Comments

9.1 Internal Changes

Internal changes have been made to this function as follows:
For details of all known issues which have been reported for the NAG Library please refer to the Known Issues.

10 Example

This example performs a linear regression using g02dac. The linear regression model is defined via a text string which is parsed using g22yac. The corresponding design matrix associated with the model and the dataset described via a call to g22ybc is generated using g22ycc.
Verbose labels for the parameters of the model are constructed using information returned in vinfo by g22ydc.
See also the examples in g22yac, g22ycc and g22ydc.

10.1 Program Text

Program Text (g22ybce.c)

10.2 Program Data

Program Data (g22ybce.d)

10.3 Program Results

Program Results (g22ybce.r)

11 Optional Parameters

As well as the optional parameters common to all G22 handles described in g22zmc and g22znc, a number of additional optional parameters can be specified for a G22 handle holding the description of a data matrix as returned by g22ybc in hddesc.
Each writeable optional parameter has an associated default value; to set any of them to a non-default value, use g22zmc. The value of an optional parameter can be queried using g22znc.
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.

11.1 Description of the Optional Parameters

For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
Keywords and character values are case and white space insensitive.
Number of Observationsi
n, the number of observations in the data matrix.
Number of Variablesi
If queried, this optional parameter will return md, the number of variables in the data matrix.
Storage OrderaDefault =OBSVAR
This optional parameter states how the data matrix, D, will be stored in its input array.
If Storage Order=OBSVAR, Dij, the value for the jth variable of the ith observation of the data matrix is stored in dat[(j-1)×pddat+i-1].
If Storage Order=VAROBS, Dij, the value for the jth variable of the ith observation of the data matrix is stored in dat[(i-1)×pddat+j-1].
Where dat is the input parameter of the same name in g22ycc.
Constraint: Storage Order=OBSVAR or VAROBS.