NAG Library Routine Document
G11SAF
1 Purpose
G11SAF fits a latent variable model (with a single factor) to data consisting of a set of measurements on individuals in the form of binaryvalued sequences (generally referred to as score patterns). Various measures of goodnessoffit are calculated along with the factor (theta) scores.
2 Specification
SUBROUTINE G11SAF ( 
IP, N, GPROB, NS, X, LDX, IRL, A, C, IPRINT, CGETOL, MAXIT, CHISQR, ISHOW, NITER, ALPHA, PIGAM, CM, LDCM, G, EXPP, LDEXPP, OBS, EXF, Y, XL, IOB, RLOGL, CHI, IDF, SIGLEV, W, LW, IFAIL) 
INTEGER 
IP, N, NS, LDX, IRL(NS), IPRINT, MAXIT, ISHOW, NITER, LDCM, LDEXPP, IOB(NS), IDF, LW, IFAIL 
REAL (KIND=nag_wp) 
A(IP), C(IP), CGETOL, ALPHA(IP), PIGAM(IP), CM(LDCM,2*IP), G(2*IP), EXPP(LDEXPP,IP), OBS(LDEXPP,IP), EXF(NS), Y(NS), XL(NS), RLOGL, CHI, SIGLEV, W(LW) 
LOGICAL 
GPROB, X(LDX,IP), CHISQR 

3 Description
Given a set of
$p$ dichotomous variables
$\stackrel{~}{x}={\left({x}_{1},{x}_{2},\dots ,{x}_{p}\right)}^{\prime}$, where
${}^{\prime}$ denotes vector or matrix transpose, the objective is to investigate whether the association between them can be adequately explained by a latent variable model of the form (see
Bartholomew (1980) and
Bartholomew (1987))
The
${x}_{i}$ are called item responses and take the value
$0$ or
$1$.
$\theta $ denotes the latent variable assumed to have a standard Normal distribution over a population of individuals to be tested on
$p$ items. Call
${\pi}_{i}\left(\theta \right)=P\left({x}_{i}=1\mid \theta \right)$ the item response function: it represents the probability that an individual with latent ability
$\theta $ will produce a positive response
(1) to item
$i$.
${\alpha}_{i0}$ and
${\alpha}_{i1}$ are item parameters which can assume any real values. The set of parameters,
${\alpha}_{\mathit{i}1}$, for
$\mathit{i}=1,2,\dots ,p$, being coefficients of the unobserved variable
$\theta $, can be interpreted as ‘factor loadings’.
$G$ is a function selected by you as either
${\Phi}^{1}$ or logit, mapping the interval
$\left(0,1\right)$ onto the whole real line. Data from a random sample of
$n$ individuals takes the form of the matrices
$X$ and
$R$ defined below:
where
${\stackrel{~}{x}}_{l}=\left({x}_{l1},{x}_{l2},\dots ,{x}_{lp}\right)$ denotes the
$l$th score pattern in the sample,
${r}_{l}$ the frequency with which
${\stackrel{~}{x}}_{l}$ occurs and
$s$ the number of different score patterns observed. (Thus
$\sum _{l=1}^{s}}{r}_{l}=n$). It can be shown that the loglikelihood function is proportional to
where
(
$\varphi \left(\theta \right)$ being the probability density function of a standard Normal random variable).
${P}_{l}$ denotes the unconditional probability of observing score pattern
${\stackrel{~}{x}}_{l}$. The integral in
(2) is approximated using Gauss–Hermite quadrature. If we take
$G\left(z\right)=\mathrm{logit}z=\mathrm{log}\left(\frac{z}{1z}\right)$ in
(1) and reparameterise as follows,
then
(1) reduces to the logit model (see
Bartholomew (1980))
If we take
$G\left(z\right)={\Phi}^{1}\left(z\right)$ (where
$\Phi $ is the cumulative distribution function of a standard Normal random variable) and reparameterise as follows,
then
(1) reduces to the probit model (see
Bock and Aitkin (1981))
An EM algorithm (see
Bock and Aitkin (1981)) is used to maximize the loglikelihood function. The number of quadrature points used is set initially to
$10$ and once convergence is attained increased to
$20$.
The theta score of an individual responding in score pattern ${\stackrel{~}{x}}_{l}$ is computed as the posterior mean, i.e., $E\left(\theta \mid {\stackrel{~}{x}}_{l}\right)$. For the logit model the component score ${X}_{l}={\displaystyle \sum _{j=1}^{p}}{\alpha}_{j}{x}_{lj}$ is also calculated. (Note that in calculating the theta scores and measures of goodnessoffit G11SAF automatically reverses the coding on item $j$ if ${\alpha}_{j}<0$; it is assumed in the model that a response at the one level is showing a higher measure of latent ability than a response at the zero level.)
The frequency distribution of score patterns is required as input data. If your data is in the form of individual score patterns (uncounted), then
G11SBF may be used to calculate the frequency distribution.
4 References
Bartholomew D J (1980) Factor analysis for categorical data (with Discussion) J. Roy. Statist. Soc. Ser. B 42 293–321
Bartholomew D J (1987) Latent Variable Models and Factor Analysis Griffin
Bock R D and Aitkin M (1981) Marginal maximum likelihood estimation of item parameters: Application of an EM algorithm Psychometrika 46 443–459
5 Parameters
 1: IP – INTEGERInput
