Commit bb0260c9 authored by Dirk Eddelbuettel's avatar Dirk Eddelbuettel

Import Upstream version 1.3-27

parent 395e1d84
Package: mgcv
Version: 1.3-26
Version: 1.3-27
Author: Simon Wood <simon.wood@r-project.org>
Maintainer: Simon Wood <simon.wood@r-project.org>
Title: GAMs with GCV smoothness estimation and GAMMs by REML/PQL
......@@ -12,4 +12,4 @@ Imports: graphics, stats
Suggests: nlme (>= 3.1-64), MASS (>= 7.2-2)
LazyLoad: yes
License: GPL version 2 or later
Packaged: Mon Aug 13 10:19:33 2007; simon
Packaged: Wed Sep 26 22:48:19 2007; simon
......@@ -747,7 +747,6 @@ gam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
} else ## do performance iteration....
object<-gam.fit(G,family=G$family,control=control,gamma=gamma,fixedSteps=fixedSteps,...)
# fill returned s.p. array with estimated and supplied terms
temp.sp<-object$sp
object$sp<-G$all.sp
......@@ -773,21 +772,6 @@ gam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
temp.sp <- G$all.sp
temp.sp[G$all.sp<0] <- object$sp # copy estimated sp's into whole vector
object$sp <- temp.sp # correct object sp vector
} else { ## check for all fixed sp case ...
if (!G$am && (method$gam=="perf.outer"||method$gam=="outer")) {
## need to fix up GCV/UBRE score
if (G$sig2>0) {criterion <- "UBRE";scale <- G$sig2} else {
criterion <- method$gcv;scale <- -1}
if (criterion=="UBRE") object$gcv.ubre <- object$deviance/G$n - scale +
2 * gamma * scale* sum(object$edf)/G$n else
if (criterion=="deviance") object$gcv.ubre <- G$n *
object$deviance/(G$n-sum(object$edf))^2 else
if (criterion=="GACV") {
P <- sum(object$weights*object$residuals^2)
tau <- sum(object$edf)
object$gcv.ubre <- object$deviance/G$n + 2 * gamma*tau * P / (G$n*(G$n-tau))
}
}
}
## correct null deviance if there's an offset ....
......
......@@ -383,12 +383,15 @@ smooth.construct.tp.smooth.spec<-function(object,data,knots)
xu <- uniquecombs(matrix(x,n,object$dim)) ## find the unique `locations'
nu <- nrow(xu) ## number of unique locations
if (nu>xtra$max.knots) { ## then there is really a problem
seed <- .Random.seed ## store RNG seed
seed <- get(".Random.seed",envir=.GlobalEnv) ## store RNG seed
kind <- RNGkind(NULL)
RNGkind("default","default")
set.seed(xtra$seed) ## ensure repeatability
nk <- xtra$max.knots ## going to create nk knots
ind <- sample(1:nu,nk,replace=FALSE) ## by sampling these rows from xu
knt <- as.numeric(xu[ind,]) ## ... like this
.Random.seed <- seed ## RNG behaves as if it had not been used
RNGkind(kind[1],kind[2])
assign(".Random.seed",seed,envir=.GlobalEnv) ## RNG behaves as if it had not been used
}
} ## end of large data set handling
k<-object$bs.dim
......
1.3-26
1.3-27
* Fix of nasty bug in large dataset handling with "tp" basis. Subsampling
code was re-seeding RNG instead of intended behaviour of saving RNG
state and restoring it. Fixed and tested.
* modification to `gam' so that GCV/UBRE scores reported with all fixed
smoothing parameters are consistent with equivalent under s.p.
estimation.
1.3-26
* gam.fit3 modified to test for convergence of coefficients as well
as penalized deviance, otherwise in extreme cases the derivative
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment