From: maryann on
I am trying to fit a count data set to zero-inflated Negative Binomial
model using Proc NLMIXED in SAS 9.2.

My program works well with all datasets except the particular data set
below, from there I got an error message of
“ ERROR: Termination due to Floating Point Exception”
My research tells me that this problem is fixed in SAS 9.2.
I am really puzzled now. Your advice is greatly appreciated.

Sincerely, Maryann


data AUTOCNTYIP;
input x Freq;
datalines;
0 1706
1 351
2 408
3 268
4 74
5 5
;;
run;
%Let Var=X;
%let Infile=AUTOCNTYIP;

PROC SQL; SELECT MAX(&VAR) INTO :MAX FROM &iNFILE;

PROC SQL;SELECT SUM(ADJEXP) INTO :NUMRECORD FROM &INFILE;QUIT;
%PUT NUMRECORD: &NUMRECORD;


%let Xbar=0.8150782361; *mean of Variable X;
%let SS=1.3645822422; *Variance of Variable X;

/* Setting Initial Values for parameters*/
DATA P_HAT ;
W=0; * When w=0, zero-inflated Negative binomial reduces to negative
binomial. This leads to the following 2 moment estimates;
BHAT=&XBAR/(&SS-&XBAR); *Moment estimation of parameter b in Negative
Binomial model;
AHAT=&XBAR*BHAT;*Moment estimation of parameter a in Negative Binomial
model;
RUN;
DATA _NULL_;
SET P_HAT;
IF _N_=1 THEN DO;
CALL SYMPUT('AHAT',LEFT(TRIM(AHAT)));
CALL SYMPUT('BHAT',LEFT(TRIM(BHAT)));
CALL SYMPUT('W',LEFT(TRIM(W)));
END;
RUN;

***********PARAMETER ESTIMATION ZINB*********************;
PROC NLMIxed data=&Infile;
PARMS AHAT=&AHAT BHAT=&BHAT W=&W;
IF &VAR=0 THEN LNLIKE=LOG(W+(1-W)*((BHAT/(1+BHAT))**AHAT));ELSE
LNLIKE =LOG(1-W)+LOG(GAMMA(&Var+AHAT))-LOG(GAMMA(AHAT))-LOG(GAMMA
(&Var+1))
-(&Var+AHAT)*LOG(1+BHAT)+AHAT*LOG(BHAT);
MODEL &Var ~ GENERAL(LNLIKE);/* Max Likelihood MODEL */
REPLICATE Freq;


ODS OUTPUT PARAMETERESTIMATES=PESTIMATE_ZINB;/*OUTPUT PARAMETER
ESTIMATES*/;
ODS OUTPUT FitStatistics=FitStatistics_ZINB;/*OUTPUT PARAMETER
ESTIMATES*/;
RUN;

In addition, the other data sets fit well with the above code. For
example,
data HOSPITALSTAY;
input x Freq;
datalines;
0 3541
1 599
2 176
3 48
4 20
5 12
6 5
7 1
8 4
;;
run;