On entry: $p$, the number of dichotomous variables.
Constraint:
${\mathbf{IP}}\ge 3$.
 2: N – INTEGERInput
On entry: $n$, the number of individuals in the sample.
Constraint:
${\mathbf{N}}\ge 7$.
 3: GPROB – LOGICALInput
On entry: must be set equal to .TRUE. if $G\left(z\right)={\Phi}^{1}\left(z\right)$ and .FALSE. if $G\left(z\right)=\mathrm{logit}z$.
 4: NS – INTEGERInput
On entry:
NS must be set equal to the number of different score patterns in the sample,
$s$.
Constraint:
$2\times {\mathbf{IP}}<{\mathbf{NS}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({2}^{{\mathbf{IP}}},{\mathbf{N}}\right)$.
 5: X(LDX,IP) – LOGICAL arrayInput/Output
On entry: the first
$s$ rows of
X must contain the
$s$ different score patterns. The
$l$th row of
X must contain the
$l$th score pattern with
${\mathbf{X}}\left(l,j\right)$ set equal to .TRUE. if
${x}_{lj}=1$ and .FALSE. if
${x}_{lj}=0$. All rows of
X must be distinct.
On exit: given a valid parameter set then the first
$s$ rows of
X still contain the
$s$ different score patterns. However, the following points should be noted:
(i) 
If the estimated factor loading for the $j$th item is negative then that item is recoded, i.e., $0$s and $1$s (or .TRUE. and .FALSE.) in the $j$th column of X are interchanged. 
(ii) 
The rows of X will be reordered so that the theta scores corresponding to rows of X are in increasing order of magnitude. 
 6: LDX – INTEGERInput
On entry: the first dimension of the array
X as declared in the (sub)program from which G11SAF is called.
Constraint:
${\mathbf{LDX}}\ge {\mathbf{NS}}$.
 7: IRL(NS) – INTEGER arrayInput/Output
On entry: the
$i$th component of
IRL must be set equal to the frequency with which the
$i$th row of
X occurs.
Constraints:
 ${\mathbf{IRL}}\left(\mathit{i}\right)\ge 0$, for $\mathit{i}=1,2,\dots ,s$;
 $\sum _{i=1}^{s}}{\mathbf{IRL}}\left(i\right)=n$.
On exit: given a valid parameter set then the first
$s$ components of
IRL are reordered as are the rows of
X.
 8: A(IP) – REAL (KIND=nag_wp) arrayInput/Output
On entry: ${\mathbf{A}}\left(j\right)$ must be set equal to an initial estimate of ${\alpha}_{j1}$. In order to avoid divergence problems with the EM algorithm you are strongly advised to set all the ${\mathbf{A}}\left(j\right)$ to $0.5$.
On exit:
${\mathbf{A}}\left(\mathit{j}\right)$ contains the latest estimate of
${\alpha}_{\mathit{j}1}$, for
$\mathit{j}=1,2,\dots ,p$. (Because of possible recoding all elements of
A will be positive.)
 9: C(IP) – REAL (KIND=nag_wp) arrayInput/Output
On entry: ${\mathbf{C}}\left(j\right)$ must be set equal to an initial estimate of ${\alpha}_{j0}$. In order to avoid divergence problems with the EM algorithm you are strongly advised to set all the ${\mathbf{C}}\left(j\right)$ to $0.0$.
On exit: ${\mathbf{C}}\left(\mathit{j}\right)$ contains the latest estimate of ${\alpha}_{\mathit{j}0}$, for $\mathit{j}=1,2,\dots ,p$.
 10: IPRINT – INTEGERInput
