|
Hello all,
I read the message of Dale about ZIP models and I am trying fit one.
I have two variables: FOTOP with 2 levels and BAP with 4 levels.
My response variable is shoots' number.
I fitted the models below, but it isnīt work.
I donīt know if I create the levels of BAP correctly, so I make two
programs but both isnīt work I need help.
The SAS programs are:
Proc nlmixed data=biom57 hess corr cov list;
parms beta0=1 beta1=1 gamma0=1 gamma1=1;
eta1= beta0 + beta1*fotop; * + null_2*bap;
w = exp(eta1)/(1+exp(eta1));
eta2=gamma0 + gamma1*bap ;*+ null_1*fotop;
lambda=exp(eta2);
if y=0 then prob=w + (1-w)*exp(-lambda);
if y=0 then logver=log(prob);
else logver=log(1-w)+y*log(lambda) - lambda - lgamma(y+1);
model y ~ general(loglike);
run;
and the other:
%macro zip_model(lev_fotop=, lev_bap=);
proc nlmixed data=biom57;
eta1 = beta0
%do i=1 %to %eval(&lev_fotop-1); + (fotop=&i)*fotop_&i %end;
%do i=1 %to %eval(&lev_bap-1); + (bap=i)*bap_&i %end;
%do i=1 %to %eval(&lev_fotop-1);
%do j=1 %to %eval(&lev_bap-1);
+ (fotop=&i & bap=&j)*inter_&i._&j
%end;
%end;
;
w = exp(eta1)/(1+exp(eta1));
eta2 = gamma0
%do i=1 %to %eval(&lev_bap-1); + (bap=i)*bap_&i %end;
;
lambda=exp(eta2);
if y=0 then prob=w + (1-w)*exp(-lambda);
if y=0 then logver=log(prob);
else logver=log(1-w)+y*log(lambda) - lambda - lgamma(y+1);
model y ~ general(loglike);
run;
%mend;
%zip_model(lev_fotop=2, lev_bap=4);
Thanks for your help.
Silvano.
|