Groups | Search | Server Info | Login | Register


Groups > comp.soft-sys.sas > #981

ZIP Models Conversion from Proc Glimmix to Proc NLMixed

From miimes1 <michelle.imes@gmail.com>
Newsgroups comp.soft-sys.sas
Subject ZIP Models Conversion from Proc Glimmix to Proc NLMixed
Date 2011-06-21 13:05 -0700
Organization http://groups.google.com
Message-ID <579e70de-8016-4cea-b9f8-e587929fdc41@x3g2000yqj.googlegroups.com> (permalink)

Show all headers | View raw


Hi,

I was attempting to model a large, long-term count data set as a
function of environmental parameters as a Poisson Regression in PROC
GLIMMIX.  A very high proportion of the data are zeros, thus I feel a
zero-inflated model is more suiting than an overdispersed poisson
regression. I created a ZIP model from code provided in SAS for Mixed
Models 2nd Edition. However, when I attempt to run the QUANEW
Optimization cannon be completed method does not optimize.

In addition, I have nested random effects of within a year and among
survey years. The data are collected at each site (~1400 cells) on a
yearly basis (8 years) for 5 months during the breeding season (Jan-
May). Thus, I believe I also need to include a repeated measures
statement in the ZIP model. Can this be done?  Also, I have class
variables in PROC GLIMMIX and am not sure if this should be specified
in PROC NLMIXED?

I have provided PROC GLIMMIX as well as PROC NLMIXED code

PROC GLIMMIX data = final ; /**1**/
title 'Great Egret: Global ';
class  basinid rev  year surveymonth;
model ln_greg = basinid wd wd2 rev rec2 sqrec2 dsd cat sawmarsh
fwmarsh avep wd*rec2*rev GREG_Auto/ link=log dist=poisson  s cl  ;
random _residual_ /;/*accounting for overdispersion */
random surveymonth(year)/cl s; /*survey month nested within year*/
random year / sub=surveymonth type=arh(1) residual ; /*accounting for
repeated measures*/
output out=predA pred=pred;
ods output fitstatistics =a  parameterestimates=fixeda
solutionr=random;/*output parameter estimates, AIC and Logliklihood*/
run;



PROC NLMIXED data=final;
   parms b0=0 b1=0 b2=0 b3=0 b4=0 b5=0 b6=0 b7=0 b8=0 b9=0 b10=0 b11=0
b12=0 b13=0 a0=0 s2u=1;
   /*linear predictor for the inflation probability*/
   linpinfl = a0;
   /*infprob = inflation probability for zeros*/
   /*        = logistic transform of the linear predictor*/
   infprob = 1/(1+exp(-linpinfl));
   /*Poisson mean*/
   lambda = exp(b0 + b1*basinid + b2*wd + b3*wd2 + b4*rev + b5*rec2 +
b6*sqrec2 + b7*dsd + b8*cat
			 + b9* sawmarsh + b10*fwmarsh + b11*avep + b12*wd*rec2*rev +
b13*GREG_Auto + u);
   /*build the zip log likelihood*/
   if greg=0 then
     ll=log(infprob + (1-infprob)*exp(-lambda));
     else ll = log((1-infprob)) + greg*log(lambda) - lgamma(greg+1) -
lambda;
   model greg ~ general(ll);
   random u ~ normal(0,s2u) subject = year;
   estimate "inflation probability" infprob;
run;

Cheers,
Michelle

Back to comp.soft-sys.sas | Previous | Next | Find similar


Thread

ZIP Models Conversion from Proc Glimmix to Proc NLMixed miimes1 <michelle.imes@gmail.com> - 2011-06-21 13:05 -0700

csiph-web