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
fixed.
So...
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.
best,
Simon
ps. Tedious details of AIC smoothing uncertainty correction are in
sections 4 and 5 of this:
http://amstat.tandfonline.com/doi/pdf/10.1080/01621459.2016.1180986
--
Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK
+44 (0)117 33 18273
http://www.maths.bris.ac.uk/~sw15190