[R] Theta in Negative binomial GAM
simon.wood at bath.edu
Mon Feb 27 09:49:02 CET 2017
nb() will default to "REML" smoothing parameter estimation, while
negbin() will default to "UBRE" unless you use the 'method="REML"'
option to 'gam'. Using UBRE in place of REML may lead to differences in
model fit, and will also mean that the AIC is not corrected for
smoothing parameter uncertainty (this correction increases the AIC). You
also expect AIC to drop by 2 or so, because negbin is treating theta as
m <- gam(...,family=nb())
should give similar AIC values about 2 higher than
th1 <- m$family$getTheta(TRUE)
m1 <- gam(...,family=negbin(th1),method="REML")
If you don't know theta it is better to estimate it.
ps. Tedious details of AIC smoothing uncertainty correction are in
sections 4 and 5 of this:
On 26/02/17 22:26, Eva Maria Leunissen wrote:
> Hi, I'm fitting a negative binomial GAM (using mgcv) to my data using
> family=nb() so theta is estimated during the fitting process. When I then
> extract this theta from the model and refit the same model with
> family=negbin(theta) it gives a much lower AIC. I know using AIC to compare
> negative binomial models should be done with caution (
> but approximately it is ok. My questions are:
> Is it better to do model selection with nb() or with negbin and a known
> theta. if the latter how do you know what theta is?
> can you compare models using AIC if the theta is different for each model?
> Thanks in advance, any help is much appreciated
> Kind regards,
> Eva Leunissen
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK
+44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190
More information about the R-help