# [R] Relative GCV - poisson and negbin GAMs (mgcv)

Jordan T Watson jordan2 at u.washington.edu
Sun Apr 8 06:57:31 CEST 2007

```I am using gam in mgcv (1.3-22) and trying to use gcv to help with model selection.  However, I'm a little confused by the process of assessing GCV scores based on their magnitude (or on relative changes in magnitude).

Differences in GCV scores often seem "obvious" with my poisson gams but with negative binomial, the decision seems less clear.

My data represent a similar pattern as below - where I see (seemingly) drastic changes in GCV for the poisson with different model structures, but the negative binomial often seems only to change in the second or third decimal place for the same models.

Is there a standard for how many decimals one should look at GCV, or am I totally missing something (I'm quite new to this, as I'm sure is obvious).  Why such a difference in GCV change between poisson and negbin?

Jordan

library(mgcv)
set.seed(0)
n<-400
sig<-2
x0 <- runif(n, 0, 1)
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <- runif(n, 0, 1)
f0 <- function(x) 2 * sin(pi * x)
f1 <- function(x) exp(2 * x)
f2 <- function(x) 0.2*x^11*(10*(1-x))^6+10*(10*x)^3*(1-x)^10
f <- f0(x0) + f1(x1) + f2(x2)
g<-exp(f/4)
y<-rpois(rep(1,n),g)
summary(gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=poisson,scale=-1))\$gcv
summary(gam(y~x0+x1+x2+s(x3),family=poisson,scale=-1))\$gcv
summary(gam(y~x0+x1+x2+x3,family=poisson,scale=-1))\$gcv
summary(gam(y~s(x3),family=poisson,scale=-1))\$gcv

summary(gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=negative.binomial(1)))\$gcv
summary(gam(y~x0+x1+x2+s(x3),family=negative.binomial(1)))\$gcv
summary(gam(y~x0+x1+x2+x3,family=negative.binomial(1)))\$gcv
summary(gam(y~s(x3),family=negative.binomial(1)))\$gcv

Outputs from above:
> summary(gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=poisson,scale=-1))\$gcv
[1] 1.218529
> summary(gam(y~x0+x1+x2+s(x3),family=poisson,scale=-1))\$gcv
[1] 5.058014
> summary(gam(y~x0+x1+x2+x3,family=poisson,scale=-1))\$gcv
[1] 4.954163
> summary(gam(y~s(x3),family=poisson,scale=-1))\$gcv
[1] 8.286693
>
> summary(gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=negative.binomial(1)))\$gcv
[1] 1.047581
> summary(gam(y~x0+x1+x2+s(x3),family=negative.binomial(1)))\$gcv
[1] 1.013617
> summary(gam(y~x0+x1+x2+x3,family=negative.binomial(1)))\$gcv
[1] 1.012658
> summary(gam(y~s(x3),family=negative.binomial(1)))\$gcv
[1] 1.005986

#######################################
Jordan Watson
School of Aquatic and Fishery Sciences
University of Washington
Seattle, WA

```