naginterfaces.library.blgm.lm_​describe_​data

naginterfaces.library.blgm.lm_describe_data(hddesc, nobs, levels, vnames=None)[source]

Note: this function uses optional algorithmic parameters, see also: optset(), optget().

lm_describe_data describes a data matrix.

For full information please refer to the NAG Library document for g22yb

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g22/g22ybf.html

Parameters
hddescHandle, modified in place

On entry: must be set to a null Handle, alternatively an existing G22 handle may be supplied in which case this function will destroy the supplied G22 handle as if handle_free() 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 submodule blgm.

nobsint

, the number of observations in the data matrix, .

levelsint, array-like, shape

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 .

vnamesNone or str, array-like, shape , optional

If is not None, must contain the name of the th variable, for .

The names supplied in 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 +.*-:^()@.

Other Parameters
‘Number of Observations’int

, the number of observations in the data matrix.

‘Number of Variables’int

If queried, this option will return , the number of variables in the data matrix.

‘Storage Order’str

Default

This option 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 is the input argument of the same name in lm_design_matrix().

Raises
NagValueError
(errno )

On entry, is not a null Handle or a recognised G22 handle.

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: or .

(errno )

On entry, variable name contains one more invalid characters, .

(errno )

On entry, variable names and are not unique, and .

(errno )

On entry, variable names and are not unique (possibly due to truncation), and .

Maximum variable name length is .

Warns
NagAlgorithmicWarning
(errno )

At least one variable name was truncated to characters. Each truncated name is unique and will be used in all output.

Notes

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.

lm_describe_data 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.