Skip to content

Commit

Permalink
version 1.8-5
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Wood authored and gaborcsardi committed Mar 2, 2015
1 parent 49b3414 commit da43576
Show file tree
Hide file tree
Showing 63 changed files with 5,528 additions and 1,812 deletions.
17 changes: 9 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
Package: mgcv
Version: 1.8-4
Version: 1.8-5
Author: Simon Wood <simon.wood@r-project.org>
Maintainer: Simon Wood <simon.wood@r-project.org>
Title: Mixed GAM Computation Vehicle with GCV/AIC/REML smoothness
estimation
Description: Routines for GAMs and other generalized ridge regression
with multiple smoothing parameter selection by GCV, REML
or UBRE/AIC. Also GAMMs. Includes a gam() function.
Title: Mixed GAM Computation Vehicle with GCV/AIC/REML Smoothness
Estimation
Description: GAMs, GAMMs and other generalized ridge regression with
multiple smoothing parameter estimation by GCV, REML or UBRE/AIC.
Includes a gam() function, a wide variety of smoothers, JAGS
support and distributions beyond the exponential family.
Priority: recommended
Depends: R (>= 2.14.0), nlme (>= 3.1-64)
Imports: methods, stats, graphics, Matrix
Suggests: splines, parallel, survival, MASS
LazyLoad: yes
ByteCompile: yes
License: GPL (>= 2)
Packaged: 2014-11-27 09:49:02 UTC; sw283
Packaged: 2015-03-02 21:05:39 UTC; sw283
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2014-11-27 13:16:04
Date/Publication: 2015-03-03 09:18:09
109 changes: 62 additions & 47 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
0ea61afceef0bf25b8c9d74103884936 *ChangeLog
1a88c7e031e86b1a4d2f0a3733714046 *DESCRIPTION
dcdf699f4b790dfe04b100f3c980436c *ChangeLog
cadc1146dc050c7dc00162207980193b *DESCRIPTION
eb723b61539feef013de476e68b5c50a *GPL-2
68be7e47206e4b5ee210fb6de27f8169 *NAMESPACE
27f3c91b6ebcefafbf8f370ea38d08c9 *R/bam.r
af08e19c4214ac86d453bd90e1ce9e4e *NAMESPACE
4d8460a0933930189b287f8f77bdfabf *R/bam.r
52ea7081e235df890d3e51198bcc3092 *R/coxph.r
d6f40f3d2acd3e30f3a59cbc85da6bc3 *R/efam.r
a824a6e49020786a1eba60b99939eff1 *R/fast-REML.r
065215b64c502afab215f6e97e9ec915 *R/gam.fit3.r
6586de2772276237525c646362926f8b *R/gam.fit4.r
8e0796908b72ff7d4d5f57740050a488 *R/efam.r
8cde8b6379034d9eb78caaf1b0d04cf8 *R/fast-REML.r
5df55d3cb82ac4669fc89909769d5a95 *R/gam.fit3.r
cbeb60506c33d463465efb5d1ada43f5 *R/gam.fit4.r
e63276b78a4ff2566af2e651bfc6aa9c *R/gam.sim.r
bd651b8eec80d83d6e0de5f47715a0de *R/gamlss.r
449b21801a62d0d6b753e753d4861570 *R/gamm.r
739156695988beabea60d2e259073821 *R/jagam.r
b5887ec9a16b1842918901bc5e4ecc94 *R/mgcv.r
a0d1da72334aefd546cad58d1b2062b1 *R/misc.r
c287514d201a02f060fee98aab1e93c8 *R/mvam.r
8e3b23448498fd03e668165ca3b01a60 *R/plots.r
92302835adba3710624e434ad52173bf *R/smooth.r
90f72ef91dfc2a25c262fc002f781bf7 *R/soap.r
0c5d2acdc985d2af9de6bb736d4df2ab *R/sparse.r
9a4ef9d8c7362256e314be0e65b5a96c *R/gamlss.r
28ddc8624513070a62d0cc2aba7776a2 *R/gamm.r
09240f99d77e54848bf15d540c267022 *R/jagam.r
9a451b851f1e08fb7c7c60738556392d *R/mgcv.r
2f7ab8cc9f9cf2f6cb52fc72f9f69bfb *R/misc.r
6c53ea135a7ac956fbe8a3d16c59baaa *R/mvam.r
58413439e82b60d8942d070ca72f8e14 *R/plots.r
3e87a7ef880c8aa40ce57201f6ea5458 *R/smooth.r
68348617c5d3b0e2ea805c4360a8cdd4 *R/soap.r
76cc875719bf0ef9eab45ea5bfeccda6 *R/sparse.r
e468195a83fab90da8e760c2c3884bd3 *data/columb.polys.rda
40874e3ced720a596750f499ded8a60a *data/columb.rda
074adce4131eced4cc71c67ad1d63c52 *inst/CITATION
20b3c68124572bfdbba2938b6cda8ada *man/Beta.Rd
5280bb00fa6595ff4a4b70d2e80114a8 *inst/po/de/LC_MESSAGES/R-mgcv.mo
c745969a1292eb3d49dfd0d0c2c997d4 *inst/po/de/LC_MESSAGES/mgcv.mo
9a49cc8d28e67874337cbe11d8632138 *inst/po/en@quot/LC_MESSAGES/R-mgcv.mo
447116b9728f9a82da5ce5d821850917 *inst/po/en@quot/LC_MESSAGES/mgcv.mo
2d98abb49e987bb8ebdf9be5cdbbb68b *inst/po/fr/LC_MESSAGES/R-mgcv.mo
643671acdb430cb0790f43559addbb0d *inst/po/fr/LC_MESSAGES/mgcv.mo
ea6f2b5c19372fda131171a03c983d6c *inst/po/ko/LC_MESSAGES/R-mgcv.mo
c1b1475e5fef49fe49929d2796ff87b6 *inst/po/ko/LC_MESSAGES/mgcv.mo
f8a930e0893c980fc2e9cfe276107e0f *inst/po/pl/LC_MESSAGES/R-mgcv.mo
715e52c0debf9848bbda15e94f5e7315 *inst/po/pl/LC_MESSAGES/mgcv.mo
251140c0e4b621fd578dae4ce8a28c8f *inst/po/po/LC_MESSAGES/R-mgcv.mo
4e7e8faae00111b7db61daab04358202 *inst/po/po/LC_MESSAGES/mgcv.mo
c574fe1ca9d55a9818d308906f16d16e *man/Beta.Rd
5bf12ddc0dab9daae72271b96a15c539 *man/Predict.matrix.Rd
c45c0f78f753461b33a295883461e732 *man/Predict.matrix.cr.smooth.Rd
e9b0a2e31b130cf2cb38618ec50d1919 *man/Predict.matrix.soap.film.Rd
Expand All @@ -45,7 +57,7 @@ c7561a0f2e114247955e212aeabc6ae9 *man/formXtViX.Rd
d87ff6287d7e343ea24d2053f4724b35 *man/formula.gam.Rd
4da4d585b329769eb44f0c7a6e7dd554 *man/fs.test.Rd
6f405acde2d7b6f464cf45f5395113ba *man/full.score.Rd
a1492616b069844ea05762687473c4fd *man/gam.Rd
a54ea44bb9641389bcbd21ce0e578d8f *man/gam.Rd
fe61dd0efab9e920c17335faf3d5764c *man/gam.check.Rd
a65bc22f606e45d185bc375fbf5698a1 *man/gam.control.Rd
44db24b66ce63bc16d2c8bc3f5b42ac5 *man/gam.convergence.Rd
Expand All @@ -68,7 +80,7 @@ a2ea1233d43fac89e0cacbc09a8d31e2 *man/in.out.Rd
2f222eeeb3d7bc42f93869bf8c2af58a *man/influence.gam.Rd
bafea2eef12fdc819f8ac1fb41d8b914 *man/initial.sp.Rd
c00bcfe2d0b44b2ea955f3934421807c *man/interpret.gam.Rd
ae18c335a5bb7192ad608a5a500c2794 *man/jagam.Rd
469e313e7a1b0520593c8e7a938111b5 *man/jagam.Rd
07d2c259b9edf164f42935170b4fccd0 *man/ldTweedie.Rd
58e73ac26b93dc9d28bb27c8699e12cf *man/linear.functional.terms.Rd
93035193b0faa32700e1421ce8c1e9f6 *man/logLik.gam.Rd
Expand All @@ -77,7 +89,7 @@ ae18c335a5bb7192ad608a5a500c2794 *man/jagam.Rd
5169af4be5fccf9fa79b6de08e9ea035 *man/magic.post.proc.Rd
59672d8599211ce9cf44252f92110920 *man/mgcv-FAQ.Rd
01926b8c2bda6fc74b51f6ec7f5cc620 *man/mgcv-package.Rd
934b90e0845a4971b97f1d67d12d61ec *man/mgcv-parallel.Rd
92499f4c6bc65a0cffd31bd8bc993a9f *man/mgcv-parallel.Rd
00ccf213c31910cd14f1df65a300eb33 *man/model.matrix.gam.Rd
bc9b89db7e7ff246749551c16f5f1f07 *man/mono.con.Rd
d33914a328f645af13f5a42914ca0f35 *man/mroot.Rd
Expand All @@ -93,9 +105,9 @@ c64b44bc684cbadfe77e7f6dc833ddb4 *man/pcls.Rd
8c0f8575b427f30316b639a326193aeb *man/pdTens.Rd
1721f1b266d9e14827e8226e2cb74a81 *man/pen.edf.Rd
edf57071572275a8443b2f0b66d44424 *man/place.knots.Rd
4aed50caabd7f058f90437dab4cdbee0 *man/plot.gam.Rd
c488918033a996ce97943bf20ff8ac54 *man/plot.gam.Rd
c27a6b886929b1dc83bf4b90cae848f9 *man/polys.plot.Rd
afca36f5b1a5d06a7fcab2eaaa029e7e *man/predict.bam.Rd
085dff270e5255315cb244368faf79df *man/predict.bam.Rd
900647986ab1365d437368cc28b62658 *man/predict.gam.Rd
7562cb5ce9a7fbf0cd60124cf4305315 *man/print.gam.Rd
b8ac3ed8fc05bb14c605b996404853cd *man/qq.gam.Rd
Expand All @@ -105,6 +117,7 @@ c523210ae95cb9aaa0aaa1c37da1a4c5 *man/residuals.gam.Rd
f6f1333be2587ffef5970905b13468ea *man/rig.Rd
7258dfc0149fff020054117fd2ee6bd8 *man/s.Rd
c438eb3e41cb1f51e72283380145d210 *man/scat.Rd
2199afd400a1821b74a24e2578bc0224 *man/single.index.Rd
6f03e337d54221bc167d531e25af1eea *man/slanczos.Rd
b5a06918956fd10f23285b453c05bdb4 *man/smooth.construct.Rd
4a689eba97e4fed138dccb8cad13205e *man/smooth.construct.ad.smooth.spec.Rd
Expand All @@ -130,37 +143,39 @@ f0791d830687d6155efb8a73db787401 *man/summary.gam.Rd
6eebb6ef90374ee09453d6da6449ed79 *man/tensor.prod.model.matrix.Rd
71add05e5823dcc0509f435ab4dc4627 *man/uniquecombs.Rd
a16b3a5a4d13c705dcab8d1cd1b3347e *man/vcov.gam.Rd
0e045fc94ea00c17e703ae07923f549b *man/vis.gam.Rd
281e73658c726997196727a99a4a1f9e *man/vis.gam.Rd
2c5f6815e609f2cdb56b0067a183f915 *man/ziP.Rd
455f8e0a6cd4218442cfdba368cbb940 *man/ziplss.Rd
becbe3e1f1588f7292a74a97ef07a9ae *po/R-de.po
ae8388103d8b1be39f55f426b205b576 *man/ziplss.Rd
a7c1582252be4e0013e4275ffd3aac4c *po/R-de.po
0bdfcf98961b0d52b60f806dc1dba77e *po/R-en@quot.po
9126ed91030cd1c168d669854cf1f510 *po/R-fr.po
7563cdf47066589a08ba01eacfcf0bcb *po/R-mgcv.pot
ccbf345b8ca9544e9239fa85fff897a1 *po/R-pl.po
d5a0f198090ecbfedaa6549f2918b997 *po/R-po.po
3550a794504bdfd4f75a83de1148bb40 *po/de.po
eb3707a62b0e3d406ddf5c15bc40c673 *po/R-fr.po
c7317bc4fb746b3ce2a9bcdf9d928716 *po/R-ko.po
5e7691372a93b11f3c0efa48ec9dae2f *po/R-mgcv.pot
62fa356ec68d7cc8a9ec1b3915b0db13 *po/R-pl.po
a5335d43184be0f9da9df45cfadc3e33 *po/R-po.po
ccf3140169b68ec7aff4b15e6a97e5db *po/de.po
93f72334356fe6f05a64e567efd35c8e *po/en@quot.po
1a4a267ddcb87bb83f09c291d3e97523 *po/fr.po
813514ea4e046ecb4563eb3ae8aa202a *po/mgcv.pot
bd5ec325242ca6e41056c2f1f7f05bfe *po/pl.po
749ac663240fd6eaa2b725602d47ef2a *po/po.po
fb829b82760779929951d49fe29ed2e5 *po/fr.po
dc1ef92ff4454734c3a24876e299b760 *po/ko.po
5fee1431cf41b342cde9e5eb6dd27cab *po/mgcv.pot
dfd4eec9edc7d1ab6354d47b6e2bd42f *po/pl.po
b56dac4547037ea45e2c8f9bce7aa9ef *po/po.po
03972284b3400cf82cacd5d2dc4b8cb3 *src/Makevars
56d501c682dc6699ff0803f25533e849 *src/coxph.c
114701c0d407f946ac693da55da864da *src/gdi.c
49af97195accb65adc75620183d39a4c *src/general.h
761581e96a73e1bec00a9553356eaaa6 *src/init.c
6dbd109048a3bd18b67db6230c064c21 *src/magic.c
f45aa90d4ce295f0deebc54798dad330 *src/mat.c
02122df2193f86e2a08f68fe5b8ff972 *src/matrix.c
e71c1a1624b431fbab0a4c8f151d2a97 *src/coxph.c
08e156711c686a1f1efe505d63fabef5 *src/gdi.c
2436f9b328e80370ce2203dbf1dd813c *src/general.h
e5bf24371be5ea7f3ffb40060a648803 *src/init.c
9a5d7cb3cf93cbdfc08353fbd20a270e *src/magic.c
a9735df73ae117df1b4c1197f4748389 *src/mat.c
aae0f298e384952bb8b6b923d40520a8 *src/matrix.c
6b781cbd5b9cfee68ad30bb7ce31ef3a *src/matrix.h
7a12ef0cbd8f5312cd67669a36d75ebf *src/mgcv.c
f06b1075027c76e9a7ce483c3d70c6ad *src/mgcv.h
ec2ae157a9e3bedcccc88b053d0a4e0c *src/mgcv.c
b62374abb9910e539a3280d66ac4193f *src/mgcv.h
00f8a024faef17f90ed04f01e736df71 *src/misc.c
08c1706ffeec4277c484435a0644b0e3 *src/mvn.c
90fe2ad1997db56f2293ad16c7110f88 *src/qp.c
cbe54250deb38aa5f88f8b669a4468cd *src/qp.c
cd563899be5b09897d1bf36a7889caa0 *src/qp.h
15ed450da804a9dbd0833459af1f2474 *src/soap.c
b3ff61207cd26308abf386d6a0666320 *src/sparse-smooth.c
75d9bf91f5c2dc536918055b6a00d93f *src/tprs.c
294190980f5a98be73fa9a657f4d0b91 *src/tprs.c
5bd85bf0319a7b7c755cf49c91a7cd94 *src/tprs.h
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ S3method(smooth.construct, mrf.smooth.spec)
S3method(smooth.construct,ps.smooth.spec)
S3method(smooth.construct, re.smooth.spec)
S3method(smooth.construct,so.smooth.spec)
S3method(smooth.construct,sw.smooth.spec)
S3method(smooth.construct,sf.smooth.spec)
S3method(smooth.construct,sos.smooth.spec)
S3method(smooth.construct, tp.smooth.spec)
S3method(smooth.construct, tensor.smooth.spec)
Expand Down
42 changes: 24 additions & 18 deletions R/bam.r
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ bgam.fit <- function (G, mf, chunk.size, gp ,scale ,gamma,method, coef=NULL,etas
weights <- G$w
conv <- FALSE
nobs <- nrow(mf)
nvars <- ncol(G$X)
##nvars <- ncol(G$X)
offset <- G$offset
family <- G$family
G$family <- gaussian() ## needed if REML/ML used
variance <- family$variance
dev.resids <- family$dev.resids
aic <- family$aic
## aic <- family$aic
linkinv <- family$linkinv
mu.eta <- family$mu.eta
if (!is.function(variance) || !is.function(linkinv))
Expand All @@ -211,7 +211,7 @@ bgam.fit <- function (G, mf, chunk.size, gp ,scale ,gamma,method, coef=NULL,etas
mustart <- mukeep
}

coefold <- NULL
##coefold <- NULL
eta <- if (!is.null(etastart))
etastart
else family$linkfun(mustart)
Expand All @@ -220,7 +220,8 @@ bgam.fit <- function (G, mf, chunk.size, gp ,scale ,gamma,method, coef=NULL,etas
if (!(validmu(mu) && valideta(eta)))
stop("cannot find valid starting values: please specify some")
dev <- sum(dev.resids(y, mu, weights))*2 ## just to avoid converging at iter 1
boundary <- conv <- FALSE
##boundary <-
conv <- FALSE

G$coefficients <- rep(0,ncol(G$X))
class(G) <- "gam"
Expand Down Expand Up @@ -506,13 +507,13 @@ bgam.fit2 <- function (G, mf, chunk.size, gp ,scale ,gamma,method, etastart = NU
weights <- G$w
conv <- FALSE
nobs <- nrow(mf)
nvars <- ncol(G$X)
##nvars <- ncol(G$X)
offset <- G$offset
family <- G$family
G$family <- gaussian() ## needed if REML/ML used
variance <- family$variance
dev.resids <- family$dev.resids
aic <- family$aic
##aic <- family$aic
linkinv <- family$linkinv
mu.eta <- family$mu.eta
if (!is.function(variance) || !is.function(linkinv))
Expand All @@ -532,7 +533,7 @@ bgam.fit2 <- function (G, mf, chunk.size, gp ,scale ,gamma,method, etastart = NU
mustart <- mukeep
}

coefold <- NULL
##coefold <- NULL
eta <- if (!is.null(etastart))
etastart
else family$linkfun(mustart)
Expand All @@ -541,7 +542,8 @@ bgam.fit2 <- function (G, mf, chunk.size, gp ,scale ,gamma,method, etastart = NU
if (!(validmu(mu) && valideta(eta)))
stop("cannot find valid starting values: please specify some")
dev <- sum(dev.resids(y, mu, weights))*2 ## just to avoid converging at iter 1
boundary <- conv <- FALSE
##boundary <-
conv <- FALSE

G$n <- nobs
X <- G$X
Expand Down Expand Up @@ -733,7 +735,7 @@ predict.bam <- function(object,newdata,type="link",se.fit=FALSE,terms=NULL,
gc()

if (!is.null(cluster)&&inherits(cluster,"cluster")) {
require(parallel)
## require(parallel)
n.threads <- length(cluster)
} else n.threads <- 1
if (missing(newdata)) n <- nrow(object$model) else n <- nrow(newdata)
Expand Down Expand Up @@ -814,7 +816,7 @@ bam.fit <- function(G,mf,chunk.size,gp,scale,gamma,method,rho=0,

if (n>chunk.size) { ## then use QR accumulation approach
if (!is.null(cl)&&inherits(cl,"cluster")) {
require(parallel)
## require(parallel)
n.threads <- length(cl)
} else n.threads <- 1

Expand Down Expand Up @@ -926,7 +928,7 @@ bam.fit <- function(G,mf,chunk.size,gp,scale,gamma,method,rho=0,
# }

## now consolidate the results from the parallel threads...
R <- res[[1]]$R;f <- res[[1]]$f;dev <- res[[1]]$dev
R <- res[[1]]$R;f <- res[[1]]$f; ## dev <- res[[1]]$dev
y.norm2 <- res[[1]]$y.norm2
for (i in 2:n.threads) {
if (use.chol) {
Expand Down Expand Up @@ -1195,15 +1197,15 @@ bam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
H=NULL,absorb.cons=TRUE,sparse.cons=sparse.cons,select=FALSE,
idLinksBases=TRUE,scale.penalty=control$scalePenalty,
paraPen=paraPen)


## no advantage to "fREML" with no free smooths...
if (((!is.null(G$L)&&ncol(G$L) < 1)||(length(G$sp)==0))&&method=="fREML") method <- "REML"

G$var.summary <- var.summary
G$family <- family
G$terms<-terms;##G$pterms<-pterms
pvars <- all.vars(delete.response(terms))
G$pred.formula <- gp$pred.formula # if (length(pvars)>0) reformulate(pvars) else NULL
G$terms<-terms;
G$pred.formula <- gp$pred.formula

n <- nrow(mf)

Expand All @@ -1227,8 +1229,11 @@ bam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
if (G$m) for (i in 1:G$m) G$min.edf<-G$min.edf+G$smooth[[i]]$null.space.dim

G$formula<-formula
environment(G$formula)<-environment(formula)

## environment(G$formula)<-environment(formula)
environment(G$pterms) <- environment(G$terms) <- environment(G$pred.formula) <-
environment(G$formula) <- .BaseNamespaceEnv


G$conv.tol<-control$mgcv.tol # tolerence for mgcv
G$max.half<-control$mgcv.half # max step halving in bfgs optimization

Expand Down Expand Up @@ -1297,7 +1302,6 @@ bam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
object$family <- family
object$formula<-G$formula

#object$linear.predictors <- NA
if (method=="GCV.Cp") {
if (scale<=0) object$method <- "GCV" else object$method <- "UBRE"
} else {
Expand Down Expand Up @@ -1345,6 +1349,9 @@ bam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
if (length(object$full.sp)==length(object$sp)&&
all.equal(object$sp,object$full.sp)==TRUE) object$full.sp <- NULL
}
environment(object$formula) <- environment(object$pred.formula) <-
environment(object$terms) <- environment(object$pterms) <-
environment(attr(object$model,"terms")) <- .GlobalEnv
object
} ## end of bam

Expand Down Expand Up @@ -1451,7 +1458,6 @@ bam.update <- function(b,data,chunk.size=10000) {
} else if (method=="fREML") { ## fast REML

um <- Sl.Xprep(b$Sl,b$qrx$R)
lambda.0 <- initial.sp(b$qrx$R,b$G$S,b$G$off)
lsp0 <- log(b$sp) ## initial s.p.
log.phi <- log(b$sig2) ## initial or fixed scale
fit <- fast.REML.fit(um$Sl,um$X,b$qrx$f,rho=lsp0,L=b$G$L,rho.0=b$G$lsp0,
Expand Down
Loading

0 comments on commit da43576

Please sign in to comment.