On entry: the frequency with which the maximum likelihood search routine is to be monitored.
 ${\mathbf{IPRINT}}>0$
 The search is monitored once every IPRINT iterations, and when the number of quadrature points is increased, and again at the final solution point.
 ${\mathbf{IPRINT}}=0$
 The search is monitored once at the final point.
 ${\mathbf{IPRINT}}<0$
 The search is not monitored at all.
IPRINT should normally be set to a small positive number.
Suggested value:
${\mathbf{IPRINT}}=1$.
 11: CGETOL – REAL (KIND=nag_wp)Input
On entry: the accuracy to which the solution is required.
If
CGETOL is set to
${10}^{l}$ and on exit
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${\mathbf{7}}$, then all elements of the gradient vector will be smaller than
${10}^{l}$ in absolute value. For most practical purposes the value
${10}^{4}$ should suffice. You should be wary of setting
CGETOL too small since the convergence criterion may then have become too strict for the machine to handle.
If
CGETOL has been set to a value which is less than the square root of the
machine precision,
$\epsilon $, then G11SAF will use the value
$\sqrt{\epsilon}$ instead.
 12: MAXIT – INTEGERInput
On entry: the maximum number of iterations to be made in the maximum likelihood search. There will be an error exit (see
Section 6) if the search routine has not converged in
MAXIT iterations.
Suggested value:
${\mathbf{MAXIT}}=1000$.
Constraint:
${\mathbf{MAXIT}}\ge 1$.
 13: CHISQR – LOGICALInput
On entry: if
CHISQR is set equal to .TRUE., then a likelihood ratio statistic will be calculated (see
CHI).
If
CHISQR is set equal to .FALSE., no such statistic will be calculated.
 14: ISHOW – INTEGERInput
On entry: indicates which of the following three quantities are to be printed before exit from the routine (given a valid parameter set):
(a) 
Table of maximum likelihood estimates and standard errors (as returned in the output arrays A, C, ALPHA, PIGAM and CM). 
(b) 
Table of observed and expected first and second order margins (as returned in the output arrays EXPP and OBS). 
(c) 
Table of observed and expected frequencies of score patterns along with theta scores (as returned in the output arrays IRL, EXF, Y, XL and IOB) and the likelihood ratio statistic (if required). 
 ${\mathbf{ISHOW}}=0$
 None of the above are printed.
 ${\mathbf{ISHOW}}=1$
 (a) only is printed.
 ${\mathbf{ISHOW}}=2$
 (b) only is printed.
 ${\mathbf{ISHOW}}=3$
 (c) only is printed.
 ${\mathbf{ISHOW}}=4$
 (a) and (b) are printed.
 ${\mathbf{ISHOW}}=5$
 (a) and (c) are printed.
 ${\mathbf{ISHOW}}=6$
 (b) and (c) are printed.
 ${\mathbf{ISHOW}}=7$
 (a), (b) and (c) are printed.
Constraint:
$0\le {\mathbf{ISHOW}}\le 7$.
 15: NITER – INTEGEROutput
On exit: given a valid parameter set then
NITER contains the number of iterations performed by the maximum likelihood search routine.
 16: ALPHA(IP) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then
${\mathbf{ALPHA}}\left(j\right)$ contains the latest estimate of
${\alpha}_{j}$. (Because of possible recoding all elements of
ALPHA will be positive.)
 17: PIGAM(IP) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then ${\mathbf{PIGAM}}\left(j\right)$ contains the latest estimate of either ${\pi}_{j}$ if ${\mathbf{GPROB}}=\mathrm{.FALSE.}$ (logit model) or ${\gamma}_{j}$ if ${\mathbf{GPROB}}=\mathrm{.TRUE.}$ (probit model).
 18: CM(LDCM,$2\times {\mathbf{IP}}$) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then the strict lower triangle of
