NAG FL Interface
g22ybf (lm_describe_data)
1
Purpose
g22ybf describes a data matrix.
2
Specification
Fortran Interface
Integer, Intent (In) |
:: |
nobs, nvar, levels(nvar), lvnames |
Integer, Intent (Inout) |
:: |
ifail |
Character (*), Intent (In) |
:: |
vnames(lvnames) |
Type (c_ptr), Intent (Inout) |
:: |
hddesc |
|
C++ Header Interface
#include <nag.h> extern "C" {
}
|
The routine may be called by the names g22ybf or nagf_blgm_lm_describe_data.
3
Description
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.
4
References
None.
5
Arguments
-
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:
– Integer
Input
-
On entry: , the number of observations in the data matrix, .
Constraint:
.
-
3:
– Integer
Input
-
On entry: , the number of variables in the data matrix, .
Constraint:
.
-
4:
– Integer array
Input
-
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:
– Integer
Input
-
On entry: the number of variable names supplied in
vnames.
Constraint:
or .
-
6:
– Character(*) array
Input
-
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:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value 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).
6
Error 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.
7
Accuracy
Not applicable.
8
Parallelism and Performance
g22ybf is not threaded in any implementation.
9.1
Internal 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.
10
Example
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.
See also the examples in
g22yaf,
g22ycf and
g22ydf.
10.1
Program Text
10.2
Program Data
10.3
Program Results
11
Optional Parameters
As well as the optional parameters common to all G22 handles described in
g22zmf and
g22znf, 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.
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:
- a parameter value,
where the letters , and denote options that take character, integer and real values respectively;
- the default value.
Keywords and character values are case and white space insensitive.
Number of Observations | | Read Only |
If queried, this optional parameter will return , the number of observations in the data matrix.
Number of Variables | | Read Only |
If queried, this optional parameter will return , the number of variables in the data matrix.
Storage Order | | Default |
This optional parameter states how the data matrix, , will be stored in its input array.
If , , the value for the th variable of the th observation of the data matrix is stored in .
If , , the value for the th variable of the th observation of the data matrix is stored in .
Where
dat is the input parameter of the same name in
g22ycf.
Constraint:
or .