Re: [R] gam and optim

2013-09-22 Thread Greg Dropkin
just to clarify how I see the error, it was the mis-definition of the penalty term in the function dv. The following code corrects this error. What is actually being minimised at this step is the penalised deviance conditional on the smoothing parameter. A second issue is that the optim default ("N

[R] gam and optim

2013-09-20 Thread Greg Dropkin
hi probably a silly mistake, but I expected gam to minimise the penalised deviance. thanks greg set.seed(1) library(mgcv) x<-runif(100) lp<-exp(-2*x)*sin(8*x) y<-rpois(100,exp(lp)) plot(x,y) m1<-gam(y~s(x),poisson) points(x,exp(lp),pch=16,col="green3") points(x,fitted(m1),pch=16,cex=0.5,col="bl

Re: [R] gam and optim

2013-09-20 Thread Greg Dropkin
please ignore this, I see the error. greg > hi > > probably a silly mistake, but I expected gam to minimise the penalised > deviance. > > thanks > > greg > > set.seed(1) > library(mgcv) > x<-runif(100) > lp<-exp(-2*x)*sin(8*x) > y<-rpois(100,exp(lp)) > plot(x,y) > m1<-gam(y~s(x),poisson) > points