SECTION 10.

QUALITATIVE DEPENDENT VARIABLE ESTIMATION

GQOPT contains several built-in function subroutines that permit maximization of the likelihood functions for several qualitative dependent variable models. For those described in Sections 10.1, 10.1.1, 10.2, 10.2.1, 10.3 and 10.3.1 the MAIN program should contain

COMMON/USERP1/DATA(n,k+1) COMMON/USERP2/NDIM,KDIM

where

DATA = array containing observations on the variables by
columns, with column 1 normally being reserved for the dependent
variable

n = the actual number of observations

k = the actual number of independent variables stored (normally =
NP)

NDIM = a variable set equal to n

KDIM = a variable set equal to k

See Amemiya, T., "Qualitative Response Models," *Journal
of Economic Literature*, XIX (1981), 1483-1536.

1. The model is the following:

DATA_{i1}= 1 if X_{1}DATA_{i2}+ ... +X_{NP}DATA_{i,NP+1 }+ Ui > 0 DATA_{i1}= 0 otherwise

where U_{i} is assumed distributed iid as N(0,1).
Estimation is by maximum likelihood. The MAIN program should
contain, in addition to the standard cards (see Section
1),the followin:

EXTERNAL PROB1A COMMON/BPROB/IPROB,JPROB NDIM=n KDIM=k . . . IPROB=1 CALL OPT(X,NP,F,METHOD,ITERL,MAX,IER,ACC,PROB1A,ALABEL)

where PROB1A is the name of the built-in loglikelihood function. Since this is a maximization problem, set MAX=1. If the probit equation contains a constant term, as is normally the case, the column DATA(I,2) would be filled by the user by the number 1.0 and X(1) would represent the constant term. If there is no constant term in the equation, the user should set JPROB=0 prior to calling OPT. If the user wishes to have first, or first and second partial derivatives evaluated analytically, he should include the following subroutines...

SUBROUTINE FP(X,NP,F,FPD,FUNC) IMPLICIT REAL*8 (A-H,O-Z) DIMENSION X(NP),FPD(NP) EXTERNAL FUNC CALL PRFP1A(X,NP,F,FPD,FUNC) RETURN END

SUBROUTINE SP(X,NP,F,FPD,SPD,FUNC) IMPLICIT REAL*8 (A-H,O-Z) DIMENSION X(NP),FPD(NP),SPD(NP,NP) EXTERNAL FUNC CALL PRSP1A(X,NP,F,FPD,SPD,FUNC) RETURN END

2. Further options.

COMMON/BPROB1/WP,SSR,ER2,WSSR,SCC,FAD,JFLG,IFLG,KFLG,LFLG

where

WP = Fraction of wrong predictions

SSR = Sum of squared residuals

ER2 = Efron's R-squared

WSSR = Weighted sum of squared residuals

SCC = Squared correlation coefficient

FAD = McFadden's R-squared

JFLG = 1 if ER2 not computable, 0 otherwise

IFLG = 1 if WSSR not computable, 0 otherwise

KFLG = 1 if SCC not computable, 0 otherwise

LFLG = 1 if FAD not computable, 0 otherwise

If the user wishes to have these summary statistics computed and printed, he should insert in the MAIN program

CALL OPTOU3(X,NP,FU0,METHOD)

Warning: OPTOU3 must be called after OPTOUT or OPTMOV (see Section 1.2) because it alters some of the arrays used by the latter two subroutines.

Note: An optimization METHOD (e.g. GRADX) must be specified in the call to OPTOU3 because it must solve an optimization problem to compute McFadden's R-squared.

