[R] Can you use two offsets in gam (mgcv)?
s.wood at bath.ac.uk
Mon Jun 17 14:01:20 CEST 2013
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")
On 17/06/13 10:17, alice.jones wrote:
> 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.
> 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.
> R-help at r-project.org mailing list
> 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
More information about the R-help