Commit 3e6d87f8 authored by Dirk Eddelbuettel's avatar Dirk Eddelbuettel

Import Upstream version 1.8-18

parent a9b37307
......@@ -5,6 +5,60 @@ Currently deprecated and liable to be removed:
- single penalty tensor product smooths.
- p.type!=0 in summary.gam.
1.8-18
* Tweak to 'newton' to further reduce chance of false convergence at
indefinite point.
* Fix to bam.update to deal with NAs in response.
* 'scat' family now takes a 'min.df' argument which defaults to 3. Could
otherwise occasionally have indefinite LAML problems as df headed towards 2.
* Fix to `gam.fit4' where in rare circumstances the PIRLS iteration could
finish at an indefinite point, spoiling implicit differentiation.
* `gam.check' modified to fix a couple of issues with `gamm' fitted models, and
to warn that interpretability is reduced for such models.
* `qq.gam' default method slight modification to default generation of reference
quantiles. In theory previous method could cause a problem if enough
residuals were exactly equal.
* Fix to `plot.mrf.smooth' to deal with models with by variables.
* `plot.gam' fix to handling of plot limits when using 'trans' (from 1.8-16
'trans' could be applied twice).
* `plot.gam' argument 'rug' now defaults to 'NULL' corresponding to 'rug=TRUE'
if the number of data is <= 10000 and 'rug=FALSE' otherwise.
* bam(...,discrete=TRUE) could fail if NAs in the smooth terms caused data rows
to be dropped which led to parametric term factors having unused levels
(which were then not being dropped). Fixed (in discrete.mf).
* bam(...,discrete=TRUE,nthreads=n) now warns if n>1 and openMP is not
available on the platform being used.
* Sl.addS modified to use C code for some otherwise very slow matrix
subset and addition ops which could become rate limiting for
bam(...,discrete=TRUE).
* Parallel solves in Sl.iftChol can speed up bam(...,discrete=TRUE) with
large numbers of smoothing/variance parameters.
* 'gamm' now warns if called with extended families.
* disasterous 'te' in place of 'ti' typo in ?smooth.terms fixed thanks to
John McKinlay.
* Some `internal' functions exported to facilitate quantile gam methods
in separate package.
* Minor fix in gam.fit5 - 1 by 1 matrix coerced to scalar, to prevent failure
in some circumstances.
1.8-17
* Export gamlss.etamu, gamlss.gH and trind.generator to facilitate user
......
Package: mgcv
Version: 1.8-17
Version: 1.8-18
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
Title: Mixed GAM Computation Vehicle with Automatic 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.
Description: Generalized additive (mixed) models, some of their extensions and
other generalized ridge regression with multiple smoothing
parameter estimation by (REstricted) Marginal Likelihood,
Generalized Cross Validation and similar. 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
......@@ -16,6 +18,6 @@ LazyLoad: yes
ByteCompile: yes
License: GPL (>= 2)
NeedsCompilation: yes
Packaged: 2017-02-06 11:03:57 UTC; sw283
Packaged: 2017-07-26 15:00:29 UTC; sw283
Repository: CRAN
Date/Publication: 2017-02-08 21:30:16
Date/Publication: 2017-07-28 07:28:50 UTC
fdc45fe0bc09d3a9dea994040574ba9d *ChangeLog
1671dbe5a90499d24659b13d04370628 *DESCRIPTION
c05cb7ad112b42926ecd1f4951feabc7 *ChangeLog
e3b750452451e32de9f90ad8953e3b99 *DESCRIPTION
eb723b61539feef013de476e68b5c50a *GPL-2
fe1f2bde9713ba97eeb59d928310f628 *NAMESPACE
1aee82e17a9feb6166dbe107659029c9 *R/bam.r
799f8fc053097ed342b63e40bcc84f08 *NAMESPACE
bf34a6ac68a3beeda70f293f9e925ce0 *R/bam.r
87933a9e2845f871334d96f537ee11e9 *R/coxph.r
97c5e0261e26e0aedd8127f9ed41f817 *R/efam.r
deaf0c6a0e39d42a9bad487772eb5904 *R/fast-REML.r
dbf376ceeec4b343d15daa90fe5a81fb *R/gam.fit3.r
9f73b1e3e9781d8ee26a46c1a2127c73 *R/gam.fit4.r
10c3d4c8e3ed32e4246b745d86cac4fa *R/efam.r
f1aaff86fc60e5dda45a96ee4bc40d78 *R/fast-REML.r
92e35159f4b66e9832ccf2bf1ef07358 *R/gam.fit3.r
b8d3b71cb0958f500b552de56501f295 *R/gam.fit4.r
1b620b840ca67c9759639bd6e53824e3 *R/gam.sim.r
a6b6a5e70c7889370d33876e08396a09 *R/gamlss.r
cceac26b3d01513f8f87eacae91ddae0 *R/gamm.r
c934ba653cb1a904132b3f15a01e41c5 *R/gamm.r
10facb791e4cfd123d183f05660119c6 *R/jagam.r
088976e7d2ee3df696d09b3fcdfdd563 *R/mgcv.r
aaea88d2edfad0cc5c20f8a6761c92f4 *R/mgcv.r
2feca0dc9d354de7bc707c67a5891364 *R/misc.r
03772998ab05887f2eeae10dd6efe983 *R/mvam.r
5d07d6e4f75a64b6d04cda9e23278d70 *R/plots.r
9a4db620ad080f012b56134c1aba10bb *R/smooth.r
9e65a5249f1be974bcfd7a4942f92364 *R/plots.r
a53e43e023f935cfd6c2e2cdb590174e *R/smooth.r
666d7fd36fda68b928993d5388b0d7fc *R/soap.r
76cc875719bf0ef9eab45ea5bfeccda6 *R/sparse.r
e468195a83fab90da8e760c2c3884bd3 *data/columb.polys.rda
40874e3ced720a596750f499ded8a60a *data/columb.rda
e74e6d792e3dc69f7a20c68c16097145 *inst/CITATION
342b1840b6a569b8d8d4a3355a0d2bfa *inst/po/de/LC_MESSAGES/R-mgcv.mo
d0b290e7efd8b4c47a53dcde665a4d42 *inst/po/de/LC_MESSAGES/R-mgcv.mo
fe9d11e3087789da149e3688309df670 *inst/po/de/LC_MESSAGES/mgcv.mo
72ccd181324c1acd4671f69311ed494a *inst/po/en@quot/LC_MESSAGES/R-mgcv.mo
dcb794aad0b69ab80cb6877510c3a925 *inst/po/en@quot/LC_MESSAGES/mgcv.mo
72ffab2a2903e1efa30cc81424bce43d *inst/po/fr/LC_MESSAGES/R-mgcv.mo
78e6bcd08b905ed2adb2ffac48034e06 *inst/po/en@quot/LC_MESSAGES/R-mgcv.mo
2dba1551f3581c06b157a558382686d8 *inst/po/en@quot/LC_MESSAGES/mgcv.mo
1f0edaff3abadad5b6cdc2439ebdeb01 *inst/po/fr/LC_MESSAGES/R-mgcv.mo
418bef2f2c1ed07bff6bbdb6884d2858 *inst/po/fr/LC_MESSAGES/mgcv.mo
fbe9f7d7c30fbcebf97c28bf17c2ef50 *inst/po/ko/LC_MESSAGES/R-mgcv.mo
b368d120586b31091055e8c177334087 *inst/po/ko/LC_MESSAGES/R-mgcv.mo
e6196a86ad3a8e42df84242a861d362a *inst/po/ko/LC_MESSAGES/mgcv.mo
5c8c8783edc20ee9196bb17bb86c420d *inst/po/pl/LC_MESSAGES/R-mgcv.mo
a22ce06c4ec0dbf1f594a4796e5fa4ca *inst/po/pl/LC_MESSAGES/R-mgcv.mo
07e822258166c032ff9f1a4e96025841 *inst/po/pl/LC_MESSAGES/mgcv.mo
c574fe1ca9d55a9818d308906f16d16e *man/Beta.Rd
5bf12ddc0dab9daae72271b96a15c539 *man/Predict.matrix.Rd
c45c0f78f753461b33a295883461e732 *man/Predict.matrix.cr.smooth.Rd
d0fa291cbbcef359c61e426f6ba38fbb *man/Predict.matrix.soap.film.Rd
f12468625253dd3603907de233762fd6 *man/Rrank.Rd
d3e09165c6ca581db78d820a3c39329c *man/Tweedie.Rd
fd0cfd64be579f9fbecdbb7f2b8ec1eb *man/Sl.initial.repara.Rd
991a7e08485cdc1f3ffee00439f7e907 *man/Sl.repara.Rd
60670020425f8749b81a8d8c3f168880 *man/Sl.setup.Rd
2f36d473053f8fa6cd85731bf5be3f05 *man/Tweedie.Rd
c93cf5b2e0def2e36cced3ee68912958 *man/anova.gam.Rd
871531b320262b21eab35467f334cc6a *man/bam.Rd
8c95ed4822108db4e8bc59d8eac9e77c *man/bam.update.Rd
7a2e5972d8c7273d1eb1857747f9a353 *man/bam.Rd
ab5e37c3bf8803de63b63c3bdc5909cd *man/bam.update.Rd
cf5f1ee0aab639c7c4b9b357434f15b2 *man/bandchol.Rd
745cbf31eb14fc1c5916fc634c74d998 *man/bug.reports.mgcv.Rd
530b8b4bacffa9353561f19ecfccfe19 *man/cSplineDes.Rd
a72647229fd92763636941e61597995d *man/choose.k.Rd
c03748964ef606621418e428ae49b103 *man/columb.Rd
9906a83ce29a3b17044bc2a3c9940cee *man/concurvity.Rd
c355ae144e02759a86da79dcfca1a6c1 *man/coxph.Rd
5f4e410d9dbc40e99b723a5caa1d9e01 *man/coxpht.Rd
01cdf8e234585747f6ca28cb62607451 *man/coxph.Rd
a2350cf350407c4cfe5b0119265e63b3 *man/coxpht.Rd
b78faf4ab9477183e7a3fbbd8801afeb *man/dDeta.Rd
0a6d4b3858cbb69a5d375ecd09282256 *man/exclude.too.far.Rd
069e7d174bb0d35bf30675e74a47dfd3 *man/extract.lme.cov.Rd
0423770bd423bf3de94a53e7c707678c *man/family.mgcv.Rd
44ad0563add1c560027d502ce41483f5 *man/fix.family.link.Rd
4aa4dd3ee0dd759ccb6413dfc34b0d9e *man/family.mgcv.Rd
42534ae5dffc0a7f6806270c901cbdd4 *man/fix.family.link.Rd
4d4eea9ad2b78e765a96b2a0065725c1 *man/fixDependence.Rd
e75719779e18c723ee1fd17e44e7901b *man/formXtViX.Rd
88888e966394c9f9792d9537341d053c *man/formula.gam.Rd
4da4d585b329769eb44f0c7a6e7dd554 *man/fs.test.Rd
6f405acde2d7b6f464cf45f5395113ba *man/full.score.Rd
0c075e9e58df199d59e77d94b712fde6 *man/gam.Rd
adaf0bd8e82d9472823cf3f3fa05e111 *man/gam.check.Rd
f666cbb62f839c5bd517d6a8df9b083f *man/gam.Rd
83e5f606088b3f4cfb4c7af764a0bd9f *man/gam.check.Rd
8931cd75ddec14d91ec94dec6ba69362 *man/gam.control.Rd
44db24b66ce63bc16d2c8bc3f5b42ac5 *man/gam.convergence.Rd
1cf5145859af2263f4e3459f40e1ab23 *man/gam.fit.Rd
4728be401da6eceb8b0c257377dc5d01 *man/gam.fit3.Rd
ec46b6f8190bac4b2d9eaee991c3e0a3 *man/gam.fit5.post.proc.Rd
8ba3991b5932b0775b452d20c9ff4d54 *man/gam.models.Rd
c15f647511f54d05d9fc21760cf61d91 *man/gam.outer.Rd
f50059fd42d0da09271a5768811a0bc4 *man/gam.reparam.Rd
c17814cea1b11e5ca374e72d6e1cbd98 *man/gam.scale.Rd
d828d474a4b069f9b9e3ebe5f05b70ec *man/gam.selection.Rd
310397e938dae8c6b818d2093e4aa354 *man/gam.side.Rd
......@@ -75,59 +81,61 @@ eb8648cc6b3c9374b899abd2f2b12f7b *man/gam2objective.Rd
a2593990d6a87f7b783d0435062dec02 *man/gamSim.Rd
e5d2541f32dab56972f58b0773eba50c *man/gamlss.etamu.Rd
c7f140d128d1d1d76909499900faf49e *man/gamlss.gH.Rd
351009f7345aaff40f3377e77f4ce7ad *man/gamm.Rd
ec2d1b2aa87cc3f8424e07b6dc0340d5 *man/gaulss.Rd
84d8e9331f7febe62c3b6055896357e6 *man/gamm.Rd
222535dd19201cfd929efd3305b13f43 *man/gaulss.Rd
398a5c12285401c1d37a8edb58780bc3 *man/get.var.Rd
faf325db054dce698286f87e09ddc202 *man/gevlss.Rd
a4ec15dc1e9e6a38c0738534faee0311 *man/gevlss.Rd
39b47f30a7ea45382d62ca1753d876a8 *man/identifiability.Rd
4f96476abbf9692f52030d3859580a31 *man/in.out.Rd
6c33026ebb458483d34a04548c05d664 *man/inSide.Rd
2f222eeeb3d7bc42f93869bf8c2af58a *man/influence.gam.Rd
39b9de9dbac7d9dc5c849e1a37def675 *man/initial.sp.Rd
2a37ae59a9f9f5a0a58af45947eca524 *man/interpret.gam.Rd
4e8db08a1b17e9cf5a0d05363eb0fc08 *man/interpret.gam.Rd
29f94d99b9a3decd4d71618eb839a7f7 *man/jagam.Rd
87d942b17bee05bb662270b894b183e6 *man/ldTweedie.Rd
58e73ac26b93dc9d28bb27c8699e12cf *man/linear.functional.terms.Rd
c7073b72336b0385080f2f4a40694416 *man/ldetS.Rd
f83af7cd9188210650479600b24ce654 *man/linear.functional.terms.Rd
93035193b0faa32700e1421ce8c1e9f6 *man/logLik.gam.Rd
b1c95a20afd6eb0825c00b46b8c3cbfa *man/ls.size.Rd
9a2c8f14c7a56eca69f4a59bef27a9bf *man/magic.Rd
5169af4be5fccf9fa79b6de08e9ea035 *man/magic.post.proc.Rd
7f1032c61d424980f4473ac9717dc797 *man/mgcv-FAQ.Rd
ba14a20f6fa77f066bac7cdfe88b8fff *man/mgcv-package.Rd
6db1ae82808e56bd44c04066e2ec09aa *man/mgcv-parallel.Rd
df702cea24d0f92044a973b66a57e21f *man/missing.data.Rd
05517492e962c5271d86135beee59b8a *man/mgcv-parallel.Rd
1f085fc302c7c0b10a44d59c439c3ec5 *man/mini.roots.Rd
8a89166312f624d58d79c1f86ae43e30 *man/missing.data.Rd
00ccf213c31910cd14f1df65a300eb33 *man/model.matrix.gam.Rd
2f2fdc722c5e9e58664da9378451cd4a *man/mono.con.Rd
d33914a328f645af13f5a42914ca0f35 *man/mroot.Rd
f624f3afcf4e2192e8f724d45257d983 *man/multinom.Rd
8fa6cf27db7192bbad6a2d41d2780937 *man/mvn.Rd
1064099913e539a75bf763c764bc72a1 *man/negbin.Rd
39b4a5ffe69ca648601d949a25ff2fd9 *man/multinom.Rd
c473b80af466ebd19ef6ad6e253df573 *man/mvn.Rd
94dc8dd5296a79b55141397e09178cd0 *man/negbin.Rd
8a6a1926188511235f1e7406120c791e *man/new.name.Rd
00e39f302ab5efbe3b14265fffc16c18 *man/notExp.Rd
7a3280b766cab8424a12d6a8b1d5748e *man/notExp2.Rd
e8ecb5f0b5214ef0bae54a645a4d12d6 *man/null.space.dimension.Rd
06910824bd8944cedb790e5787bddff8 *man/ocat.Rd
e3eb55ba7cfe35ff645031200e491d05 *man/ocat.Rd
145a5adf3f90b6f2a9a109a97d9fd8fe *man/one.se.rule.Rd
9f49b00733e6117337f619cebfdfcf00 *man/pcls.Rd
ee9352ba4c531a8def16deddcab9a9fd *man/pdIdnot.Rd
8bc429d92aa9f58c4c43f2852e1f8123 *man/pdTens.Rd
1721f1b266d9e14827e8226e2cb74a81 *man/pen.edf.Rd
931c3aefb8b5e42aa230cfedd281bed1 *man/place.knots.Rd
b903ebcf31703db156e033fdfa527d73 *man/plot.gam.Rd
90e56a85798cd878b8a673b5b60aab47 *man/plot.gam.Rd
c27a6b886929b1dc83bf4b90cae848f9 *man/polys.plot.Rd
1a9d83c9fc67e5f0fc85d66d3112f4ef *man/predict.bam.Rd
93f41380f769dff6a21394d80508c565 *man/predict.gam.Rd
6ea139c7a291c7dbf897a3f39afc97c0 *man/predict.gam.Rd
cf14ce6cf8e4147f0f5c6e5b93b2af73 *man/print.gam.Rd
6d0ce4e574fabceffdbedd46c91364cb *man/qq.gam.Rd
22b7dcbc8ff4096365fa98ce56b957c9 *man/rTweedie.Rd
fc1985e7dd5222182c4a8a939963b965 *man/random.effects.Rd
1a533ae9f698437faa076021194c9b1d *man/random.effects.Rd
c523210ae95cb9aaa0aaa1c37da1a4c5 *man/residuals.gam.Rd
3c747a8066bcc28ae706ccf74f903d3e *man/rig.Rd
9f6f46f5c5da080bc82f9aa4685d364a *man/rmvn.Rd
c4be33830dfeb9e0dc766f8e5498931d *man/s.Rd
d515e51ec98d73af6166f7b31aeaba9b *man/scat.Rd
530193bab103c1337dc356253cbaad6e *man/scat.Rd
898e7cc2def2ee234475e68d0b904b29 *man/sdiag.Rd
8e968226c2b65ee89c8de2fd9869b086 *man/single.index.Rd
d54f4042e212fca7704cf8428bdaea38 *man/single.index.Rd
6f03e337d54221bc167d531e25af1eea *man/slanczos.Rd
8020154bd5c709d11f0e7cf043df886d *man/smooth.construct.Rd
4a689eba97e4fed138dccb8cad13205e *man/smooth.construct.ad.smooth.spec.Rd
......@@ -139,12 +147,12 @@ db75c958cbfb561914a3291ab58b9786 *man/smooth.construct.fs.smooth.spec.Rd
4aaa84b520992fbc32b0c37f7f63c1dd *man/smooth.construct.mrf.smooth.spec.Rd
2523b6cefa306210c00f3477853b7f07 *man/smooth.construct.ps.smooth.spec.Rd
b45d8e71bda4ceca8203dffea577e441 *man/smooth.construct.re.smooth.spec.Rd
0607caa694345cef339bc2178674923c *man/smooth.construct.so.smooth.spec.Rd
bf5c458054c6277d0d474aaa25d98f12 *man/smooth.construct.so.smooth.spec.Rd
0bfe981f2c3e6ea5b8d5372076ccde53 *man/smooth.construct.sos.smooth.spec.Rd
3cb4e59f915c8d64b90754eaeeb5a86f *man/smooth.construct.t2.smooth.spec.Rd
8672633a1fad8df3cb1f53d7fa883620 *man/smooth.construct.tensor.smooth.spec.Rd
a088e69cf148d07a78ce95a69759c95c *man/smooth.construct.tp.smooth.spec.Rd
d4083ff900aa69fa07610e0af2a2987b *man/smooth.terms.Rd
ae5e27524e37d57505754639455f18a5 *man/smooth.terms.Rd
ca676e32c30ddaedbce9f706327cc55b *man/smooth2random.Rd
844f9653d74441293d05a24dd3e2876a *man/smoothCon.Rd
b55a396da77559dac553613146633f97 *man/sp.vcov.Rd
......@@ -154,42 +162,50 @@ f0791d830687d6155efb8a73db787401 *man/summary.gam.Rd
a0b0988dba55cca5b4b970e035e3c749 *man/t2.Rd
a27690f33b9a7bd56d9c1779c64896cc *man/te.Rd
6eebb6ef90374ee09453d6da6449ed79 *man/tensor.prod.model.matrix.Rd
a6feff25ec8241bf5afb3d9fe219d26d *man/totalPenaltySpace.Rd
f22f1cee0ff2b70628846d1d0f8e9a66 *man/trichol.Rd
87e6b4437d00fab4fc814f4cefa3795c *man/trind.generator.Rd
96c48dd705710f639d76a0d0cc3fb128 *man/uniquecombs.Rd
a16b3a5a4d13c705dcab8d1cd1b3347e *man/vcov.gam.Rd
281e73658c726997196727a99a4a1f9e *man/vis.gam.Rd
07a73758156dfa580c6e92edd34b0654 *man/ziP.Rd
8bc98d4cb86d851ea0970d68799522cb *man/ziplss.Rd
f32c7932ef429aa3113007140da82221 *po/R-de.po
296e9f3378173f9669b529b91b8f6fbf *man/ziP.Rd
14d41deaaee802a9e0a4f58cc9cc862d *man/ziplss.Rd
3c667c05c82f8b9823875c8574bd599a *po/R-de.po
0bdfcf98961b0d52b60f806dc1dba77e *po/R-en@quot.po
18713570046eecabea9478b9b864a2cf *po/R-fr.po
d24a793282e6f43c9b67235e46102199 *po/R-ko.po
753bc70ea9b8cb7c06f658a1eb81ce36 *po/R-mgcv.pot
1bb61f6df62fc1787864f66933757701 *po/R-pl.po
56d12b1ebab87e8b1d44805d2228e785 *po/R-fr.po
32b67aab412c1ca8bd3dbbda60db15e6 *po/R-ko.po
315224c6239b535d101b19149740375b *po/R-mgcv.pot
9e941392e6ef12a9deb9e696db2d2523 *po/R-pl.po
8c33d89a914170dbc9f7c5fe598d2135 *po/de.po
93f72334356fe6f05a64e567efd35c8e *po/en@quot.po
b3dfaf74ca2d76ca26eec986a14f5584 *po/fr.po
9116fc041ab458e49b3e498f8c0ac0d9 *po/ko.po
cd15f571b582fdd31e597083a5fe66ff *po/mgcv.pot
44b10768e6a0ef4e04c1e9859c882981 *po/mgcv.pot
ed7cb61912e4990cb0076d4cdcf11da8 *po/pl.po
03972284b3400cf82cacd5d2dc4b8cb3 *src/Makevars
342aa30c8f6f1e99ffa2576a6f29d7ce *src/coxph.c
0d723ffa162b4cb0c2c0fa958ccb4edd *src/discrete.c
dba99f7d7cc412dd9255f6307c8c7fa7 *src/gdi.c
2436f9b328e80370ce2203dbf1dd813c *src/general.h
acf1a2cff05d68856f2b6acee1e63cf7 *src/init.c
71a592d681b3de5e77c9e9dd4117efde *src/init.c
a9151b5236852eef9e6947590bfcf88a *src/magic.c
16b3a72d8bf608026f45de356cf37e65 *src/mat.c
654ff83187dc0f7ef4e085f3348f70d2 *src/mat.c
0545dabf3524a110d616ea5e6373295d *src/matrix.c
6b781cbd5b9cfee68ad30bb7ce31ef3a *src/matrix.h
48cde0e19d5dd54b131ba66c777c0ec2 *src/mgcv.c
473bc0f430ec18b53d4649c7276c2962 *src/mgcv.h
547f557167fca7b219a55d0535dea74a *src/mgcv.h
97e3717e95a70b1470b4c3071e144d17 *src/misc.c
465b8790ca2dfb6e8c5635cacabf5460 *src/mvn.c
8f480dc455f9ff011c3e8f059efec2c5 *src/qp.c
cd563899be5b09897d1bf36a7889caa0 *src/qp.h
d5673b88f6f3d85c62a1337f49abba24 *src/soap.c
ce727da695456c5c7118b51751a7054d *src/sparse-smooth.c
4a90217ef1d223412a248c24c29ba021 *src/sparse-smooth.c
fe0444bece322bc229e46b3d1c150779 *src/tprs.c
5bd85bf0319a7b7c755cf49c91a7cd94 *src/tprs.h
38e593a85a6fd0bb4fbed836f3361406 *tests/bam.R
71d55841bbcd1067f58471cf6bb4b27a *tests/coxpht.R
fefd6fe58a089c4692652bc5c0bcc65c *tests/gam.R
fa2508c443bdc759a734df0d00ed735e *tests/mgcv-parallel.R
9c1a01e6ea9ce8855f5489bc67762ecb *tests/missing.data.R
501f5e62e0f51516b8cf61b6aff5901b *tests/single.index.R
d43c0ae1f13fe0a691f8fec99c135337 *tests/smooth.construct.so.smooth.spec.R
useDynLib(mgcv, .registration = TRUE, .fixes = "C_")
export(anova.gam, bam, bam.update,bandchol, betar, cox.ph,concurvity,
cSplineDes,
cSplineDes,dDeta,
exclude.too.far,extract.lme.cov, extract.lme.cov2,
formXtViX, full.score, formula.gam,fixDependence,fix.family.link,
fix.family.var, fix.family.ls, fix.family.qf,fix.family.rd,
fs.test,fs.boundary,gam, gam2derivative,
gam2objective,
gamm, gam.check, gam.control,gam.fit3,
gam.fit,
gam.fit,gam.fit5.post.proc,
gamlss.etamu,gamlss.gH,
gam.outer,gam.vcomp, gamSim ,
gam.outer,gam.reparam, gam.vcomp, gamSim ,
gaulss,gam.side,get.var,gevlss,
influence.gam,
in.out,inSide,interpret.gam,initial.sp,
jagam,
jagam,ldetS,
ldTweedie,
logLik.gam,ls.size,
magic, magic.post.proc, model.matrix.gam,
magic, magic.post.proc, model.matrix.gam,mini.roots,
mono.con, mroot, multinom, mvn, nb, negbin, new.name,
notExp,notExp2,notLog,notLog2,pcls,null.space.dimension,
ocat,
......@@ -45,7 +45,7 @@ export(anova.gam, bam, bam.update,bandchol, betar, cox.ph,concurvity,
qq.gam,
residuals.gam,rig,rTweedie,rmvn,
Rrank,s,scat,sdiag,"sdiag<-",
sim2jam,
sim2jam,Sl.initial.repara,Sl.repara,Sl.setup,
slanczos,smooth2random,
smoothCon,smooth.construct,smooth.construct2,
smooth.construct.bs.smooth.spec,
......@@ -70,7 +70,7 @@ export(anova.gam, bam, bam.update,bandchol, betar, cox.ph,concurvity,
summary.gam,sp.vcov,
spasm.construct,spasm.sp,spasm.smooth,
t2,te,ti,tensor.prod.model.matrix,tensor.prod.penalties,
trichol,trind.generator,
totalPenaltySpace,trichol,trind.generator,
Tweedie,tw,uniquecombs, vcov.gam, vis.gam, ziP, ziplss)
importFrom(grDevices,cm.colors,dev.interactive,devAskNewPage,gray,grey,heat.colors,terrain.colors,topo.colors)
......
......@@ -184,9 +184,10 @@ check.term <- function(term,rec) {
} else return(0) ## no match
} ## check.term
discrete.mf <- function(gp,mf,pmf,m=NULL,full=TRUE) {
discrete.mf <- function(gp,mf,names.pmf,m=NULL,full=TRUE) {
## discretize the covariates for the terms specified in smooth.spec
## id not allowed. pmf is a model frame for just the
## id not allowed. names.pmf gives the names of the parametric part
## of mf, and is used to create a model frame for just the
## parametric terms --- mini.mf is applied to this.
## if full is FALSE then parametric and response terms are ignored
## and what is returned is a list where columns can be of
......@@ -282,8 +283,17 @@ discrete.mf <- function(gp,mf,pmf,m=NULL,full=TRUE) {
## padding is necessary if gam.setup is to be used for setup
if (full) {
maxr <- max(nr)
pmf0 <- mini.mf(pmf,maxr) ## deal with parametric components
maxr <- max(nr)
## If NA's caused rows to be dropped in mf, then they should
## also be dropped in pmf, otherwise we can end up with factors
## with more levels than unique observations, for example.
## The next couple of lines achieve this.
## find indices of terms in mf but not pmf...
di <- sort(which(!names(mf) %in% names.pmf),decreasing=TRUE)
## create copy of mf with only pmf variables...
mfp <- mf; for (i in di) mfp[[i]] <- NULL
#pmf0 <- mini.mf(pmf,maxr) ## deal with parametric components
pmf0 <- mini.mf(mfp,maxr) ## deal with parametric components
if (nrow(pmf0)>maxr) maxr <- nrow(pmf0)
mf0 <- c(mf0,pmf0) ## add parametric terms to end of mf0
......@@ -1450,7 +1460,7 @@ predict.bamd <- function(object,newdata,type="link",se.fit=FALSE,terms=NULL,excl
## now discretize covariates...
if (convert2mf) newdata <- model.frame(object$dinfo$gp$fake.formula[-2],newdata)
dk <- discrete.mf(object$dinfo$gp,mf=newdata,pmf=NULL,full=FALSE)
dk <- discrete.mf(object$dinfo$gp,mf=newdata,names.pmf=NULL,full=FALSE)
Xd <- list() ### list of discrete model matrices...
if (object$nsdf>0) {
......@@ -1645,6 +1655,7 @@ bam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
warning("discretization only available with fREML")
} else {
if (!is.null(cluster)) warning("discrete method does not use parallel cluster - use nthreads instead")
if (nthreads>1 && !mgcv.omp()) warning("openMP not available: single threaded computation only")
}
}
if (method%in%c("fREML")&&!is.null(min.sp)) {
......@@ -1728,7 +1739,7 @@ bam <- function(formula,family=gaussian(),data=list(),weights=NULL,subset=NULL,n
## and indices giving the discretized value for each element of model frame.
## 'discrete' can be null, or contain a discretization size, or
## a discretization size per smooth term.
dk <- discrete.mf(gp,mf,pmf,m=discrete)
dk <- discrete.mf(gp,mf,names(pmf),m=discrete)
mf0 <- dk$mf ## padded discretized model frame
sparse.cons <- 0 ## default constraints required for tensor terms
......@@ -2050,9 +2061,10 @@ bam.update <- function(b,data,chunk.size=10000) {
stop("Model can not be updated")
}
gp<-interpret.gam(b$formula) # interpret the formula
X <- predict(b,newdata=data,type="lpmatrix",na.action=b$NA.action) ## extra part of model matrix
rownames(X) <- NULL
## next 2 lines problematic if there are missings in the response, so now constructed from mf below...
## X <- predict(b,newdata=data,type="lpmatrix",na.action=b$NA.action) ## extra part of model matrix
## rownames(X) <- NULL
cnames <- names(b$coefficients)
AR.start <- NULL ## keep R checks happy
......@@ -2074,7 +2086,10 @@ bam.update <- function(b,data,chunk.size=10000) {
mf <- model.frame(gp$fake.formula,data,xlev=b$xlev,na.action=b$NA.action)
w <- rep(1,nrow(mf))
}
X <- predict(b,newdata=mf,type="lpmatrix",na.action=b$NA.action) ## extra part of model matrix
rownames(X) <- NULL
b$model <- rbind(b$model,mf) ## complete model frame --- old + new
## get response and offset...
......@@ -2157,7 +2172,7 @@ bam.update <- function(b,data,chunk.size=10000) {
object <- list(coefficients=res$beta,edf=res$edf,edf1=res$edf1,edf2=res$edf2,##F=res$F,
gcv.ubre=fit$reml,hat=res$hat,outer.info=list(iter=fit$iter,
message=fit$conv),optimizer="fast-REML",rank=ncol(um$X),
Ve=NULL,Vp=res$V,Vc=res$Vc,db.drho=fit$d1b,scale.estimated = scale<=0)
Ve=res$Ve,Vp=res$Vp,Vc=res$Vc,db.drho=fit$d1b,scale.estimated = scale<=0)
if (scale<=0) { ## get sp's and scale estimate
nsp <- length(fit$rho)
object$sig2 <- object$scale <- exp(fit$rho[nsp])
......
......@@ -1190,7 +1190,7 @@ betar <- function (theta = NULL, link = "logit",eps=.Machine$double.eps*100) {
## scaled t (Natalya Pya) ...
scat <- function (theta = NULL, link = "identity") {
scat <- function (theta = NULL, link = "identity",min.df = 3) {
## Extended family object for scaled t distribution
## length(theta)=2; log theta supplied.
## Written by Natalya Pya.
......@@ -1211,11 +1211,14 @@ scat <- function (theta = NULL, link = "identity") {
## Theta <- NULL;
n.theta <- 2
if (!is.null(theta)&&sum(theta==0)==0) {
if (abs(theta[1]<2)) stop("scaled t df must be >2")
if (abs(theta[1]<=min.df)) {
min.df <- 0.9*abs(theta[1])
warning("Supplied df below min.df. min.df reset")
}
if (sum(theta<0)) {
iniTheta <- c(log(abs(theta[1])-2),log(abs(theta[2]))) ## initial theta supplied
iniTheta <- c(log(abs(theta[1])-min.df),log(abs(theta[2]))) ## initial theta supplied
} else { ## fixed theta supplied
iniTheta <- c(log(theta[1]-2),log(theta[2]))
iniTheta <- c(log(theta[1]-min.df),log(theta[2]))
n.theta <- 0 ## no thetas to estimate
}
} else iniTheta <- c(-2,-1) ## inital log theta value
......@@ -1224,15 +1227,17 @@ scat <- function (theta = NULL, link = "identity") {
assign(".Theta", iniTheta, envir = env)
getTheta <- function(trans=FALSE) {
## trans transforms to the original scale...
th <- get(".Theta")
if (trans) { th <- exp(th); th[1] <- th[1] + 2 }
th <- get(".Theta");min.df <- get(".min.df")
if (trans) { th <- exp(th); th[1] <- th[1] + min.df }
th
}
putTheta <- function(theta) assign(".Theta", theta,envir=environment(sys.function()))
assign(".min.df", min.df, envir = env)
variance <- function(mu) {
th <- get(".Theta")
nu <- exp(th[1])+2; sig <- exp(th[2])
min.df <- get(".min.df")
nu <- exp(th[1])+min.df; sig <- exp(th[2])
sig^2*nu/(nu-2)
}
......@@ -1240,15 +1245,17 @@ scat <- function (theta = NULL, link = "identity") {
dev.resids <- function(y, mu, wt,theta=NULL) {
if (is.null(theta)) theta <- get(".Theta")
nu <- exp(theta[1])+2; sig <- exp(theta[2])
min.df <- get(".min.df")
nu <- exp(theta[1])+min.df; sig <- exp(theta[2])
wt * (nu + 1)*log1p((1/nu)*((y-mu)/sig)^2)
}
Dd <- function(y, mu, theta, wt, level=0) {
## derivatives of the deviance...
## ltheta <- theta
nu <- exp(theta[1])+2; sig <- exp(theta[2])
nu1 <- nu + 1; ym <- y - mu; nu2 <- nu - 2;
min.df <- get(".min.df")
nu <- exp(theta[1])+min.df; sig <- exp(theta[2])
nu1 <- nu + 1; ym <- y - mu; nu2 <- nu - min.df;
a <- 1 + (ym/sig)^2/nu
oo <- list()
## get the quantities needed for IRLS.
......@@ -1315,8 +1322,9 @@ scat <- function (theta = NULL, link = "identity") {
aic <- function(y, mu, theta=NULL, wt, dev) {
min.df <- get(".min.df")
if (is.null(theta)) theta <- get(".Theta")
nu <- exp(theta[1])+2; sig <- exp(theta[2])
nu <- exp(theta[1])+min.df; sig <- exp(theta[2])
term <- -lgamma((nu+1)/2)+ lgamma(nu/2) + log(sig*(pi*nu)^.5) +
(nu+1)*log1p(((y-mu)/sig)^2/nu)/2 ## `-'log likelihood for each observation
2 * sum(term * wt)
......@@ -1324,7 +1332,9 @@ scat <- function (theta = NULL, link = "identity") {
ls <- function(y,w,n,theta,scale) {
## the log saturated likelihood function.
nu <- exp(theta[1])+2; sig <- exp(theta[2]); nu2 <- nu-2;
## (Note these are correct but do not correspond to NP notes)
min.df <- get(".min.df")
nu <- exp(theta[1])+min.df; sig <- exp(theta[2]); nu2 <- nu-min.df;
nu2nu <- nu2/nu; nu12 <- (nu+1)/2
term <- lgamma(nu12) - lgamma(nu/2) - log(sig*(pi*nu)^.5)
ls <- sum(term*w)
......@@ -1358,20 +1368,22 @@ scat <- function (theta = NULL, link = "identity") {
n <- rep(1, nobs)
mustart <- y + (y == 0)*.1
})
postproc <- expression({
object$family$family <-
paste("Scaled t(",paste(round(object$family$getTheta(TRUE),3),collapse=","),")",sep="")
})
rd <- function(mu,wt,scale) {
## simulate data given fitted latent variable in mu
theta <- get(".Theta")
nu <- exp(theta[1])+2; sig <- exp(theta[2])
theta <- get(".Theta");min.df <- get(".min.df")
nu <- exp(theta[1])+min.df; sig <- exp(theta[2])
n <- length(mu)
stats::rt(n=n,df=nu)*sig + mu
}
environment(dev.resids) <- environment(aic) <- environment(getTheta) <-
environment(rd)<- environment(variance) <- environment(putTheta) <- env
environment(dev.resids) <- environment(aic) <- environment(getTheta) <- environment(Dd) <-
environment(ls) <- environment(rd)<- environment(variance) <- environment(putTheta) <- env
structure(list(family = "scaled t", link = linktemp, linkfun = stats$linkfun,
linkinv = stats$linkinv, dev.resids = dev.resids,Dd=Dd,variance=variance,postproc=postproc,
......
......@@ -442,10 +442,34 @@ ldetS <- function(Sl,rho,fixed,np,root=FALSE,repara=TRUE,nt=1) {
} ## end ldetS
Sl.addS <- function(Sl,A,rho) {
## Routine to add total penalty to matrix A. Sl is smooth penalty
## list from Sl.setup, so initial reparameterizations have taken place,
## and should have already been applied to A using Sl.initial.repara
k <- 1
A <- A*1 ## force a copy to be made so that A not modified in calling env!!
for (b in 1:length(Sl)) {
ind <- (Sl[[b]]$start:Sl[[b]]$stop)[Sl[[b]]$ind]
if (length(Sl[[b]]$S)==1) { ## singleton
B <- exp(rho[k]);diag <- -1
er <- .Call(C_mgcv_madi,A,B,ind,diag)
## diag(A)[ind] <- diag(A)[ind] + exp(rho[k]) ## penalty is identity times sp
k <- k + 1
} else {
for (j in 1:length(Sl[[b]]$S)) {
B <- exp(rho[k]) * Sl[[b]]$S[[j]]; diag <- 0
.Call(C_mgcv_madi,A,B,ind,diag)
## A[ind,ind] <- A[ind,ind] + exp(rho[k]) * Sl[[b]]$S[[j]]
k <- k + 1
}
}
}
A
} ## Sl.addS
Sl.addS0 <- function(Sl,A,rho) {
## Routine to add total penalty to matrix A. Sl is smooth penalty
## list from Sl.setup, so initial reparameterizations have taken place,
## and should have already been applied to A using Sl.initial.repara
k <- 1
for (b in 1:length(Sl)) {
......@@ -461,7 +485,7 @@ Sl.addS <- function(Sl,A,rho) {
}
}
A
} ## Sl.addS
} ## Sl.addS0
Sl.repara <- function(rp,X,inverse=FALSE,both.sides=TRUE) {
## Apply re-parameterization from ldetS to X, blockwise.
......@@ -710,7 +734,7 @@ Sl.ift <- function(Sl,R,X,y,beta,piv,rp) {
list(bSb=sum(beta*Sb),bSb1=bSb1,bSb2=bSb2,d1b=db,rss =sum(rsd^2),rss1=rss1,rss2=rss2)
} ## end Sl.ift
Sl.iftChol <- function(Sl,XX,R,d,beta,piv) {
Sl.iftChol <- function(Sl,XX,R,d,beta,piv,nt=1) {
## function to obtain derviatives of \hat \beta by implicit differentiation
## and to use these directly to evaluate derivs of b'Sb and the RSS.
## piv contains the pivots from the chol that produced R.
......@@ -720,29 +744,48 @@ Sl.iftChol <- function(Sl,XX,R,d,beta,piv) {
nd <- length(Skb)
np <- length(beta)
db <- matrix(0,np,nd)
rss1 <- bSb1 <- rep(0,nd)
rss1 <- bSb1 <- rep(0,nd)
## alternative all in one code - matches loop results, but
## timing close to identical - modified for parallel exec
D <- matrix(unlist(Skb),nrow(R),nd)
bSb1 <- colSums(beta*D)
#D <- D[piv,]/d[piv]
D1 <- .Call(C_mgcv_Rpforwardsolve,R,D[piv,]/d[piv],nt) ## note R transposed internally unlike forwardsolve
db[piv,] <- -.Call(C_mgcv_Rpbacksolve,R,D1,nt)/d[piv]
#db[piv,] <- -backsolve(R,forwardsolve(t(R),D))/d[piv]
## original serial - a bit slow with very large numbers of smoothing
## parameters....
#Rt <- t(R) ## essential to do this first, or t(R) dominates cost in loop
#for (i in 1:nd) { ## compute the first derivatives
# db[piv,i] <- -backsolve(R,forwardsolve(Rt,Skb[[i]][piv]/d[piv]))/d[piv] ## d beta/ d rho_i
# bSb1[i] <- sum(beta*Skb[[i]]) ## d b'Sb / d_rho_i
#}
for (i in 1:nd) { ## compute the first derivatives
db[piv,i] <- -backsolve(R,forwardsolve(t(R),Skb[[i]][piv]/d[piv]))/d[piv] ## d beta/ d rho_i
bSb1[i] <- sum(beta*Skb[[i]]) ## d b'Sb / d_rho_i
}
XX.db <- XX%*%db
## XX.db <- XX%*%db
XX.db <- .Call(C_mgcv_pmmult2,XX,db,0,0,nt)
#XX.db[piv,] <- d[piv]*(t(R)%*%(R%*%(d[piv]*db[piv,]))) ## X'Xdb
S.db <- Sl.mult(Sl,db,k=0)
##Sk.db <- Sl.termMult(Sl,db,full=TRUE) ## Sk.db[[j]][,k] is S_j d beta / d rho_k
rss2 <- bSb2 <- matrix(0,nd,nd)
for (k in 1:nd) { ## second derivative loop
for (j in k:nd) {
rss2[j,k] <- rss2[k,j] <- 2 * sum(db[,j]*XX.db[,k])
bSb2[j,k] <- bSb2[k,j] <- (k==j)*sum(beta*Skb[[k]]) + 2*(sum(db[,k]*(Skb[[j]]+S.db[,j])) +
sum(db[,j]*Skb[[k]]))
}
}
## following loop very slow if large numbers of smoothing parameters...
#rss2 <- bSb2 <- matrix(0,nd,nd)
#for (k in 1:nd) { ## second derivative loop
# for (j in k:nd) {
# rss2[j,k] <- rss2[k,j] <- 2 * sum(db[,j]*XX.db[,k])
# bSb2[j,k] <- bSb2[k,j] <- (k==j)*sum(beta*Skb[[k]]) + 2*(sum(db[,k]*(Skb[[j]]+S.db[,j])) +
# sum(db[,j]*Skb[[k]]))
# }
#}
## rss2 <- 2 * t(db) %*% XX.db