3. Several probit models. At times, the user may wish to estimate several probit models, using subsets of the same basic DATA matrix. Section 1.11 is relevant. The number of columns in the DATA matrix may be much larger than the number of parameters to be estimated. NP will still be set to k, but the effective number of parameters to be estimated, NPE, will be smaller. (Presumably, some parameters will be set = 0 and "permed out".The user must set the array IPRM (as described in Section 1.11) so as to permute the variables with respect to which optimization is to be per- formed into the first NPE positions. Thus, if DATA is dimen- sioned to have 6 columns and the user wishes to estimate the probit equation

DATA_{i1}= 1 if X_{1}DATA_{i2}+X_{5}DATA_{i6}+X_{4}DATA_{i5}+Ui>0 DATA_{i1}= 0 otherwise,

he should set

NP=5 NPE=3 IPRM(1)=1 IPRM(2)=5 IPRM(3)=4 IPRM(4)=2 IPRM(5)=3

All other conventions of Section 1.11 should also be observed; e.g., OPT should be called with PERM as the name of the subroutine that computes the function to be maximized, and PERM should call PERM1 with the subroutine name PROB1A. In particular, if analytic first and second partial derivatives are desired, it is important to make the following replacements.

a. In FP replace CALL PRFP1A(X,NP,F,FPD,FUNC) by the following:

DIMENSION FPD0(np) C where np is the actual value of NP COMMON/BPRM/IPRM(np) COMMON/BPRM2/XPRM(np) DO I=1,NP XPRM(IPRM(I))=X(I) END DO CALL PRFP1A(XPRM,np,F,FPD0,FUNC) DO I=1,NP FPD(I)=FPD0(IPRM(I)) END DO

b. In SP replace CALL PRSP1A(X,NP,F,FPD,SPD,FUNC) by the following:

DIMENSION SPD0(np,np) COMMON/BPRM/IPRM(np) COMMON/BPRM2/XPRM(np) DO I=1,NP XPRM(IPRM(I))=X(I) END DO CALL PRSP1A(XPRM,np,F,FPD,SPD0,FUNC) DO I=1,NP DO J=1,NP SPD(I,J)=SPD0(IPRM(I),IPRM(J)) END DO END DO

SECTION 10.1.1 PROBIT JACKKNIFE CALCULATION

See Sunil K. Sapra, "A Jackknife Maximum Likelihood Estimator for the Probit Model," *Applied Economics Letters*, 9(2002), 73-74.

The jackknife estimator is computed by alternately omitting each one of the *n* observations and maximizing the likelihood function.
If * X(i)* denotes the probit estimate with the i^{th}
observation omitted, *X(.)* the quantity
*(1/n)ΣX(i)*, and *X* the probit estimate based on all observations, the
bias-corrected jackknife maximum likelihood estimate is

In the MAIN program, include the statements

common/bprob/iprob,jprob common/btob1/itob common/userp3/icjackand set iprob=1, itob=0 for probit. It should also contain

COMMON/USERP1/DATA(n,k+1) COMMON/USERP2/NDIM,KDIM

where

DATA = array containing observations on the variables by
columns, with column 1 normally being reserved for the dependent
variable

n = the actual number of observations

k = the actual number of independent variables stored (normally =
NP)

NDIM = a variable set equal to n

KDIM = a variable set equal to k

In SUBROUTINE PERM, PERM1 should be called with PROB1J in the calling sequence of PERM1 and should be declared in an EXTERNAL statement.

Then call the jackknife estimator as

call probjack(X,NP,FU0,METHOD,ITERL,MAX,IER,ACC,PERM,ALABEL,xful,xjack,xstd,xtob,n,jer)where all symbols have the same meaning as in calling

SUBROUTINE OPTexcept

xful = a REAL*8 array dimensioned NP, which will contain the probit estimates based on all observations

xjack = a REAL*8 array dimensioned NP, which will contain the jackknife estimates

xstd = a REAL*8 array dimensioned NP, which will contain the standard deviations of the estimates

xtob = a REAL*8 array dimensioned NP, which will contain the tobit jackknife estimates (see below)

n = the number of observations and the dimension of the

jer = an error return, =0 if no errors, =−3 if certain arrays could not be allocated, =−2 if optimization error using all observations, =−1 optimization error in jackknife optimization.

Warning: OPTOUT and OPTOU3 are ineffective and should not be called after optimization.

See Amemiya, T., "Qualitative Response Models," *Journal
of Economic Literature*, XIX (1981),1483-1536 and Amemiya,
T., "Tobit Models: A Survey," Rhodes Associates, *CJRS*
4, July 1982. 1.

The model is the following:

DATA_{i1}= X_{1}DATA_{i2}+...+ X_{NP-1}DATA_{i,NP}+ U_{i}if the right hand side is positive, DATA_{i1}= 0 otherwise

where U_{i} is assumed distributed iid as N(0,S^{2}).
Estimation is by maximum likelihood. The MAIN program should
contain, in addition to the standard cards (see Section
1), the following:

COMMON/BTOB1/ITOB COMMON/BPRM3/MP EXTERNAL TOB2A . . . NP=np C (the actual value of np) MP=NP ITOB=1 CALL OPT(X,NP,F,METHOD,ITERL,MAX,IER,ACC,TOB2A,ALABEL)

where TOB2A is the name of the built-in likelihood function.
(See also Section 10.1). GQOPT actually estimates the tobit model
in a transformed version. In this version, instead of S^{2},
we estimate H=1./S and instead of X(J), J=1,...,NP-1 we estimate
H*X(J). If the user reads into X(1),...X(NP-1) the slope
coefficients appropriate to this normalization and reads into
X(NP) the proper value of H, he/she may directly call OPT. If,
however, he/she finds it desirable to read in the parameter
values correspon- ding to the form of the model given at the
beginning of this section, he/she should CALL ENSCRM before and
CALL DESCRM after calling OPT:

CALL ENSCRM(X,NP) CALL OPT(X,NP,FU0,METHOD,ITERL,MAX,IER,ACC,TOB2A,ALABEL) CALL DESCRM(X,NP)

The CALL DESCRM should not precede a call to OPTOUT or OPTMOV. If the user wishes to have first, or first and second partial derivatives evaluated analytically, he/she should include the following subroutines:

SUBROUTINE FP(X,NP,F,FPD,FUNC) IMPLICIT REAL*8 (A-H,O-Z) DIMENSION X(NP),FPD(NP) EXTERNAL FUNC CALL TOFP2A(X,NP,F,FPD,FUNC) RETURN END

SUBROUTINE SP(X,NP,F,FPD,SPD,FUNC) IMPLICIT REAL*8 (A-H,O-Z) DIMENSION X(NP),FPD(NP),SPD(NP,NP) EXTERNAL FUNC CALL TOSP2A(X,NP,F, FPD,SPD,FUNC) RETURN END

2. Further options. At times the user may wish to estimate several tobit models, using subsets of the same basic DATA matrix. This can be accomplished in the same manner as in the probit case. The reader should consult Section 10.1.3 and Section 1.11. It is further to be noted that SUBROUTINE PRMCHK should be called AFTER the call to ENSCRM and that before calling DESCRM (after optimization is finished), the user should "unperm" the variable array by

DO I=1,NP XPRM(IPRM(I)=X(I) END DO

Thus, the sequence of commands will be

CALL ENSCRM(X,NP) CALL PRMCHK(NP,X,ALABEL,iflag,&nn) CALL OPT(X,NPE,FU0,METHOD,ITERL,MAX,IER,ACC,PERM,ALABEL) CALL OPTOUT(0) DO I=1,NP XPRM(IPRM(I))=X(I) END DO CALL DESCRM(X,NP)

SECTION 10.2.1 TOBIT JACKKNIFE CALCULATION

See Sunil K. Sapra, "A Jackknife Maximum Likelihood Estimator for the Probit Model," *Applied Economics Letters*, 9(2002), 73-74.

The jackknife estimator is computed by alternately omitting each one of the *n* observations and maximizing the likelihood function.
If * X(i)* denotes the tobit estimate with the i^{th}
observation omitted, *X(.)* the quantity
*(1/n)ΣX(i)*, and *X* the probit estimate based on all observations, the
bias-corrected jackknife maximum likelihood estimate is

In the MAIN program, include the statements

common/bprob/iprob,jprob common/btob1/itob common/userp3/icjackand set iprob=0, itob = 1 tobit. It should also contain

COMMON/USERP1/DATA(n,k+1) COMMON/USERP2/NDIM,KDIM

where

DATA = array containing observations on the variables by
columns, with column 1 normally being reserved for the dependent
variable

n = the actual number of observations

k = the actual number of independent variables stored (normally =
NP)

NDIM = a variable set equal to n

KDIM = a variable set equal to k

SUBROUTINE PERM should be called with TOB2AJ in the calling sequence of PERM1 and should be declared in an EXTERNAL statement.

Then call the jackknife estimator as

call probjack(X,NP,FU0,METHOD,ITERL,MAX,IER,ACC,PERM,ALABEL,xful,xjack,xstd,xtob,n,jer)where all symbols have the same meaning as in calling

SUBROUTINE OPTexcept

xful = a REAL*8 array dimensioned NP, which will contain the probit estimates based on all observations

xjack = a REAL*8 array dimensioned NP, which will contain the jackknife estimates

xstd = a REAL*8 array dimensioned NP, which will contain the standard deviations of the estimates

xtob = a REAL*8 array dimensioned NP, which will contain the tobit jackknife estimates (see below)

n = the number of observations

jer = an error return, =0 if no errors, =−3 if certain arrays could not be allocated, =−2 if optimization error using all observations, =−1 optimization error in jackknife optimization.

Warning: OPTOUT and OPTOU3 are ineffective and should not be called after optimization.

See Amemiya, T., "Qualitative Response Models," *Journal
of Economic Literature*, XIX (1981), 1483-1536.

1. The model is the same as in Section 10.1 except that the error term is assumed to have logistic distribution. It is also assumed that there is no constant term in the equation. The MAIN program should contain, in addition to the standard statements (see Section 1), the following:

EXTERNAL PROB2A COMMON/BPROB/IPROB,JPROB NDIM=n KDIM=k . . . IPROB=2 CALL OPT(X,NP,F,METHOD,ITERL,MAX,IER,ACC,PROB2A,ALABEL)

where PROB2A is the name of the built-in loglikelihood function. Since this is a maximization problems, set MAX=1. Since it is assumed that there is no constant term in the equation, JPROB will automatically be set = 0. For analytic derivatives, see Section 10.1.1 with the following EXCEPTION: in SUBROUTINES FP and SP the user should call SUBROUTINES PRFP2A and PRSP2A respectively.

2. For further options see Section 10.1.2 with the following NOTE: Although in the call to OPTOU3 and optimization method needs to be specified because the way the call is structured, no optimization will actually be done because there is no constant term; hence under the null hypothesis the loglikeli- hood can be computed directly by setting X(J)=0.0 for all J. 3. For estimating several logit models, using the same basic DATA matrix, which normally involves suboptimization, see Section 10.1.3.

SECTION 10.3.1 LOGIT JACKKNIFE CALCULATION

See Sunil K. Sapra, "A Jackknife Maximum Likelihood Estimator for the Probit Model," *Applied Economics Letters*, 9(2002), 73-74.

The jackknife estimator is computed by alternately omitting each one of the *n* observations and maximizing the likelihood function.
If * X(i)* denotes the tobit estimate with the i^{th}
observation omitted, *X(.)* the quantity
*(1/n)ΣX(i)*, and *X* the probit estimate based on all observations, the
bias-corrected jackknife maximum likelihood estimate is

In the MAIN program, include the statements

common/bprob/iprob,jprob common/userp3/icjackand set iprob=2. It should also contain

COMMON/USERP1/DATA(n,k+1) COMMON/USERP2/NDIM,KDIM

where

n = the actual number of observations

k = the actual number of independent variables stored (normally =
NP)

NDIM = a variable set equal to n

KDIM = a variable set equal to k

SUBROUTINE PERM should be called with PROB2AJ in the calling sequence of PERM1 and should be declared in an EXTERNAL statement.

Then call the jackknife estimator as

call logjack(X,NP,FU0,METHOD,ITERL,MAX,IER,ACC,PERM,ALABEL,xful,xjack,xstd,n,jer)where all symbols have the same meaning as in calling

SUBROUTINE OPTexcept

xful = a REAL*8 array dimensioned NP, which will contain the probit estimates based on all observations

xjack = a REAL*8 array dimensioned NP, which will contain the jackknife estimates

xstd = a REAL*8 array dimensioned NP, which will contain the standard deviations of the estimates

n = the number of observations

jer = an error return, =0 if no errors, =−3 if certain arrays could not be allocated, =−2 if optimization error using all observations, =−1 optimization error in jackknife optimization.

Warning: OPTOUT and OPTOU3 are ineffective and should not be called after optimization.

SECTION 10.4 THE SIMPLE DISEQUILIBRIUM MODEL

See Quandt, R.E., *The Econometrics of Disequilibrium*,
Blackwell, 1988.

1. The model is

D_{i}= B_{1}X1_{i1}+ . . . + B_{K1}X1_{i,K1}+ U1_{i}S_{i}= B_{K1+1}X2_{i1 }+ . . . + B_{K1+K2}X2_{i,K2}+ U2_{i }Q_{i}= MIN(D_{i},S_{i})

where Q_{i},X1_{ij},X2_{ij} represent
data, B_{1},...B_{K1+K2} are coefficients in the
equations, B_{K1+K2+1} and B_{K1+K2+2} are the
variances of the the error terms in the equations. K1 is the
number of parameters in the demand, K2 the number in the supply
equation. N is the number of observations. The error terms are
assumed to be distributed normally with zero means,zero
covariance, and are independent over time. The exogenous
variables should be stored in X1 and X2 by columns. The MAIN
program should contain, in addition to the usual standard card
images (see Section 1), the following:

COMMON/USER1/Q(n) C where n is the number of observations COMMON/USER2/X1(n,k1) C k1 the number of demand parameters COMMON/USER3/X2(n,k2) C k2 the number of supply parameters COMMON/USER4/N,K1,K2 EXTERNAL DISEQ1 N= ... K1=... K2=... NP=K1+K2+2 . . . CALL OPT(A,NP,F,METHOD,ITERL,MAX,IER,ACC,DISEQ1,ALABEL)

where DISEQ1 is the name of the built-in likelihood function. If the user wishes to have first, or first and second derivatives evaluated analytically, he/she should include the following subroutines:

SUBROUTINE FP(X,NP,F,FPD,FUNC) IMPLICIT REAL*8 (A-H,O-Z) COMMON/BOPT2/ACC,R ,PM1,IVAL,ITERL,ITERC,MX,IER DIMENSION X(NP),FPD(NP) EXTERNAL FUNC CALL DISEFP(X,NP,F,FPD,FUNC,&10) RETURN 10 IER=-2 RETURN END

SUBROUTINE SP(X,NP,F,FPD,SPD,FUNC) IMPLICIT REAL*8 (A-H,O-Z) COMMON/BOPT2/ACC,R ,PM1,IVAL,ITERL,ITERC,MX,IER DIMENSION X(NP),FPD(NP),SPD(NP,NP) EXTERNAL FUNC CALL DISESP(X,NP,F,FPD,SPD,FUNC,&10) RETURN 10 IER=-2 RETURN END

2. Further options. At times the user may wish to estimate several disequilibrium models, using subsets of the same basic X1 and X2 matrices. This can be accomplished in the same manner as in the probit case. The reader should consult Section 10.1.3 and Section 1.11.

SECTION 10.5 PRICE ADJUSTING DISEQUILIBRIUM MODEL

See R. Quandt, *The Econometrics of Disequilibrium*,
Blackwell, 1988, pp. 23, 33-35.

1. The model is the following:

D_{i}= B_{1}P_{i}+ B_{2}X1_{i1}+ . . . + B_{K1}X1_{i,K1-1}+ U1_{i }S_{i}= B_{K1+1}P_{i }+ B_{K1+2}X2_{i1}+ . . . + B_{K1+K2}X2_{i,K2-1}+ + U2_{i }P_{i }= P_{i-1}+ B_{K1+K2+1}(D_{i}-S_{i}) + B_{K1+K2+2}X3_{i1}+ . . . + B_{K1+K2+K3}X3_{i,K3-1}+ U3_{i }Q_{i}= min(D_{i},S_{i})

where Q_{i}, P_{i}, X1_{ij}, X2_{ij},
X3_{ij} represent data, B_{1}, ...,B_{K1+K2+K3}
are coefficients in the equations, and B_{K1+K2+K3+1}, B_{K1+K2+K3+2},
B_{K1+K2+K3+3} represent the variances of the error terms
U1_{i}, U2_{i}, U3_{i} respectively. The
U's are assumed to be normally distributed with mean zero,
independent over time, and with zero contemporaneous covariances.
The exogenous variables should be stored in the X-arrays by
columns. The MAIN program should contain, in addition to the
usual standard statements (see Section 1),
the following:

COMMON/USSER0/Q(n) C where n is the number of observations COMMON/USSER1/P(n) COMMON/USSER2/X1(n,k1-1) COMMON/USSER3/X2(1) COMMON/USSER4/X3(1) C k1, k2, k3 are the (total) number of parameters in demand, supply, C and price adjustment equations COMMON/USSER5/N,K1,K2,K3 EXTERNAL DISEQ2 N= ... K1= ... K2= ... K3= ... NP=K1+K2+K3+3 . . . CALL OPT(B,NP,F,METHOD,ITERL,MAX,IER,ACC,DISEQ2,ALABEL)

where DISEQ2 is the name of the built-in likelihood function. Warning: This model frequently exhibits an unbounded likelihood function. When this is the case, computations will usually terminate with the message "CONTINUAL STRAYING INTO FORBIDDEN REGION" and one or more of the variances is likely to be very small (e.g., 1.D-8).

SECTION 10.6 GINSBURGH-TISHLER-ZANG DISEQUILIBRIUM MODEL

See R. Quandt, *The Econometrics of Disequilibrium*,
Blackwell, 1988, formula (4.2.9) on p. 112.

1. The model is the following:

D_{i }= B_{1}X1_{i1}+ . . . + B_{K1}X1_{iK1}S_{i}= B_{K1+1}X2_{i1}+ . . . + B_{K1+K2}X2_{iK2}Q_{i}= min(D_{i},S_{i}) + U_{i}

where Q_{i}, X1_{ij}, X2_{ij}
represent data, B_{1},...,B_{K1+K2} are
coefficients in the equations, and B_{K1+K2+1} represents
the variance of the error term U_{i}. K1 is the number of
parameters in the demand, K2 the number of parameters in the
supply equation. N is the number of observations. The error is
assumed to be distributed normally with mean zero and is
independent over time. The exogenous variables should be stored
in X1 and X2 by columns. The MAIN program should contain, in
addition to the usual standard statements (see Section
1), the following:

COMMON/USER1/Q(n) C where n is the number of observations COMMON/USER2/X1(n,k1) C k1 is the number of demand parameters COMMON/USER2/X2(n,k2) C k2 is the number of supply parameters COMMON/USER4/N,K1,K2 EXTERNAL DISEQ3 N= ... K1=... K2=... NP=K1+K2+1 . . . CALL OPT(B,NP,F,METHOD,ITERL,MAX,IER,ACC,DISEQ3,ALABEL)

where DISEQ3 is the name of the built-in likelihood function. Warning: This likelihood function can easily have several or even many local optima.

SECTION 10.7 POLYCHOTOMOUS RESPONSE MODELS (POLYCHO)

See Maddala, G. S., *Limited-dependent and Qualitative
Variables in Econometrics*, Cambridge Univ. Press, 1983, pp.
46-51.

The model is the following:

Y_{i}= b'x_{i}+ u_{i}

where Y_{i} is not observed, but we
observe the the category into which Y_{i} falls, i.e., it
falls in the j^{th} category if

a_{j-1 }< Y_{i }< a_{j}, (j = 1,. . .m)

where u_{i} is
assumed to be N(0,1). The MAIN program should contain the
following:

IMPLICIT REAL*8 (A-H,O-Z) DIMENSION C(k+ncat-1) COMMON/USERQ1/DATA(N,K) COMMON/USERQ2/IDATA(N) COMMON/USERQ3/N,K,NCAT EXTERNAL POLYCHO N=... K=... NCAT=... CALL OPT(C,NP,F,METHOD,ITERL,MAX,IER,ACC,POLYCHO,ALABEL)

where

DATA(N,K) contains the
observations on the independent variables

IDATA(N) contains the (integer) category of each observation

N = the number of observations

K = the number of elements in the b-vector

NCAT = the number of categories

C = the vector to be estimated; its first k components are the
elements of the b-vector and the next ncat-1 elements are the a's
(with the convention that a_{0} = -infinity and a_{ncat}=+infinity).