CM contains the correlation matrix of the parameter estimates held in
ALPHA and
PIGAM on exit. The diagonal elements of
CM contain the standard errors. Thus:
${\mathbf{CM}}\left(2\times i1,2\times i1\right)$  =  standard error $\left({\mathbf{ALPHA}}\left(i\right)\right)$ 
${\mathbf{CM}}\left(2\times i,2\times i\right)$  =  standard error $\left({\mathbf{PIGAM}}\left(i\right)\right)$ 
${\mathbf{CM}}\left(2\times i,2\times i1\right)$  =  correlation $\left({\mathbf{PIGAM}}\left(i\right),{\mathbf{ALPHA}}\left(i\right)\right)$, 
for
$i=1,2,\dots ,p$;
${\mathbf{CM}}\left(2\times i1,2\times j1\right)$  =  correlation $\left({\mathbf{ALPHA}}\left(i\right),{\mathbf{ALPHA}}\left(j\right)\right)$ 
${\mathbf{CM}}\left(2\times i,2\times j\right)$  =  correlation $\left({\mathbf{PIGAM}}\left(i\right),{\mathbf{PIGAM}}\left(j\right)\right)$ 
${\mathbf{CM}}\left(2\times i1,2\times j\right)$  =  correlation $\left({\mathbf{ALPHA}}\left(i\right),{\mathbf{PIGAM}}\left(j\right)\right)$ 
${\mathbf{CM}}\left(2\times i,2\times j1\right)$  =  correlation $\left({\mathbf{ALPHA}}\left(j\right),{\mathbf{PIGAM}}\left(i\right)\right)$, 
for
$j=1,2,\dots ,i1$.
If the second derivative matrix cannot be computed then all the elements of
CM are returned as zero.
 19: LDCM – INTEGERInput
On entry: the first dimension of the array
CM as declared in the (sub)program from which G11SAF is called.
Constraint:
${\mathbf{LDCM}}\ge 2\times {\mathbf{IP}}$.
 20: G($2\times {\mathbf{IP}}$) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then
G contains the estimated gradient vector corresponding to the final point held in the arrays
ALPHA and
PIGAM.
${\mathbf{G}}\left(2\times \mathit{j}1\right)$ contains the derivative of the loglikelihood with respect to
${\mathbf{ALPHA}}\left(\mathit{j}\right)$, for
$\mathit{j}=1,2,\dots ,p$.
${\mathbf{G}}\left(2\times \mathit{j}\right)$ contains the derivative of the loglikelihood with respect to
${\mathbf{PIGAM}}\left(\mathit{j}\right)$, for
$\mathit{j}=1,2,\dots ,p$.
 21: EXPP(LDEXPP,IP) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then
${\mathbf{EXPP}}\left(i,j\right)$ contains the expected percentage of individuals in the sample who respond positively to items
$i$ and
$j$ (
$j\le i$), corresponding to the final point held in the arrays
ALPHA and
PIGAM.
 22: LDEXPP – INTEGERInput
On entry: the first dimension of the arrays
EXPP and
OBS as declared in the (sub)program from which G11SAF is called.
Constraint:
${\mathbf{LDEXPP}}\ge {\mathbf{IP}}$.
 23: OBS(LDEXPP,IP) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then ${\mathbf{OBS}}\left(i,j\right)$ contains the observed percentage of individuals in the sample who responded positively to items $i$ and $j$ ($j\le i$).
 24: EXF(NS) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then
${\mathbf{EXF}}\left(l\right)$ contains the expected frequency of the
$l$th score pattern (
$l$th row of
X), corresponding to the final point held in the arrays
ALPHA and
PIGAM.
 25: Y(NS) – REAL (KIND=nag_wp) arrayOutput
On exit: given a valid parameter set then
${\mathbf{Y}}\left(l\right)$ contains the estimated theta score corresponding to the
$l$th row of
X, for the final point held in the arrays
ALPHA and
PIGAM.
 26: XL(NS) – REAL (KIND=nag_wp) arrayWorkspace
If
GPROB has been set equal to .FALSE. (logit model) then on exit, given a valid parameter set,
${\mathbf{XL}}\left(l\right)$ contains the estimated component score corresponding to the
$l$th row of
X for the final point held in the arrays
ALPHA and
PIGAM.
If
GPROB is set equal to .TRUE. (probit model), this array is not used.
 27: IOB(NS) – INTEGER arrayOutput
On exit: given a valid parameter set then
${\mathbf{IOB}}\left(l\right)$ contains the number of items in the
$l$th row of
X for which the response was positive (.TRUE.).
 28: RLOGL – REAL (KIND=nag_wp)Output
On exit: given a valid parameter set then
RLOGL contains the value of the loglikelihood kernel corresponding to the final point held in the arrays
ALPHA and
PIGAM, namely
 29: CHI – REAL (KIND=nag_wp)Output
On exit: if
CHISQR was set equal to .TRUE. on entry, then given a valid parameter set,
CHI will contain the value of the likelihood ratio statistic corresponding to the final parameter estimates held in the arrays
ALPHA and
PIGAM, namely
The summation is over those elements of
IRL which are positive. If
${\mathbf{EXF}}\left(l\right)$ is less than
$5.0$, then adjacent score patterns are pooled (the score patterns in
X being first put in order of increasing theta score).
If
CHISQR has been set equal to .FALSE., then
CHI is not used.
 30: IDF – INTEGEROutput
