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; |