Can you use two offsets in gam (mgcv)?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can you use two offsets in gam (mgcv)?

alice.jones
Hello,
I have been trying to find out whether it is possible to use more than one offset in a gam (in mgcv).  
The reason I would like to do this is to 1) account for area surveyed in a Poisson model of sightings of porpoises within defined grid cells (each cell has a slightly different area) and 2) account for detection probability within each grid cell (some grid cells are further away from the observer than others, and this affects the likelihood of seeing the porpoises).
I would like to specify the model as something like:
gam(porpoises ~ s(covariates) + log(offset(grid cell area) + log(offset(detection), family = "poisson").  Does this seems sensible?  I am unsure of the way the two offsets will work together........ are they going to be additive? I have had a search online and looked in the Wood 2006 book, mgcv manual etc, but haven't managed to find anything that mentions using multiple offsets.
Any advice would be very welcome.
Cheers,
Alice
Reply | Threaded
Open this post in threaded view
|

Re: Can you use two offsets in gam (mgcv)?

Simon Wood-4
Hi Alice

An offset is just a fixed vector added to the linear predictor of a
model, so if you want to add two fixed vectors, you might as well add
them together first. i.e. I think you want something like

off <- log(grid.cell.area) + log(detection)
gam(porpoises ~ s(covariates) + offset(off), family = "poisson")

Simon


On 17/06/13 10:17, alice.jones wrote:

> Hello,
> I have been trying to find out whether it is possible to use more than one
> offset in a gam (in mgcv).
> The reason I would like to do this is to 1) account for area surveyed in a
> Poisson model of sightings of porpoises within defined grid cells (each cell
> has a slightly different area) and 2) account for detection probability
> within each grid cell (some grid cells are further away from the observer
> than others, and this affects the likelihood of seeing the porpoises).
> I would like to specify the model as something like:
> gam(porpoises ~ s(covariates) + log(offset(grid cell area) +
> log(offset(detection), family = "poisson").  Does this seems sensible?  I am
> unsure of the way the two offsets will work together........ are they going
> to be additive? I have had a search online and looked in the Wood 2006 book,
> mgcv manual etc, but haven't managed to find anything that mentions using
> multiple offsets.
> Any advice would be very welcome.
> Cheers,
> Alice
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Can-you-use-two-offsets-in-gam-mgcv-tp4669684.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603               http://people.bath.ac.uk/sw283

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Can you use two offsets in gam (mgcv)?

alice.jones
This post has NOT been accepted by the mailing list yet.
Hi Simon,

Thanks very much for your quick response.

As a follow on: Is it possible to specify an offset which has a negative effect on the linear predictor?

The reason I ask is because the 'detection' offset is a probability, where areas that are further away from the observer have lower detection probabilities and the porpoise counts need to be corrected upwards to account for the porpoises that aren't detected.  I *think* this is the opposite of the way that an offset normally works (say for area, where as area increases so does the potential for sightings).  In the case of detection; as probability of detection increases, the need to correct for missed observations decreases.  So, I was just wondering whether specifying:
gam(porpoise ~ s(covariates - log(offset(detection)) would work?  
I assume that specifying: gam(porpoise ~ s(covariates + log(offset(- detection)) won't work because of the problem with logging a negative value.  

An alternative would just be to use the inverse of the detection probability in the offset, and specify the offset in the 'normal' way........

Thanks again,

Alice