NAG Library Routine Document

g11sbf (binary_service)

1
Purpose

g11sbf is a service routine which may be used prior to calling g11saf to calculate the frequency distribution of a set of dichotomous score patterns.

2
Specification

Fortran Interface
Subroutine g11sbf ( ip, n, ns, x, ldx, irl, ifail)
Integer, Intent (In):: ip, n, ldx
Integer, Intent (Inout):: ifail
Integer, Intent (Out):: ns, irl(n)
Logical, Intent (Inout):: x(ldx,ip)
C Header Interface
#include <nagmk26.h>
void  g11sbf_ (const Integer *ip, const Integer *n, Integer *ns, logical x[], const Integer *ldx, Integer irl[], Integer *ifail)

3
Description

When each of n individuals responds to each of p dichotomous variables the data assumes the form of the matrix X defined below
X= x11 x12 x1p x21 x22 x2p xn1 xn2 xnp = x̲1 x̲2 x̲n ,  
where the x take the value of 0 or 1 and x̲l=xl1,xl2,,xlp, for l=1,2,,n, denotes the score pattern of the lth individual. g11sbf calculates the number of different score patterns, s, and the frequency with which each occurs. This information can then be passed to g11saf.

4
References

None.

5
Arguments

1:     ip – IntegerInput
On entry: p, the number of dichotomous variables.
Constraint: ip3.
2:     n – IntegerInput
On entry: n, the number of individuals in the sample.
Constraint: n7.
3:     ns – IntegerOutput
On exit: the number of different score patterns, s.
4:     xldxip – Logical arrayInput/Output
On entry: xij must be set equal to .TRUE. if xij=1, and .FALSE. if xij=0, for i=1,2,,n and j=1,2,,p.
On exit: the first s rows of x contain the s different score patterns.
5:     ldx – IntegerInput
On entry: the first dimension of the array x as declared in the (sub)program from which g11sbf is called.
Constraint: ldxn.
6:     irln – Integer arrayOutput
On exit: the frequency with which the lth row of x occurs, for l=1,2,,s.
7:     ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, ip=value.
Constraint: ip3.
On entry, ldx=value and n=value.
Constraint: ldxn.
On entry, n=value.
Constraint: n7.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Exact.

8
Parallelism and Performance

g11sbf is not threaded in any implementation.

9
Further Comments

The time taken by g11sbf is small and increases with n.

10
Example

This example counts the frequencies of different score patterns in the following list:
Score Patterns
000
010
111
000
001
000
000
110
001
011

10.1
Program Text

Program Text (g11sbfe.f90)

10.2
Program Data

Program Data (g11sbfe.d)

10.3
Program Results

Program Results (g11sbfe.r)