area as both a covariate and an offset?

927 views
Skip to first unread message

erynn...@maine.edu

unread,
Jul 28, 2013, 10:25:57 AM7/28/13
to unma...@googlegroups.com

Unmarked users,

I am using the gpcount function to model density from river bird count data sampled during a mostly visual survey where the observer stands in the same location on the river bank and counts birds in the same section of river for 20 minutes (within each five minute period, newly arriving and prior birds are distinguished), every two weeks in the spring and fall and every three weeks in the summer and winter, with four years of data.  I’m developing single species, single season models with observation and site covariates. I’m specifying offset variables to account for variation in the size of the survey area, such as for an obscovs model (presence of rock perches):

rock01.nb <- gpcount(~offset(log(AREAHA)), ~1, ~scale(JULIAN)+ROCK01, baeaumf, K=40, control=list(trace=TRUE, REPORT=1), mixture = "NB")

or sitecovs model (presence of a dam):

dam01.nb <- gpcount(~DAM01+offset(log(AREAHA)), ~1, ~scale(JULIAN), baeaumf, K=40, control=list(trace=TRUE, REPORT=1), mixture = "NB")

I was following the mink frog, Ch. 6 example (https://sites.google.com/site/hierarchicalmodelingcourse/home/r-scripts)

where area is used both as covariate and an offset.  I was recently told that this is incorrect to do.  When would it be appropriate to include as a covariate and when would it not be? 

This is how I was incorporating area into the model:

areaha.nb <- gpcount(~scale(AREAHA)+offset(log(AREAHA)), ~1, ~scale(JULIAN), baeaumf, K=40, control=list(trace=TRUE, REPORT=1), mixture = "NB")

global.site.nb <- gpcount(~BRIDGE01+TRIB01+TIDAL01+DAM01+scale(RIVKM)+scale(R3D)+scale(R1FC)+scale(R1WT)+offset(log(AREAHA)), ~1, ~scale(JULIAN), baeaumf, K=40, control=list(trace=TRUE, REPORT=1), mixture = "NB")

Thank you for any insights!

Erynn

Jeffrey Royle

unread,
Jul 28, 2013, 10:44:16 AM7/28/13
to unma...@googlegroups.com
hi Erynn,

 I think its ok to have "area" as both an offset and as an estimated covariate.  My thinking on this is that having the offfset just changes the interpretation from "abundance" to "density" whereas having it as an estimated effect (with the offset) is allowing density to change at a faster or slower rate than suggested just by scaling with area.

 I'm curious what the reason someone gave you or this being incorrect?

 I'd also be curious to hear Richard's input on this.

regards
andy



--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jeffrey Royle

unread,
Jul 28, 2013, 11:00:56 AM7/28/13
to unma...@googlegroups.com
one follow-up:
 having the offset in there changes the response to "individuals per unit area" (i.e., density) and you probably need the offset if sample areas are very different because in most cases that is an important source of variation.
 Having the offset in the model implies that population size scales linearly with area. i.e., E[N] = Area*lambda
 If you estimate the effect of area, then you are allowing for a slower or faster rate off increase in population size as Area changes. I think there are probably a lot of biological mechanisms that might lead to one or the other (faster or slower increases) and so it seems sensible to estimate the effect in general.

regards
andy



On Sun, Jul 28, 2013 at 10:25 AM, <erynn...@maine.edu> wrote:

--

erynn...@maine.edu

unread,
Jul 29, 2013, 3:22:05 PM7/29/13
to unma...@googlegroups.com
Thank you Andy.  In your opinion I would be correct to include area as both an offset and a covariate in the model?  This was the justification for not using area as both an offset and covariate:

"When you use area as an offset you are, in effect, creating a rate (as counts per unit area). This is your correction /adjustment for area.  Including area as a variable asks if area  (on the right side of your model) is correlated with area (in this case log(area)) on the left side of your model.  Thus, any 'significance' of area in your model will just be due to its correlation with itself and not with the actual counts."

Jeffrey Royle

unread,
Jul 29, 2013, 3:31:41 PM7/29/13
to unma...@googlegroups.com
hi Erynn,
 Yes, I think you can have area both as an offset and as a covariate although it is statistially equivalent to just fitting it as a covariate. But having both terms changes the interpretation slightly (from abundance to density as per my previous email).
 The model with both terms is:
 
 E[y] = a0 + log(area) + a1*log(area)
 
which is clearly the same as
 
 E[y] = a0 + (a1+ 1)*log(area)
 
They are exactly equivalent models.
 
regards
andy
 
 
 
 

Erynn Call

unread,
Jul 29, 2013, 3:34:46 PM7/29/13
to unma...@googlegroups.com
Yes, that makes sense.  Thanks for the insights!


--
You received this message because you are subscribed to a topic in the Google Groups "unmarked" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/unmarked/nvjjFujJSYY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to unmarked+u...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Erynn Call
Ph.D. candidate: Department of Wildlife Ecology
5755 Nutting Hall, Room 210
University of Maine
Orono, ME 04469
906.630.0266 (personal cell)
207.592.0114 (work cell)
207.941.4481 (office)
Message has been deleted

Dan Linden

unread,
Jul 31, 2013, 12:28:58 PM7/31/13
to unma...@googlegroups.com
The person that expressed this concern to Erynn provided her with some example R code to illustrate the situation.  But this example code only illustrated what happens when you improperly include an offset.  They simulated random counts that were completely unrelated to area (i.e., no scaling relationship) and the resulting Poisson regression with area as both an offset and a covariate estimated a significant coefficient for area.  That's because the offset should not have been included in the first place!  The code below shows this problem.

When count is unrelated to area, the regression with area as both an offset and a covariate estimates a significant coefficient = -1, which is obviously counteracting the improperly imposed +1 coefficient for the offset.  Anyway, this may be elementary for some but I thought it further supported the logic that Andy provided.

#----------------------------------------------------------#
n=100
area=rlnorm(n,3,2)
lambda <- 3
coeff <- 0.5  # coefficient for the covariate effect

# generate random counts that do NOT depend on area
count=rpois(n,lambda)
# generate random counts that DO depend on area (remove hash to use)
#count<-sapply(area,function(x){rpois(1,exp(log(lambda) + log(x) + coeff*(log(x))))})

models <- list()
# Both offset and covariate
models[[1]] <- glm(count~offset(log(area))+I(log(area)),family="poisson")
# Only covariate
models[[2]] <- glm(count~I(log(area)),family="poisson")
# Only offset
models[[3]] <- glm(count~offset(log(area)),family="poisson")
# Neither (intercept only)
models[[4]] <- glm(count~1,family="poisson")

lapply(models,summary)
#----------------------------------------------------------#

Kery Marc

unread,
Aug 8, 2013, 11:47:15 AM8/8/13
to unma...@googlegroups.com
Dear Andy et al,

I also like the following description of an offset in a GLM: "a covariate with effect fixed at 1". Hence, as you say, if some "scaling term" is entered into a GLM as a covariate instead of as an offset, then then scaling is allowed to vary.

I think I would not add such a term as both an offset and as a covariate. I see the offset solution as kind of a special case of the latter.

Kind regards  --  Marc

______________________________________________________________
 
Marc Kéry
Tel. ++41 41 462 97 93
marc...@vogelwarte.ch
www.vogelwarte.ch
 
Swiss Ornithological Institute | Seerose 1 | CH-6204 Sempach | Switzerland
______________________________________________________________
 
*** Introduction to Bayesian statistical modeling: Kéry (2010), Introduction to WinBUGS for Ecologists, Academic Press; see www.mbr-pwrc.usgs.gov/pubanalysis/kerybook
*** Book on Bayesian statistical modeling: Kéry & Schaub (2012), Bayesian Population Analysis using WinBUGS, Academic Press; see www.vogelwarte.ch/bpa
*** Upcoming workshops: http://www.phidot.org/forum/viewforum.php?f=8


From: unma...@googlegroups.com [unma...@googlegroups.com] on behalf of Jeffrey Royle [jar...@gmail.com]
Sent: 28 July 2013 17:00
To: unma...@googlegroups.com
Subject: Re: [unmarked] area as both a covariate and an offset?

Reply all
Reply to author
Forward
0 new messages