NAG C Library Function Document
nag_blgm_lm_describe_data (g22ybc)
1
Purpose
nag_blgm_lm_describe_data (g22ybc) describes a data matrix.
2
Specification
#include <nag.h> |
#include <nagg22.h> |
|
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.
nag_blgm_lm_describe_data (g22ybc) 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:
– void **Input/Output
-
On entry: must be set to
NULL.
As an alternative an existing G22 handle may be supplied in which case this function will destroy the supplied G22 handle as if
nag_blgm_handle_free (g22zac) 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 functions 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:
– const IntegerInput
-
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:
– const char *Input
-
On entry: if
,
must contain the name of the
th variable, for
. If
,
vnames is not referenced and may be
NULL.
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:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_ARRAY_SIZE
-
On entry, and .
Constraint: , or .
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_HANDLE
-
On entry,
hddesc is not
NULL or a recognised G22 handle.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_ARRAY
-
On entry, and .
Constraint: .
- 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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_INVALID_FORMAT
-
On entry, variable name contains one more invalid characters, .
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_NON_UNIQUE
-
On entry, variable names and are not unique (possibly due to truncation), and .
Maximum variable name length is .
On entry, variable names and are not unique, and .
- NW_TRUNCATED
-
At least one variable name was truncated to characters. Each truncated name is unique and will be used in all output.
7
Accuracy
Not applicable.
8
Parallelism and Performance
nag_blgm_lm_describe_data (g22ybc) is not threaded in any implementation.
None.
10
Example
This example performs a linear regression using
nag_regsn_mult_linear (g02dac). The linear regression model is defined via a text string which is parsed using
nag_blgm_lm_formula (g22yac). The corresponding design matrix associated with the model and the dataset described via a call to
nag_blgm_lm_describe_data (g22ybc) is generated using
nag_blgm_lm_design_matrix (g22ycc).
Verbose labels for the parameters of the model are constructed using information returned in
vinfo by
nag_blgm_lm_submodel (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
nag_blgm_optset (g22zmc) and
nag_blgm_optget (g22znc), a number of additional optional parameters can be specified for a G22 handle holding the description of a data matrix as returned by
nag_blgm_lm_describe_data (g22ybc) in
hddesc.
Each writeable optional parameter has an associated default value; to set any of them to a non-default value, use
nag_blgm_optset (g22zmc). The value of an optional parameter can be queried using
nag_blgm_optget (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:
- 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.
If queried, this optional parameter will return , the number of observations in the data matrix.
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
nag_blgm_lm_design_matrix (g22ycc).
Constraint:
or .