On exit: if
CHISQR was set equal to .TRUE. on entry, then given a valid parameter set,
IDF will contain the degrees of freedom associated with the likelihood ratio statistic,
CHI.
${\mathbf{IDF}}={s}_{0}2\times p$  if ${s}_{0}<{2}^{p}$; 
${\mathbf{IDF}}={s}_{0}2\times p1$  if ${s}_{0}={2}^{p}$, 
where
${s}_{0}$ denotes the number of terms summed to calculate
CHI (
${s}_{0}=s$ only if there is no pooling).
If
CHISQR has been set equal to .FALSE., then
IDF is not used.
 31: SIGLEV – REAL (KIND=nag_wp)Output
On exit: if
CHISQR was set equal to .TRUE. on entry, then given a valid parameter set,
SIGLEV will contain the significance level of
CHI based on
IDF degrees of freedom. If
IDF is zero or negative then
SIGLEV is set to zero.
If
CHISQR was set equal to .FALSE., then
SIGLEV is not used.
 32: W(LW) – REAL (KIND=nag_wp) arrayWorkspace
 33: LW – INTEGERInput
On entry: the dimension of the array
W as declared in the (sub)program from which G11SAF is called.
Constraint:
${\mathbf{LW}}\ge 4\times {\mathbf{IP}}\times \left({\mathbf{IP}}+16\right)$.
 34: IFAIL – INTEGERInput/Output

