Ecological Archives E086-059-A2

Philip M. Dixon, Aaron M. Ellison, and Nicholas J. Gotelli. 2005. Improving the precision of estimates of the frequency of rare events. Ecology 86:1114–1123.

Appendix B. The SAS code used to fit a Poisson regression to detailed and aggregate data.

data wasps;
 input PlHour visit capture;
 logPH =  log(PlHour);
 
/*  aggregate data does not have a number of visits  */
 if visit =  . then do;
    Xcapture =  1;
    Xvisit = 1;
    Y =  capture;
    offset = logPH;
    output;
    end;
   else do;
 
/* detailed data includes a number of visits, generates 2 obs. */
/* for visits
    Xcapture =  0;
    Xvisit = 1;
    Y = visit;
    offset = logPH;
   output;
 
/*  and for captures     */
    Xcapture = 1;
    Xvisit = 0;
    Y = capture;
    offset = log(visit);
    output;
    end;
cards;
376.5 157 2
1416 .  6
;
proc print;
proc genmod data = wasps;
  model y = Xcapture Xvisit /d = poisson link = log
                             offset = offset noint obstats lrci;
  title 'Combined estimate of capture and visit rates';
 
run;



[Back to E086-059]