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

From: Jordan T Watson <jordan2_at_u.washington.edu>
Date: Sat, 07 Apr 2007 21:57:31 -0700 (PDT)

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

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.218529
> summary(gam(y~x0+x1+x2+s(x3),family=poisson,scale=-1))\$gcv
 5.058014
> summary(gam(y~x0+x1+x2+x3,family=poisson,scale=-1))\$gcv
 4.954163
> summary(gam(y~s(x3),family=poisson,scale=-1))\$gcv
 8.286693
>
> summary(gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=negative.binomial(1)))\$gcv
 1.047581
> summary(gam(y~x0+x1+x2+s(x3),family=negative.binomial(1)))\$gcv
 1.013617
> summary(gam(y~x0+x1+x2+x3,family=negative.binomial(1)))\$gcv
 1.012658
> summary(gam(y~s(x3),family=negative.binomial(1)))\$gcv
 1.005986

```#######################################
```

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

R-help_at_stat.math.ethz.ch 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. Received on Sun 08 Apr 2007 - 05:02:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 14 Apr 2007 - 00:31:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.