On entry:
IFAIL must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is
$1$.
When the value $\mathbf{1}\text{ or}1$ is used it is essential to test the value of IFAIL on exit.
On exit:
${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${{\mathbf{1}}}$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: G11SAF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
 ${\mathbf{IFAIL}}=1$
On entry,  ${\mathbf{IP}}<3$, 
or  ${\mathbf{N}}<7$, 
or  ${\mathbf{NS}}\le 2\times {\mathbf{IP}}$, 
or  ${\mathbf{NS}}>{\mathbf{N}}$, 
or  ${\mathbf{NS}}>{2}^{{\mathbf{IP}}}$, 
or  two or more rows of X are identical, 
or  ${\mathbf{LDX}}<{\mathbf{NS}}$, 
or  $\sum _{l=1}^{{\mathbf{NS}}}}{\mathbf{IRL}}\left(l\right)\ne {\mathbf{N}$, 
or  at least one of ${\mathbf{IRL}}\left(\mathit{l}\right)<0$, for $\mathit{l}=1,2,\dots ,{\mathbf{NS}}$, 
or  ${\mathbf{MAXIT}}<1$, 
or  ${\mathbf{ISHOW}}<0$, 
or  ${\mathbf{ISHOW}}>7$, 
or  ${\mathbf{LDCM}}<{\mathbf{IP}}+{\mathbf{IP}}$, 
or  ${\mathbf{LDEXPP}}<{\mathbf{IP}}$, 
or  ${\mathbf{LW}}<4\times {\mathbf{IP}}\times \left({\mathbf{IP}}+16\right)$. 
 ${\mathbf{IFAIL}}=2$
For at least one of the
IP items the responses are all at the same level. To proceed, you must delete this item from the dataset.
 ${\mathbf{IFAIL}}=3$
There have been
MAXIT iterations of the maximum likelihood search routine. If steady increases in the loglikelihood kernel were monitored up to the point where this exit occurred, then the exit probably occurred simply because
MAXIT was set too small, so the calculations should be restarted from the final point held in
A and
C. This type of exit may also indicate that there is no maximum to the likelihood surface.
 ${\mathbf{IFAIL}}=4$
One of the elements of
A has exceeded
$10.0$ in absolute value (see
Section 8.3). If steady increases in the loglikelihood kernel were monitored up to the point where this exit occurred then this exit may indicate that there is no maximum to the likelihood surface. You are advised to restart the calculations from a different point to see whether the EM algorithm moves off in the same direction.
 ${\mathbf{IFAIL}}=5$
This indicates a failure in
F01ABF which is used to invert the second derivative matrix for calculating the variancecovariance matrix of parameter estimates. It was also found that
MAXIT iterations had been performed (see
${\mathbf{IFAIL}}={\mathbf{3}}$). The elements of
CM will then have been set to zero on exit. You are advised to restart the calculations with a larger value for
MAXIT.
 ${\mathbf{IFAIL}}=6$
This indicates a failure in
F01ABF which is used to invert the second derivative matrix for calculating the variancecovariance matrix of parameter estimates. It was also found that one of the elements of
A had exceeded
$10.0$ in absolute value (see
${\mathbf{IFAIL}}={\mathbf{4}}$). The elements of
CM will have then been set to zero on exit. You are advised to restart the calculations from a different point to see whether the EM algorithm moves off in the same direction.
 ${\mathbf{IFAIL}}=7$
If
CHISQR was set equal to .TRUE. on entry, so that a likelihood ratio statistic was calculated, then
${\mathbf{IFAIL}}={\mathbf{7}}$ merely indicates that the value of
IDF on exit is
$\text{}\le 0$, i.e., the
${\chi}^{2}$ statistic is meaningless. In this case
SIGLEV is returned as zero.
All other output information should be correct, i.e., can be treated as if ${\mathbf{IFAIL}}={\mathbf{0}}$ on exit.
7 Accuracy
On exit from G11SAF if
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${\mathbf{7}}$ then the following condition will be satisfied:
If
${\mathbf{IFAIL}}={\mathbf{3}}$ or
${\mathbf{5}}$ on exit (i.e.,
MAXIT iterations have been performed but the above condition does not hold), then the elements in
A,
C,
ALPHA and
PIGAM may still be good approximations to the maximum likelihood estimates. You are advised to inspect the elements of
G to see whether this is confirmed.
The number of iterations required in the maximum likelihood search depends upon the number of observed variables, $p$, and the distance of the starting point you supplied from the solution. The number of multiplications and divisions performed in an iteration is proportional to $p$.
You are strongly advised to use the recommended starting values for the elements of
A and
C. Divergence may result from values you supplied even if they are very close to the solution. Divergence may also occur when an item has nearly all its responses at one level.
As in normal factor analysis, Heywood cases can often occur, particularly when
$p$ is small and
$n$ not very big. To overcome this difficulty the maximum likelihood search routine is terminated when the absolute value of one of the
${\alpha}_{j1}$ exceeds
$10.0$.
You have the option of deciding whether to exit from G11SAF (by setting
${\mathbf{IFAIL}}={\mathbf{0}}$ on entry) or to permit G11SAF to proceed onwards as if it had exited normally from the maximum likelihood search routine (setting
${\mathbf{IFAIL}}=1$ on entry).
The elements in
A,
C,
ALPHA and
PIGAM may still be good approximations to the maximum likelihood estimates. You are advised to inspect the elements
G to see whether this is confirmed.
When $n$ is not very large compared to $s$ a goodnessoffit statistic should not be calculated as many of the expected frequencies will then be less than $5$.
The observed and expected
percentages of sample members responding to individual and pairs of items held in the arrays
OBS and
EXPP on exit can be converted to observed and expected
numbers by multiplying all elements of these two arrays by
$n/100.0$.
9 Example
A program to fit the logit latent variable model to the following data:
Index 
Score Pattern 
Observed Frequency 
$\phantom{0}1$ 
$0000$ 
$\phantom{0}154$ 
$\phantom{0}2$ 
$1000$ 
$\phantom{00}11$ 
$\phantom{0}3$ 
$0001$ 
$\phantom{00}42$ 
$\phantom{0}4$ 
$0100$ 
$\phantom{00}49$ 
$\phantom{0}5$ 
$1001$ 
$\phantom{000}2$ 
$\phantom{0}6$ 
$1100$ 
$\phantom{00}10$ 
$\phantom{0}7$ 
$0101$ 
$\phantom{00}27$ 
$\phantom{0}8$ 
$0010$ 
$\phantom{00}84$ 
$\phantom{0}9$ 
$1101$ 
$\phantom{00}10$ 
$10$ 
$1010$ 
$\phantom{00}25$ 
$11$ 
$0011$ 
$\phantom{00}75$ 
$12$ 
$0110$ 
$\phantom{0}129$ 
$13$ 
$1011$ 
$\phantom{00}30$ 
$14$ 
$1110$ 
$\phantom{00}50$ 
$15$ 
$0111$ 
$\phantom{0}181$ 
$16$ 
$1111$ 
$\phantom{0}121$ 


–––– 
Total 

$1000$ 
9.1 Program Text
Program Text (g11safe.f90)
9.2 Program Data
Program Data (g11safe.d)
9.3 Program Results
Program Results (g11safe.r)