hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_contab_binary_service (g11sb)

Purpose

nag_contab_binary_service (g11sb) is a service function which may be used prior to calling nag_contab_binary (g11sa) to calculate the frequency distribution of a set of dichotomous score patterns.

Syntax

[ns, x, irl, ifail] = g11sb(x, 'ip', ip, 'n', n)
[ns, x, irl, ifail] = nag_contab_binary_service(x, 'ip', ip, 'n', n)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 22: n has been made optional
.

Description

When each of nn individuals responds to each of pp dichotomous variables the data assumes the form of the matrix XX defined below
X =
[ x11 x12 … x1p x21 x22 … x2p ⋮ ⋮ ⋮ xn1 xn2 … xnp ]
=
[ x ̲ 1 x ̲ 2 ⋮ x ̲ n ]
,
X=[ x11 x12 x1p x21 x22 x2p xn1 xn2 xnp ]=[ x̲1 x̲2 x̲n ] ,
where the xx take the value of 00 or 11 and x ̲ l = (xl1,xl2,,xlp)x̲l=(xl1,xl2,,xlp), for l = 1,2,,nl=1,2,,n, denotes the score pattern of the llth individual. nag_contab_binary_service (g11sb) calculates the number of different score patterns, ss, and the frequency with which each occurs. This information can then be passed to nag_contab_binary (g11sa).

References

None.

Parameters

Compulsory Input Parameters

1:     x(ldx,ip) – logical array
ldx, the first dimension of the array, must satisfy the constraint ldxnldxn.
x(i,j)xij must be set equal to true if xij = 1xij=1, and false if xij = 0xij=0, for i = 1,2,,ni=1,2,,n and j = 1,2,,pj=1,2,,p.

Optional Input Parameters

1:     ip – int64int32nag_int scalar
Default: The second dimension of the array x.
pp, the number of dichotomous variables.
Constraint: ip3ip3.
2:     n – int64int32nag_int scalar
Default: The first dimension of the array x.
nn, the number of individuals in the sample.
Constraint: n7n7.

Input Parameters Omitted from the MATLAB Interface

ldx

Output Parameters

1:     ns – int64int32nag_int scalar
The number of different score patterns, ss.
2:     x(ldx,ip) – logical array
ldxnldxn.
The first ss rows of x contain the ss different score patterns.
3:     irl(n) – int64int32nag_int array
The frequency with which the llth row of x occurs, for l = 1,2,,sl=1,2,,s.
4:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,ip < 3ip<3,
orn < 7n<7,
orldx < nldx<n.

Accuracy

Exact.

Further Comments

The time taken by nag_contab_binary_service (g11sb) is small and increases with nn.

Example

function nag_contab_binary_service_example
x = [false, false, false;
     false, true, false;
     true, true, true;
     false, false, false;
     false, false, true;
     false, false, false;
     false, false, false;
     true, true, false;
     false, false, true;
     false, true, true];
[ns, xOut, irl, ifail] = nag_contab_binary_service(x)
 

ns =

                    6


xOut =

     0     0     0
     0     1     0
     1     1     1
     0     0     1
     1     1     0
     0     1     1
     0     0     0
     1     1     0
     0     0     1
     0     1     1


irl =

                    4
                    1
                    1
                    2
                    1
                    1
                    0
                    1
                    0
                    1


ifail =

                    0


function g11sb_example
x = [false, false, false;
     false, true, false;
     true, true, true;
     false, false, false;
     false, false, true;
     false, false, false;
     false, false, false;
     true, true, false;
     false, false, true;
     false, true, true];
[ns, xOut, irl, ifail] = g11sb(x)
 

ns =

                    6


xOut =

     0     0     0
     0     1     0
     1     1     1
     0     0     1
     1     1     0
     0     1     1
     0     0     0
     1     1     0
     0     0     1
     0     1     1


irl =

                    4
                    1
                    1
                    2
                    1
                    1
                    0
                    1
                    0
                    1


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013