ChangeLog 109 KB
Newer Older
1 2
**  denotes quite substantial/important changes
*** denotes really big changes 
3

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
1.8-8

** New "gp" smooth class (see ?gp.smooth) implemeting the Matern 
   covariance based Gaussian process model of Kamman and Wand (2003), and a 
   variety of other simple GP smoothers.

* some smooth plot methods now accept 'colors' and 'contour.col' argument to
  set color palette in image plots and contour line colors. 

* predict.gam and predict.bam now accept an 'exclude' argument allowing 
  terms (e.g. random effects) to be zeroed for prediction. For efficiency,
  smooth terms not in 'terms' or in 'exclude' are no longer evaluated, and 
  are instead set to zero or not returned. See ?predict.gam.

* ocat saturated likelihood definition changed to zero, leading to better 
  comprability of deviance between model fits (thanks to Herwig Friedl).

* null.deviance calculation for extended families modified to make more sense
  when `mu' is the mean of a latent variable, rather than the response itself. 

* bam now returns standarized residuals 'std.rsd' if `rho!=0'. 

* bam(...,discrete=TRUE) can now handle 'fs' terms.

* bam(...,discrete=TRUE) now accepts 'by' variables. Thanks to Zheyaun Li
  for debugging on this.

* bam now works with drop.unused.levels == TRUE when random effects should
  have more levels than those that exist in data. (Thanks Alec Leh) 

* bam chunk.size logic error fix - error could be triggered if chunk.size
  reset automaticlly to be larger than data size.

* uniqucombs can now accept a data frame with some or all factor columns,
  as well as purely numeric marices.

* discrete.mf modified to avoid discretizing a covariate more than once,
  and to halt if a model requires the same covariate to be discretized 
  two different ways (e.g. s(x) + s(x,z)). This affects only 
  bam(...,discrete=TRUE).

* Some changes to ziP and ziplss families to improve numerical robustness,
  and to ziP help file to suggest appropriate checking. Thanks to Keren 
  Raiter, for reporting problems. 

* numerical robustness of extended gam methods (gam.fit4) improved for cases 
  with many zero or near zero iterative weights. Handling of zero weights 
  modified to avoid divide by (near) zero problems. Also tests for poor 
  scaling of sqrt(abs(w))*z and substitutes computations based on w*z if 
  detected. Also 'newton' routine now step halves if REML score not finite!

* Sl.setup (used by bam) modification to allow more efficient handling of terms
  with multiple diagonal penalties with no non-zero elements in common, but
  possibly with non zero elements `interleaved' between penalties.

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
1.8-7

** 'gam' default scale parameter changed to modified Pearson estimator 
  developed by Fletcher 2012 Biometrika 99(1), 230-237. See ?gam.scale.

** 'bam' now has a 'discrete' argument to allow discretization of covariates
  for more efficient computation, with substantially more parallelization
  (via 'nthreads'). Still somewhat experimental. 

* Slightly more accurate smoothing parameter uncertainty correction. Changes 
  edf2 used for AIC (under RE/ML), and hence may change AIC values. 

* jagam prior variance on fixed effects is now set with reference to data and 
  model during initialization step.

* bam could lose offset for small datasets in gaussian additive case. fixed. 

* gam.side now setup to include penalties in computations if fewer data than 
  coefs (an exceedingly specialist topic). 

* p-value computation for smooth terms modified to avoid an ambiguity in the 
  choice of test statistic that could lead to p-value changing somewhat between 
  platforms.   

* gamm now warns if attempt is made to use extended family.

* step fail logic improved for "fREML" optimization in 'bam'.

* fix of openMP error in mgcv_pbsi, which could cause a problem in 
  multi-threaded bam computation (failure to declare a variable as private).  

* Smoothing parameter uncertainty corrected AIC calculations had an 
  indexing problem in Sl.postproc, which could result in failure of bam with 
  linked smooths. 

* mroot patched for fact that chol(...,pivot=TRUE) does not operate as 
  documented on rank deficient matrices: trailing block of triangular factor
  has to be zeroed for pivoted crossprod of factor to equal original matrix. 

* bam(...,sparse=TRUE) deprecated as no examples found where it is really 
  worthwhile (but let me know if this is a problem). 

* marginal model matrices in tensor product smooths now stored in 
  re-parameterized form, if re-parameterization happened (shouldn't change 
  anything!).

* initial.spg could fail if response vector had dim attributes and extended 
  family used. fixed.

108 109 110 111 112 113 114 115 116 117 118 119 120 121
1.8-6

* Generalization of list formula handling to allow linear predictors to
  share terms. e.g. gam(list(y1~s(x),y2~s(z),1+2~s(v)+w-1),family=mvn(d=2))

* New German translation thanks to Detlef Steuer.

* plot.gam now silently returns a list of plotting data, to help advanced 
  users (Fabian Scheipl) to produce custimized plot.

* bam can now set up an object suitable for fitting, but not actually do
  the fit, following a suggestion by Fabian Scheipl. See arguments 'fit' 
  and 'G'. 

122 123
1.8-5

124 125
* Korean translation added thanks to Chel Hee Lee.

126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
* scale parameter handling in edf in logLik.gam made consistent with glm 
  (affects AIC).

* 'bam', 'gam' and 'gamm' modified to often produce smaller files when models 
  saved (and never to produce absurdly large files). Achieved by setting 
  environment of formula, terms etc to .GlobalEnv. Previously 'save' could
  save entire contents of environment of formula/terms with fitted model 
  object. Note that change can cause failure in user written functions calling 
  gam/bam and then 'predict' without supplying all prediction variables 
  (fix obvious).

* A help file 'single.index' supplied illustrating how single index models
  can be estimated in mgcv.

* predict.gam now only creates a "constant" attribute if the model has one.

* gam.fit4 convergence testing of coefs modified to more robust test of
  gradients of penalized dev w.r.t. params, rather than change in params,
  which can fail under rank deficiency.

* mgcv_qrqy was not thread safe. Not noticeable on many platforms as all 
  threads did exactly the same thing to the same matrix, but very noticeable
  on Windows. Thread safe mgcv_qrqy0 added and used in any parallel sections.

* Allow openMP support if compiler supports it and provides pre-defined macro 
  _OPENMP, even if SUPPORT_OPENMP undefined. (Allows multi-threading on 
   Windows, for example.) 

* 'eps' is now an argument to 'betar' allowing some control on how to 
  handle response values too close to 0 or 1. Help file expanded to 
  emphasise the problems with using beta regression with 0s and 1s in 
  the data.

* fix of bug in multi-formula contrast handling, causing failure of prediction
  in some  cases.

* ziP and ziplss now check for non-integer (or binary) responses and produce
  an error message if these are found. Previously this was not trapped and
  could lead to a segfault. 

166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
1.8-4

** JAGS/BUGS support added, enabling auto-generation of code and data
  required to used mgcv type GAMs with JAGS. Useful for complex random 
  effects structures, for example.

* smoothCon failed if selection penalties requested, but term was unpenalized.
  Now fixed (no selection penalties on unpenalized terms.)
  
* gam.check would fail for tensor product smooths with by variables - fixed.

* predict.gam would fail when predicting for more data than the blocksize
  but selecting only some terms. Fixed thanks to Scott Kostyshak.

* smoothCon now has an argument `diagonal.penalty' allowing single penalty 
  smooths to be re-parameterized in order to diagonalize the penalty matrix.
  PredictMat is modified to apply the same reparameterization, making it
  user transparent. Facilitates the setup of smooths for export to other 
  packages.

* predict.bam now exported in response to a request from another 
  package maintainer.

* 1.8 allows some prediction tasks for some families (e.g. cox.ph) to 
  require response variables to be supplied. NAs in these then messed up 
  prediction when they were not needed (e.g. if response variables with
  NAs were provided to predict.gam for a simple exponential family GAM). 
  Response NAs now passed to the family specific prediction code, restoring 
  the previous behaviour for most models. Thanks Casper Wilestofte Berg.

* backend parallel QR code used by gam modified to use a pivoted block
  algorithm.

* nthreads argument added to 'bam' to allow for parallel computation 
  for computations in the main process (serial on any cluster nodes).
  e.g. QR based combination of results from cluster nodes is now
  parallel.

* fREML computation now partly in parallel (controlled by 'nthreads' 
  argument to 'bam')

* slanczos now accepts an nt argument allowing parallel computation of 
  main O(n^2) step.

* fix to newton logic problem, which could cause an attempt to use 'score2'
  before definition.

* fix to fREML code which could cause matrix square root to lose dimensions 
  and cause an error. 

* initial.sp could perform very poorly for very low basis dimensions - could 
  set initial sp to effective infinity. 

219 220 221 222 223 224 225 226 227 228 229
1.8-3

* Fix of two illegal read/write bugs with extended family models with no
  smooths. (Thanks to Julian Faraway for reporting beta regr problem).

* bam now checks that chunk.size > number of parameters and resets the 
  chunk.size if not.

* Examples of use of smoothCon and PredictMat for setting up bases 
  for use outside mgcv (and then predicting) added to ?smoothCon.

230 231 232
1.8-2

* For exponential family gams, fitted by outer iteration, a warning is now
233
  generated if the Pearson scale parameter estimate is more than 4 times
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
  a robust estimate. This may indicate an unstable Pearson estimate.

* 'gam.control' now has an option 'scale.est' to allow selection of the 
  estimator to use for the scale parameter in exponential family GAMs. 
  See ?gam.scale. Thanks to Trevor Davies for providing a clear unstable 
  Pearson estimate example.

* drop.unused.levels argument added to gam, bam and gamm to allow 
  "mrf" (and "re") terms to have unobserved factor levels.

* "mrf" constructor modified to deal properly with regions that contain no 
  observations.

* "fs" smooths are no longer eligible to have side conditions set, since 
  they are fully penalized terms and hence always identifiable (in theory).

* predict.bam was not declared as a method in NAMESPACE - fixed

* predict.bam modified to strip down object to save memory (especially in 
  parallel).

* predict.gam now has block.size=NULL as default. This implies a block
  size of 1000 when newdata supplied, and use of a single block if no
  new data was supplied. 

* some messages were not printing correctly after a change in 
  message handling to facilitate easier translation. Now fixed.

262 263 264 265 266
1.8-1

* bam modified so that choleski based fitting works properly with rank 
  deficient model matrix (without regularization).

267 268 269
* fix of 1.8-0 bug - gam prior weights mishandled in computation of cov matrix,
  resulting in incorrect variance estimates (even without prior weights 
  specified). Thanks Fabian Scheipl.
270
		
271
1.8-0
272

273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
*** Cox Proportional Hazard family 'cox.ph' added as example of general
  penalized likelihood families now useable with 'gam'.

*** 'ocat', 'tw', 'nb', 'betar', 'ziP' and 'scat' families added for 
  ordered categorical data, Tweedie with estimation of 'p', negative binomial 
  with (fast) estimation of 'theta', beta regression for proportions, simple
  zero inflated Poisson regression and heavy tailed regression with scaled t 
  distribution. These are all examples of 'extended families' now useable 
  with 'gam'.

*** 'gaulss' and 'ziplss' families, implementing models with multiple linear 
  predictors. For gaulss there is a linear predictor for the Gaussian mean
  and another for the standard deviation. For ziplss there is a linear
  predictor controlling `presence' and another controlling 
  the Poisson parameter, given presence. 

*** 'mvn' family for multivariate normal additive models.

** AIC computation changed for bam and gam models estimated by REML/ML
   to account for smoothing parameter uncertainty in degrees of freedom
   term.

* With REML/ML smoothness selection in gam/bam an extra covariance matrix 'Vc'
  is now computed which allows for smoothing parameter uncertainty. See
  the 'unconditional' arguments to 'predict.gam' and 'plot.gam' to use this. 

* 'gam.vcomp' bug fix. Computed intervals for families with fixed scale 
   parameter were too wide. 

* gam now defaults to the Pearson estimator of the scale parameter to avoid
  poor scale estimates in the quasipoisson case with low counts (and possibly
  elsewhere). Gaussian, Poisson and binomial inference invariant to change. 
  Thanks to Greg Dropkin, for reporting the issue.

* Polish translation added thanks to Lukasz Daniel.

* gam.fit3 now forces eta and mu to be consistent with coef and valid on
  return (previously could happen that if step halving was used in final
  iteration then eta or mu could be invalid, e.g. when using identity link
  with non-negative data)

* gam.fit3 now bases its convergence criteria on grad deviance w.r.t. model 
  coefs, rather than changes in model coefs. This prevents problems when 
  there is rank deficiency but different coefs get dropped at different 
  iterations. Thanks to Kristynn Sullivan.

* If mgcv is not on the search path then interpret.gam now tries to 
  evaluate in namespace of mgcv with environment of formula as enclosing 
  environment, if evaluation in the environment of the formula fails. 

* bug fix to sos plotting method so that it now works with 'by' variables.

* 'plot.gam' now weights partial residuals by *normalized* square root 
  iterative weights so that the average weight is 1 and the residuals 
  should have constant variance if all is ok.

* 'pcls' now reports if the initial point is not feasible.

* 'print.gam' and 'summary.gam' now report the rank of the model if it is
   rank deficient. 'gam.check' reports the model rank whenever it is 
   available.

* fix of bug in 'k.check' called by 'gam.check' that gave an error for 
  smooths with by variables.

* predict.gam now checks that factors in newdata do not contain more
  levels than those used in fitting.

* predict.gam could fail for type "terms" with no intercept - fixed.

* 'bfgs' now uses a finite difference approximation for the initial inverse 
  Hessian. 
345

346 347 348 349 350
1.7-29

* Single character change to Makevars file so that openMP multi-threading 
  actually works.  

351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
1.7-28

* exclude.too.far updated to use kd-tree instead of inefficient search for 
  neighbours. This can make plot.gam *much* faster for large datasets.

* Change in smoothCon, so that sweep and drop constraints (default for bam
  for efficiency reasons) are no longer allowed with by variables and matrix 
  arguments (could lead to confusing results with factor by variables in bam). 

* 'ti' terms now allow control of which marginals to constrain, via 'mc'.
  Allows e.g. y ~ ti(x) + ti(x,z,mc=c(0,1)) - for experts only! 

* tensor.prod.model.matrix re-written to call C code. Around 5-10 times
  faster than old version for large data sets.

* re-write of mini.mf function used by bam to generate a reduced size 
  model frame for model setup. New version ensures that all factor levels 
  are present in reduced frame, and avoids production of unrealistic
  combinations of variables in multi-dimensional smooths which could occur
  with old version. 

* bam models could fail if a penalty matrix was 1 by 1, or if multiple 
  penalties on a smooth were in fact seperable into single penalties. 
  Fixed. Thanks to Martijn weiling for reporting.

* Constant in tps basis computation was different to published version 
  for odd dimensions - makes no difference to fit, but annoying if you 
  are trying to test a re-implementation. Thanks to Weijie Cai at SAS. 

* prediction for "cc" and "cp" classes is now cyclic - values outside the
  range of knots are wrapped back into the interval.

* ldTweedie now returns derivatives w.r.t. a transform of p as well as 
  w.r.t log of scale parameter phi.

* gamm can now handle 'varComb' variance functions (thanks Sven Neulinger
  for reporting that it didn't).

* fix of a bug which could cause bam to seg fault for a model with no smooths 
  (insufficient storage allocated in C in this case). Thanks Martijn Weiling.

392 393 394 395 396 397 398 399 400 401 402
1.7-27

* Further multi-threading in gam fits - final two leading order matrix
  operations parallelized using openMP. 

* Export of smooth.construct.t2.smooth.spec and Predict.matrix.t2.smooth, 
  and Rrank.

* Fix of of missing [,,drop=FALSE] in predict.gam that could cause problems 
  with single row prediction when 'terms' supplied (thanks Yang Yang).

403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
1.7-26

* Namespace fixes.

1.7-25

* code added to allow openMP based multi-threading in gam fits (see
  ?gam.control and ?"mgcv-parallel"). 

* bam now allows AR1 error model to be split blockwise. See argument 
  'AR.start'.

* magic.post.proc made more efficient (one of two O(np^2) steps removed).

* var.summary now coerces character to factor. 

* bugs fixed whereby etastart etc were not passed to initial.spg and
  get.null.coefs. Thanks to Gavin Simpson.

* reformulate removed from predict.gam to avoid (slow) repeated parser 
  calls.

* gaussian(link="log") initialization fixed so that negative data 
  does not make it fail, via fix.family patching function.

* bug fix in plot method for "fs" basis - ignored any side conditions.
  Thanks to Martijn Weiling and Jacolien van Rij.

* gamm now checks whether smooths nested in factors have illegal side 
  conditions, and halts if so (re-ordering formula can help).
 
* anova.glmlist no longer called.

* Compiled code now uses R_chck_calloc and R_chk_free for memory management
  to avoid the possibility of unfriendly exit on running out of memory. 

* fix in gam.side which would fail with unpenalized interactions in the 
  presence of main effects. 

442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
1.7-24

* Examples pruned in negbin, smooth.construct.ad.smooth.spec and bam help 
  files to reduce CRAN checking load.

* gam.side now warns if only repeated 1-D smooths of the same variable are
  encountered, but does not halt.

* Bug fix in C code for "cr" basis, that could cause a memory violation during
  prediction, when an extrapolation was immediately followed by a prediction 
  that lay exactly on the upper boundary knot. Thanks to Keith Woolner for 
  reporting this.

* Fix for bug in fast REML code that could cause bam to fail with ti/te only
  models. Thanks to Martijn Wieling.

* Fix of bug in extract.lme.cov2, which could cause gamm to fail when
  a correlation structure was nested inside a grouping factor finer than
  the finest random effect grouping factor. 

* Fix for an interesting feature of lme that getGroups applied to the 
  corStruct that is part of the fitted lme object returns groups in 
  sorted order, not data frame order, and without an index from one order 
  to the other. (Oddly, the same corStruct Initialized outside lme has its 
  groups  in data frame order.) This feature could cause gamm to fail,
  complaining that the grouping factors for the correlation did not appear 
  to be nested inside the grouping structure of the random effects. A 
  bunch of ordering sensitivity tests have been added to the mgcv test suite.
  Thanks to Dave Miller for reporting the bug. 

472 473 474 475
1.7-23

*** Fix of severe bug introduced with R 2.15.2 LAPACK change. The shipped
  version of dsyevr can fail to produce orthogonal eigenvectors when 
476
  uplo='U' (upper triangle of symmetric matrix used), as opposed to 'L'. 
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
  This led to a substantial number of gam smoothing parameter estimation 
  convergence failures, as the key stabilizing re-parameterization was 
  substantially degraded. The issue did not affect gaussian additive models
  with GCV model selection. Other models could fail to converge any further 
  as soon as any smoothing parameter became `large', as happens when a 
  smooth is estimated as a straight line. check.gam reported the lack of full 
  convergence, but the issue could also generate complete fit failures.
  Picked up late as full test suite had only been run on R > 2.15.1 with an 
  external LAPACK.

** 'ti' smooth specification introduced, which provides a much better (and 
  very simple) way of allowing nested models based on 'te' type tensor 
  product smooths. 'ti' terms are used to set up smooth interactions 
  excluding main effects (so ti(x,z) is like x:z while te(x,z) is more
  like x*z, although the analogy is not exact). 

* summary.gam now uses a more efficient approach to p-value computation 
  for smooths, using the factor R from the QR factorization of the weighted 
  model matrix produced during fitting. This is a weighted version of the 
  Wood (2013) statistic used previously - simulations in that paper 
  essentially unchanged by the change. 

* summary.gam now deals gracefully with terms such as "fs" smooths 
500
  estimated using gamm, for which p-values can not be computed. (thanks to 
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
  Gavin Simpson).

* gam.check/qq.gam now uses a normal QQ-plot when the model has been fitted 
  using gamm or gamm4, since qq.gam cannot compute corrext quantiles in 
  the presence of random effects in these cases. 

* gamm could fail with fixed smooths while assembling total 
  penalty matrix, by attempting to access non-existent penalty 
  matrix. (Thanks Ainars Aunins for reporting this.)

* stripped rownames from model matrix, eta, linear predictor etc. Saves
  memory and time.

* plot.soap.film could switch axis ranges. Fixed.

* plot.mgcv.smooth now sets smooth plot range on basis of xlim and 
  ylim if present.

* formXtViX documentation fixed + return matrix labels.

* fixDependence related negative index failures for completely confounded 
  terms - now fixed.

* sos smooth model matrix re-scaled for better conditioning.

* sos plot method could produce NaNs by a rounding error in argument to 
  acos - fixed. 
528

529 530 531 532 533 534 535 536
1.7-22

* Predict.matrix.pspline.smooth now allows prediction outside range of knots, 
  and uses linear extrapolation in this case.

* missing drop=FALSE in reTest called by summary.gam caused 1-D random effect
  p-value computation to fail. Fixed (thanks Silje Skår).

537 538 539 540 541 542 543 544 545 546
1.7-21

** soap film smoother class added. See ?soap

* Polish translation added thanks to Lukasz Daniel.

* mgcv/po/R-mgcv.pot up-dated.

* plot methods for smooths modified slightly to allow methods to return 
  plot data directly, without a prediction matrix.
547 548 549

1.7-20

550
* '...' now passed to termplot by plot.gam (thanks Andreas Eckner).
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566

* fix to null deviance computation for binomial when n>1, matrix response 
  used and an offset is present. (Thanks to Tim Miller)

* Some pruning of unused code from recov and reTest.

* recov modified to stop it returning a numerically non-symmetric Ve, and 
  causing occasional failures of summary.gam with "re" terms.

* MRF smooth bug. Region ordering could become confused under some 
  circumstances due to incorrect setting of factor levels. Corrected 
  thanks to detailed bug report from Andreas Bender.

* polys.plot colour/grey scale bug. Could ask for colour 0 from colour 
  scheme, and therefore fail. Fixed.

567 568 569 570 571 572
1.7-19

** summary.gam and anova.gam now use an improved p-value computation for 
  smooth terms with a zero dimensional penalty null space (including 
  random effects). The new scheme has been tested by full replication 
  of the simulation study in Scheipl (2008,CSDA) to compare it to the best 
573
  method therein. In these tests it is at least as powerful as the best 
574 575 576 577 578 579 580 581 582 583
  method given there, and usually indistinguishable, but it gives slightly 
  too low null p-values when smoothing parameters are very poorly identified. 
  Note that the new p-values can not be computed from old fitted gam objects.
  Thanks to Martijn Wieling for pointing out how bad the p-values for regular
  smooths could be with random effects.

* t2 terms now take an argument `ord' that allows orders of interaction to 
  be selected.

* "tp" smooths can now drop the null space from their construction via
584
  a vector m argument, to allow testing against polynomials in the null space.
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600

* Fix of vicious little bug in gamm tensor product handling that could have 
  a te term pick up the wrong model matrix and fail. 

* bam now resets method="fREML" to "REML" if there are no free smoothing 
  parameters, since there is no advantage to the "fREML" optimizer in this 
  case, and it assumes there is at least one free smoothing parameter.

* print.gam modified to print effective degrees of freedom more prettily,

* testStat bug fix. qr was called with default arguments, which includes 
  tol=1e-7... 

* bam now correctly returns fitting weights (rather than prior) in weights 
  field.

601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
1.7-18

* Embarrassingly, the adjusted r^2 computation in summary.gam was wrong
  for models with prior weights. Now fixed, thanks to Antony Unwin.

* bam(...,method="fREML") could give incorrect edfs for "re" terms as a 
  result of a matrix indexing error in Sl.initial.repara. Now fixed. 
  Thanks to Martijn Wieling for reporting this.

* summary.gam had freq=TRUE set as default in 1.7-17. This gave better 
  p-values for paraPen terms, but spoiled p-values for fixed effects in the
  presence of "re" terms (a rather more common setup). Default now reset to
  freq=FALSE.

* bam(...,method="fREML") made fully compatible with gam.vcomp.

* bam and negbin examples speeded up

* predict.gam could fail for models of the form y~1 when newdata are supplied.
  (Could make some model averaging methods fail). Fixed.

* plot.gam had an overzealous check for availibility of variance estimates,
  which could make rank deficient models fail to plot CIs. fixed.

625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653
1.7-17

** p-values for terms with no un-penalized components were poor. The theory on 
  which the p-value computation for other terms is based shows why this is, 
  and allows fixes to be made. These are now implemented.

* summary p value bug fix --- smooths with no null space had a bug in 
  lower tail of p-value computation, yielding far too low values. Fixed.

* bam now outputs frequentist cov matrix Ve and alternative effective degrees 
  of freedom edf1, in all cases.

* smoothCon now adjusts null.space.dim on constraint absorption.

* Prediction with matrix arguments (i.e. for models using summation 
  convention) could be very memory hungry. This in turn meant that
  bam could run out of memory when fitting models with such terms.
  The problem was memory inefficient handling of duplicate evaluations.
  Now fixed by modification of PredictMat

* bam could fail if the response vector was of class matrix. fixed.

* reduced rank mrf smooths with supplied penalty could use the incorrect
  penalty rank when computing the reduced rank basis and fail. fixed 
  thanks to Fabian Scheipl.

* a cr basis efficiency change could lead to old fitted model objects causing 
  segfaults when used with current mgcv version. This is now caught.

654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
1.7-16

* There was an unitialized variable bug in the 1.7-14 re-written "cr" basis 
  code for the case k=3. Fixed.

* gam.check modified slightly so that k test only applied to smooths of
  numeric variables, not factors.

1.7-15

* Several packages had documentation linking to the 'mgcv' function
  help page (now removed), when a link to the package was meant. An alias
  has been added to mgcv-package.Rd to fix/correct these links. 

1.7-14

** predict.bam now added as a wrapper for predict.gam, allowing parallel 
   computation

** bam now has method="fREML" option which uses faster REML optimizer: 
   can make a big difference on parameter rich models.

* bam can now use a cross product and Choleski based method to accumulate
  the required model matrix factorization. Faster, but less stable than 
  the QR based default.

* bam can now obtain starting values using a random sub sample of the data. 
  Useful for seriously large datasets. 

* check of adequacy of basis dimensions added to gam.check

* magic can now deal with model matrices with more columns than rows.

* p-value reference distribution approximations improved.

* bam returns objects of class "bam" inheriting from "gam"

* bam now uses newdata.guaranteed=TRUE option when predicting as part
  of model matrix decomposition accumulation. Speeds things up. 

* More efficient `sweep and drop' centering constraints added as default for
  bam. Constaint null space unchanged, but computation is faster.

* Underlying "cr" basis code re-written for greater efficiency.

* routine mgcv removed, it now being many years since there has been any 
  reason to use it. C source code heavily pruned as a result. 

* coefficient name generation moved from estimate.gam to gam.setup.

* smooth2random.tensor.smooth had a bug that could produce a nonsensical
  penalty null space rank and an error, in some cases (e.g. "cc" basis)
  causing te terms to fail in gamm. Fixed.

* minor change to te constructor. Any unpenalized margin now has 
  corresponding penalty rank dropped along with penalty.

* Code for handling sp's fixed at exactly zero was badly thought out, and 
  could easily fail. fixed.

* TPRS prediction code made more efficient, partly by use of BLAS. Large
  dataset setup also made more efficient using BLAS.

* smooth.construct.tensor.smooth.spec now handles marginals with factor
  arguments properly (there was a knot generation bug in this case)

* bam now uses LAPACK version of qr, for model matrix QR, since it's 
  faster and uses BLAS.

723 724 725 726 727 728 729 730 731 732 733 734
1.7-13

** The Lanczos routine in mat.c was using a stupidly inefficient check for 
  convergence of the largest magnitude eigenvectors. This resulted in 
  far too many Lanczos steps being used in setting up thin plate regression 
  splines, and a noticeable speed penalty. This is now fixed, with many thanks
  David Shavlik for reporting the slow down.  

* Namespace modified to import from methods. Dependency on stats and graphics
  made explicit.

* "re" smooths are no longer subject to side constraint under nesting (since
735
  this is almost always un-necessary and undesirable, and often unexpected).
736 737 738 739

* side.con modified to allow smooths to be excluded and to allow side 
  constraint computation to take account of penalties (unused at present).

740 741 742 743 744
1.7-12

* bam can now compute the leading order QR decomposition on a cluster
  set up using the parallel package.

745
* Default k for "tp" and "ds" modified so that it doesn't exceed  100 + 
746
  the null space dimension (to avoid complaints from users smoothing in 
747
  quite alot of dimensions). Also default sub-sample size reduced to 2000.
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769

* Greater use of BLAS routines in the underlying method code. In particular 
  all leading order operations count steps for gam fitting now use BLAS. 
  You'll need R to be using a rather fancy BLAS to see much difference, 
  however. 

* Amusingly, some highly tuned blas libraries can result in lapack not always 
  giving identical eigenvalues when called twice with the same matrix. The 
  `newton' optimizer had assumed this wouldn't happen: not any more.

* Now byte compiled by default. Turn this off in DESCRIPTION if it interferes
  with debugging.
 
* summary.gam p-value computation options modified (default remains the 
  same).

* summary.gam default p-value computation made more computationally 
  efficient.

* gamm and bam could fail under some options for specifying binomial models.
  Now fixed.

770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
1.7-11

* smoothCon bug fix to avoid NA labels for matrix arguments when 
  no by variable provided. 

* modification to p-value computation in summary.gam: `alpha' argument 
  removed (was set to zero anyway); computation now deals with possibility
  of rank deficiency computing psuedo-inverse of cov matrix for statistic. 
  Previously p-value computation could fail for random effect smooths with 
  large datasets, when a random effect has many levels. Also for large data
  sets test statistic is now based on randomly sampling max(1000,np*2) model
  matrix rows, where np is number of model coefficients (random number 
  generator state unchanged by this), previous sample size was 3000. 

* plot.mrf.smooth modified to allow passing '...' argument.

* 'negbin' modified to avoid spurious warnings on initialization call.

788 789 790 791
1.7-10

* fix stupid bug in 1.7-9 that lost term labels in plot.gam.

792 793 794 795 796 797 798 799 800 801 802 803 804
1.7-9

* rather lovely plot method added for splines on the sphere.

* plot.gam modified to allow 'scheme' to be specified for plots, to easily
  select different plot looks.

* schemes added for default smooth plotting method, modified for mrfs and 
  factor-smooth interactions.

* mgcv function deprected, since magic and gam are much better (let me know 
  if this is really a problem).  

805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863
1.7-8

* gamm.setup fix. Bug introduced in 1.7-7 whereby gamm with no smooths would
  fail.

* gamm gives returned object a class "gamm"


1.7-7

* "fs" smooth factor interaction class introduced, for smooth factor 
  interactions where smoothing parameters are same at each factor level.
  Very efficient with gamm, so good for e.g. individual subject smooths.

* qq.gam default method modified for increased power.

* "re" terms now allowed as tensor product marginals.

* log saturated likelihoods modified w.r.t. weight handling, so that weights
  are treated as modifying the scale parameter, when scale parameter is free.
  i.e. obs specific scale parameter is overall scale parameter divided by 
  obs weight. This ensures that when the scale parameter is free, RE/ML based
  inference is invariant to multiplicative rescaling of weights. 

* te and t2 now accept lists for 'm'. This allows more flexibility with 
  marginals that can have vector 'm' arguments (Duchon splines, P splines).   

* minor mroot fix/gam.reparam fix. Could declare symmetric matrix 
  not symmetric and halt gam fit.

* argument sparse added to bam to allow exploitation of sparsity in fitting,
  but results disappointing.

* "mrf" now evaluates rank of penalty null space numerically (previously 
   assumed it was always one, which it need not be with e.g. a supplied 
   penalty).

* gam.side now corrects the penalty rank in smooth objects that have 
  been constrained, to account for the constraint. Avoids some nested 
  model failures.

* gamm and gamm.setup code restructured to allow smooths nested in factors
  and for cleaner object oriented converion of smooths to random effects.

* gam.fit3 bug. Could fail on immediate divergence as null.eta was matrix.

* slanczos bug fixes --- could segfault if k negative. Could also fail to 
  return correct values when k small and kl < 0 (due to a convergence 
  testing bug, now fixed)

* gamm bug --- could fail if only smooth was a fixed one, by looking for
  non-existent sp vector. fixed.

* 'cc' Predict.matrix bug fix - prediction failed for single points.

* summary.gam failed for single coefficient random effects. fixed.

* gam returns rV, where t(rV)%*%rV*scale is Bayesian cov matrix.
 
864 865 866 867 868 869 870 871 872 873
1.7-6

** factor `by' variable handling extended: if a by variable is an
   ordered factor then the first level is treated as a reference level
   and smooths are only generated for the other levels. This is useful 
   for avoiding identifiability issues in complex models with factor by 
   variables. 

* bam bug fix. aic was reported incorrectly (too low). 

874 875 876 877 878 879 880 881
1.7-5

* gam.fit3 modified to converge more reliably with links that don't guarantee
  feasible mu (e.g poisson(link="identity")). One vulnerability removed + a
  new approach taken, which restarts the iteration from null model 
  coefficients if the original start values lead to an infinite deviance.

* Duchon spline bug fix (could fail to create model matrix if 
882
  number of data was one greater than number of unique data).
883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
    
* fix so that 'main' is not ignored by plot.gam (got broken in 1.7-0 
  object orientation of smooth plotting)

* Duchon spline constructor now catches k > number of data errors.

* fix of a gamm bug whereby a model with no smooths would fail after 
  fitting because of a missing smoothing parameter vector.

* fix to bug introduced to gam/bam in 1.7-3, whereby '...' were passed to 
  gam.control, instead of passing on to fitting routines. 

* fix of some compiler warnings in matrix.c 

* fix to indexing bug in monotonic additive model example in ?pcls.

899 900 901 902 903 904 905 906 907 908 909
1.7-4

* Fix for single letter typo bug in C code called by slanczos, could 
  actually segfault on matrices of less than 10 by 10.

* matrix.c:Rlanczos memory error fix in convergence testing of -ve 
  eigenvalues.

* Catch for min.sp vector all zeroes, which could cause an ungraceful 
  failure. 

910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932
1.7-3

** "ds" (Duchon splines) smooth class added. See ?Duchon.spline

** "sos" (spline on the sphere) smooth class added. See ?Spherical.Spline.

* Extended quasi-likelihood used with RE/ML smoothness selection and 
  quasi families. 

* random subsampling code in bam, sos and tp smooths modified a little, so 
  that .Random.seed is set if it doesn't exist. 

* `control' argument changed for gam/bam/gamm to a simple list, which is 
  then passed to gam.control (or lmeControl), to match `glm'.

* Efficiency of Lanczos iteration code improved, by restructuring, and 
  calling LAPACK for the eigen decompostion of the working tri-diagonal
  matrix.

* Slight modification to `t2' marginal reparameterization, so that `main 
  effects' can be extracted more easily, if required.


933 934 935 936 937 938 939
1.7-2

* `polys.plot' now exported, to facilitate plotting of results for
  models involving mrf terms.

* bug fix in plot.gam --- too.far had stopped working in 1.7-0.

940 941 942 943 944 945 946 947 948 949 950 951 952 953
1.7-1

* post fitting constraint modification would fail if model matrix was 
  rank deficient until penalized. This was an issue when mixing new t2 
  terms with "re" type random effects. Fixed.

* plot.mrf.smooth bug fix. There was an implicit assumption that the
  `polys' list was ordered in the same way as the levels of the covariate
  of the smooth. fixed. 

* gam.side intercept detection could occasionally fail. Improved.

* concurvity would fail if model matrix contained NA's. Fixed.

954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
1.7-0

** `t2' alternative tensor product smooths added. These can be used with 
  gamm4. 

** "mrf" smooth class added (at the suggestion of Thomas Kneib). 
   Implements smoothing over discrete geographic districts using a
   Markov random field penalty. See ?mrf

* qq.gam added to allow better checking of distribution of residuals.

* gam.check modified to use qq.gam for QQ plots of deviance residuals.
  Also, it now works with gam(*, na.action = "na.replace") and NAs.

* `concurvity' function added to provide simple concurvity measures.

* plot.gam automatic layout modified to be a bit more sensible (i.e.
  to recognise that most screens are landscape, and that usually 
  squarish plots are wanted). 

* Plot method added for mrf smooths. 

* in.out function added to test whether points are interior to 
  a region defined by a set of polygons. Useful when working with 
  MRFs.

* `plot.gam' restructured so that smooths are plotted by smooth specific
  plot methods.

* Plot method added for "random.effect" smooth class.

* `pen.edf' function added to extract EDF associated with each penalty.
   Useful with t2 smooths. 

* Facilty provided to allow different identifiability constraints to be
  used for fitting and prediction. This allows t2 smooths to be fitted
  with a constraint that allows fitting by gamm4, but still perform 
  inference with the componentwise optimal sum to zero constraints.

* mgcv-FAQ.Rd added.

* paraPen works properly with `gam.vcomp' and full.sp names returned 
  correctly.

* bam (and bam.update) can now employ an AR1 error model in the 
  guassian-identity case. 

* bam.update modified for faster updates (initial scale parameter 
  estimate now supplied in RE/ML case)

* Absorption of identifiability constraints modified to allow 
  constraints that only affect some parameters to leave rest of 
  parameters completely unchanged.  

* rTweedie added for quick simulation of Tweedie random deviates 
  when 1<p<2.

* smooth.terms help file fixed so cyclic p spline identifies as "cp"
  and not "cs"!

* bug fix in `gamm' so that binomial response can be provided as 2 column 
  matrix, in standard `glm' way.
1016

1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
1.6-2

** Random effect support for `gam' improved with the addition of 
   a random effect "smooth" class, and a function for extracting 
   variance components. See ?random.effects and links for details. 

* smooths now contain extra elements: S.scale records the scale factor 
  used in any linear rescaling of a penalty matrix; plot.me indicates 
  whether `plot.gam' should attempt to plot the term; te.ok indicates 
  whether the smooth is a suitable marginal for a tensor product.

* Fix in `gamm.setup' -- models with no fixed effects (except smooths) 
  could fail to fit properly, because of an indexing error (caused odd 
  results with indicator by variables)

1032
* help files have had various misuses of `itemize' fixed. 
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045

* initialization could fail if response was actually a 1D array. fixed.

* New function `bam.update' allows efficient updating of very large
  strictly additive models fitted by `bam' when additional data become 
  available. 

* gam now warns if RE/ML used with quasi families.

* gam.check now accepts graphics parameters.

* fixed problem in welcome message that messed up ESS.

1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
1.6-1

* Bug in cSplineDes caused bases to be non-cyclic unless first 
  knot was at 0. This also affected the "cp" smoother class. Fixed. 

* null.deviance calculation was wrong for case with offset and 
  weights. Fixed.

* Built in strictly 1D smoothers now give an informative error message if 
  an attempt is made to use them for multidimensional smoothing.

* gam.check generated a spurious error when applied to a model with no
  estimated smoothing parameters. Fixed.

1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096
1.6-0

*** Routine `bam' added for fitting GAMs to very large datasets.
    See ?bam

** p-value method tweaked again. Reference DoF for testing now 
  defaults to the alternative EDF estimate (based on 2F - FF where 
  F = (X'WX+S)^{-1}X'WX). `magic.post.proc' and `gam.fit3.post.proc'
  changed to provide this. p-values still a bit too small, but only 
  slightly so, if `method="ML"' is the smoothness selector.

* bad bug in `get.null.coef' could cause fit failure as a result of 
  initial null coefs predicting infinite deviance.

* REML/ML convergence could be response scale sensitive, because of 
  innapropriate convergence testing scaling in newton and bfgs - 
  fixed.

* Slight fix to REML (not ML) score calculation in gam.fit3 - 
  Mp/2*log(2*pi*scale) was missing from REML score, where Mp is
  total null space dimension for model.

* `summary.gam' bug fix: REML/ML models were always treated as if
  scale parameter had been estimated. gamObject should now contain 
  `scale.estimated' indicating whether or not scale estimated

* some modifications to smoothCon and gam.setup to allow smooth
  constructors to return Matrix style sparse model matrices and 
  penalty matrices.  

* fixed misplaced bracket in print.mgcv.version, called on attachment.

* added utility function `ls.list' to give memory usage for elements 
  of a list.

* added function `rig' to generate inverse Gaussian random deviates. 

1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
1.5-6

* "ts" and "cs" modified so that zero eigen values of penalty
   matrix are reset to 10% of smallest strictly positive eigen
   value, rather than 1%. This seems to lead to more reliable
   performance. 

* `bfgs' simplified and improved so that it now checks the Wolfe 
   conditions are met at each step. No longer uses any Newton steps,
   so if it's used with gam.control(outerPIsteps=0) then it's
   first derivative only for smoothing parameter optimization. 

* `outerPIsteps' now defaults to zero in `gam.control'.

* New routine `initial.spg' gets jth initial sp to equalize 
  Frobenious norm of S_j and cols of sqrt(W)X which it penalizes, 
  where W are initial fisher weights. This removes the need for a 
  performance iteration step to get starting values (so 
  outerPIsteps=0 in gam.control can now bypass PI completely).

* fscale set from get.null.coef (facilitates cleaner initialization).

* large data set rare event logistic regression example added to 
  ?gam.

* For p-value calculation for smooths, summary.gam subsamples rows of 
  the model matrix if it has more than 3000 rows. This speeds things
  up for large datasets.

* minor bug fix in `gamm' so that intercept gets correct name, if 
  it's the only non-smooth fixed effect.

1129
* .pot files updated, German translation added, thanks to Detlef Steuer.
1130 1131 1132 1133 1134 1135 1136 1137 1138

* `in.out' was not working from 1.5 --- fixed.

* loglik.gam now ups parameter count for Tweedie by one to account for 
  scale estimation.

* There was a bug in the calculation of the Bayesian cov matrix, when the 
  scale parameter was known: it was always using an estimated scale 
  parameter. Makes no statistically meaningful difference for a model  
1139
  that fits properly, of course. 
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172

* Some junk removed from gam object.

* summary.gam pseudoinversion made slightly more efficient.

* adaptive smooth constructor is a bit more careful about the ranks 
  of the penalties.

* 2d adaptive smoother bug fix --- part of penalty was missing due
  to complete line error.

* `smoothCon' and `PredictMat' modified so that sparse smooths can
   optionally have sparse centering constraints applied. 

* `gamm' fix: prediction and visualization from `x$gam' where x is a 
  fitted `gamm' object should not require the random effects to be 
  provided. Now it doesn't.

* minor bug fix: a model with no penalties except a fixed one would fail
  with an index error. 

* `te' terms are now only subject to centering constraints if all 
  marginals would usually have a centering constraint. 

* `te' no longer resets multi-dimensional marginals to "tp", unless 
  they have been set to "cr", "cs", "ps" or "cp". This allows tensor
  products with user supplied smooths.

* Example of obtaining derivatives of a smooth (with CIs) added to 
  `predict.gam' help file.

* `newdata.guaranteed' argument to predict.gam didn't work. fixed.

1173 1174 1175 1176 1177 1178

1.5-5

* `gamm.setup' made an assumption about basis dimensions which was not 
  true for tensor products involving the "cc" basis. This is now fixed.

1179 1180 1181 1182 1183 1184 1185 1186
1.5-4

* smooth.construct.tensor.smooth.spec modified, so that 
  re-parameterization in terms of function values is only if it's 
  stable, and by default the parameters are function values with
  even spacing. Otherwise it was possible for tensor products of
  p-splines to fail.

1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197
1.5-3

* `gam' now attempts to coerce `data' to a data frame, if it is not 
  already a list or a data frame, provided that it is already an object 
  that model.frame can deal with. This is to support an undocumented 
  feature of versions prior to 1.5-2 that `data' could actually be 
  something other than a list or data frame. 

* An offset of type "array" could cause gam.fit3 to fail. fixed.

* `variable.summary' bug fixed, (it caused gam(y~1) to fail).   
1198

1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218
1.5-2

* Several exported functions had no usage entries in the help files.
  Everything exported does now.

* `vis.gam' had a bunch of bugs (which could make it fail altogether) 
   as a result of trying to set default conditioning values from the gam 
   object model frame. `gam' and `gamm' now obtain summary statistics of 
   the predictor variables, stored in `var.summary' in the gam object, 
   which `vis.gam' now uses. As a result `vis.gam' `view' and `cond' 
   arguments should now contain original variable names, not model frame 
   term names.

* `data' argument of `gam' no longer stored in the `gam' object, by 
  default to save memory (can restore this --- see `gam.control').

* `summary.gam' failed under na.exclude. Fixed. 

* `mroot' failed on 1 by 1 matrices, Fixed.

1219 1220 1221 1222 1223 1224 1225
1.5-1

* The stability of the fitting methods had become substantially greater 
  than the stability of the edf calculations after fitting. So it was 
  possible to fit very poor models, and then have non-sensical effective 
  degrees of freedom reported. This has been fixed by using much more stable 
  expressions for edf calculation, when outer iteration smoothness
1226
  selection is employed. (Changes are to gam.fit3, gam.outer and a new
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238
  routine gam.fit3.post.proc).

* edfs in version 1.5-0 were calculated using newton, rather than fisher 
  weights, in the matrix F=(X'WX+S)^{-1}X'WX, the diagonal of which gives 
  the edf array. The problem with this is that it is possible for X'WX 
  not to be +ve definite, and then degrees of freedom can be non-sensical.
  Fisher weights are always used now (although the original problem is 
  exceedingly hard to generate an example of).

* The summation convention code could be *very* memory intensive for cases 
  in which the matrix arguments of a smooth feature many repeated values. 
  Code now fixed to make much more efficient use of any repeated rows in  
1239
  matrix arguments. This enables much larger signal regression problems to 
1240 1241 1242 1243
  be tackled. 

* Some help file fixes.

1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309
1.5-0

*** Efficient and general REML/ML smoothing selection implemented. 
    Smoothness selection criterion and numerical optimizer are now
    selected using arguments `method' and `optimizer' of `gam', and 
    `gam.method' has been removed.

*** To further enhance stability and efficiency, Fisher scoring is now 
    only used for canonical links, when it corresponds to full Newton. 
    With non-canonical links PIRLS is based on full Newton. 

** Derivative iteration as in Wood (2008) has been replaced by a direct
   implicit function method (which costs no more given Newton based 
   PIRLS).

** An option `select' has been added to `gam' to allow terms to be
   completely removed from a model by smoothness selection. 

** The shrinkage smoothers "cs" and "ts" have been modified 
   substantially. The Wood (2006, 4.1.6) proposal of adding a 
   small multiple of the identity matrix to the penalty matrix 
   is flawed in that it tends to corrupt small eigen values
   of the penalty matrix for large (dimension) penalty matrices. 
   It is much better to set the zero eigenvalues of the penalty matrix 
   to a small proportion of the smallest +ve eigenvalue, and to 
   use the matrix with the resulting eigen-decomposition as the 
   penalty. This is now done. Thanks to Roman Torgovitsky for 
   reporting the original problem.

** Tweedie family added (including `ldTweedie' function to evaluate 
   log Tweedie densities for powers in (1,2]).

* "ps" "cp" and "cc" smooths can now be supplied with 2 knots to be 
  treated as `endpoints' of the smooths (full set of knots can still 
  be supplied as before).

* The `newton' optimizer was dropping terms when their gradient was 
  below the convergence threshold (and allowing re-entry). This 
  promotes zig-zagging unless the terms are independent. Now only 
  drops terms if gradient and second derivative are very small 
  (so obective is really flat). 

* The adaptive smoothing "ad" class has been greatly simplified and 2D 
  penalty improved. Much faster as a result, and 2D adaptive actually 
  quite good.

* gam.fit3 now checks that the initial PIRLS step produces an 
  improvement in penalized deviance relative to a null model. If not 
  then step halving towards the null model parameter is employed.
  The null model is as close to constant predicted values as the model
  structure allows (it is estimated up front in estimate.gam, to save 
  computation).

* `gam.side' now takes account of whether the model has an intercept 
   (or the model model matrix column corresponding to an intercept is 
   in the column space of the model matrix of the parametric model 
   components).  

* The smoothing parameter array returned by `gam' now includes names
  for the smoothing parameters.

* s and te check that `id' is a single element.

* By default, partial residuals are no longer plotted for smooths with 
  `by' variables since they are usually meaningless here (they can 
  be re-instated by argument `by.resids').
1310

1311 1312 1313 1314
* `min.sp' processing modified to work with `paraPen' argument to 
  `gam'.

* vcov.gam defaults to Bayesian covariance matrix.
1315
  
1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345
* indexing error in `parametricPenalty' corrected.

* plot.gam modified so that page change behaviour is like plot.glm 

* negbin family upgraded to work with (RE)ML.

* `sp.vcov' function added to extract covariance matrix of log 
  smoothing parameters from (RE)ML based fits.

* `power' links now handled by default fitting methods (i.e. gam.fit3)

* `magic.post.proc' now expects weights, not sqrt(weights) as the 
   `w' argument (unless `w' is a matrix).

* p-values tweaked again, for slightly better performance with smooths of 
  several variables. Still not quite right.

* record of intial sp's is now carried in `smooth' objects in field 
  `sp'.

* ?linear.functional.term error fix.

* memory leak in magic.c:magic fixed --- all fixed smoothing 
  parameters lead to 2 arrays being left unfreed.

* various .Rd file fixes.

1.4-2

* Some minor .Rd file fixes
1346

1347 1348 1349 1350 1351 1352 1353 1354 1355
1.4-1

* `Predict.matrix2' was not in NAMESPACE: fixed.

* term specific offsets handled properly w.r.t. `by' variables in 
  `smoothCon' (a rather specialized topic!)

* minor doc bug fix for `smooth.construct'.

1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493
1.4-0

*** Model terms can now include linear functionals of smooths, by 
    supplying matrix arguments and matrix `by' variables to model 
    smooth terms. This allows, for example, a model to depend on the 
    integral of a smooth function, or its derivative, or for models to 
    depend on functional  predictors. See ?linear.functional.terms. Main 
    code changes are in `smoothCon' and `predMat'.

** Smooth terms can now be linked in order that they have the same 
   smoothing parameters (and, by default, bases). Linkage is specified
   using the `id' argument to `s' or `te'. Terms with the same `id' value
   will have the same smoothing parameter(s).

** `by' variables can now be factor variables. Also smooth terms with a 
   `by' variable are only subject to a sum-to-zero constraint if it
   is needed for identifiability.

** Argument `paraPen' of `gam' allows (multiple) penalization of 
   parametric model terms. This allows `gam' to fit any model that
   can be expressed as a penalized GLM.

** p-values returned by `summary.gam' now default to a Bayesian 
   approximation which gives (substantially) better frequentist behaviour 
   than the old method.

** The 2 standard error bands for smooths shown by `plot.gam' can now
   include the uncertainty about the overall mean, by default. Such
   intervals have better coverage probability (of their target of 
   inference) than intervals for centred smooths. Argument 
   `type="iterms"' to `predict.gam' will return such standard errors.

** An adaptive smoother class has been added, for smoothing with respect
   to one or two variables: invoked with `s(...,bs="ad",...). 

** `gamm' now supports nested smooth terms, and uses the same, constraint 
   absorbed, parameterization as `gam'.

** `s' and `te' terms accept an `sp' argument setting the term specific 
   smoothing parameters (and over-riding argument `sp' of `gam'). Ignored
   by `gamm'.

** Negative binomial handling changed. `negbin' family added: adapted from 
   MASS to work with gam outer iteration fitting. `gam.negbin' fitting 
   routine added in order to enable use of `negbin' with outer iteration.
   See ?negbin for details. MASS families no longer supported. 
   `nb.theta.mult' removed from `gam.control'.

** The Eilers and Marx style p-spline class is now one of the default 
   smoothing classes, rather than just being an example of how to set up
   a class in the help file. cyclic versions are also available.

** `smoothCon' now handles `by' variables and centering constraints 
   automatically, removing the need for smooth constructors to do so.
   `PredMat' handles `by' variables automatically. Users can over-ride 
   this behaviour when adding smooth classes, if needed - see 
   documentation. 

** The interface for adding user defined smooths has been simplified, 
   but this may mean that some user defined classes which worked before
   no longer work: see ?user.defined.smooths

* `smooth.construct' methods are now expected to set default values
   for the penalty order `p.order' and the basis dimension `bs.dim'
   if none are supplied. They should also sanity check supplied 
   values. Previously this was done by `s', but this put unhelpful
   restrictions on new smooth classes.

* `smooth.construct' now expects to recieve `data' and `knots' arguments
   with names corresponding exactly to `object$term'. In addition `data'
   should contain only what is required by `object$term' + a final column
   containing a `by' variable, if present. Predict.mat expects the same of 
   its `data' argument. wrapper functions smooth.construct2 and 
   Predict.mat2 will accept a data frame containing any number of variables 
   -- all that is required is that `object$terms' can be evaluated using 
   it. These functions handle repeat rows in matrix arguments efficiently.

* bug fix in `plot.gam' -- no longer requires to hit return if `select'
  used (ever).

* bug fix in `fixDependence' --- a completely dependent `X2' would not
  be detected, since the first element of R2 would be zero: used first
  element of R1 to set scale instead.

* `gam.fit' passes corrected n to `magic' so that `n' used in gcv/ubre
   does not include obs with zero prior weight. `gam.fit3' already doing 
   this...

* `magic' and `gam.fit3' now allow log smoothing parameters to be a 
  linear transformation of a smaller set of underlying smoothing parameters.

* `mgcv' based fitting has been removed as an option in `gam', as has 
  Pearson based GCV. In consequence `am' argument removed from 
  `gam.method' and `globit' removed from `gam.control'.

* `get.var' now coerces matrix values to numeric vectors, to facilitate 
   the handling of linear functionals of smooths.

* `gam.fit2' has been removed, since gam.fit3 is simply better.

* The default optimizer for the generalized case has been made slightly 
  more efficient (derivative free evaluation of GCV/AIC has been 
  improved). The upshot is that the default is now faster than performance
  iteration in almost all cases (while still being more reliable).

* the `absorb.cons' option has been removed from `gam.control'.

* `fix.family.link' and `fix.family.var' bug fix --- only return 
   family unmodified if all required derivative functions are present.

* `smoothCon' now returns a list of smooth objects to facilitate factor
  `by' variables.

* `smoothCon' makes smooth object labels more informative, if there are 
  `by' variables... this also makes default plots more informative.

* `plot.gam' indicates `by' variables in labels

* `gamm.setup' modified to call `gam.setup' for most of the setup, leaving 
  just the re-parameterization step to do. 

* `gamm' modified to allow constraint absorption (same as `gam')

* `gamm' bug fixed whereby "cc" smooths would get the wrong null space 
  dimension (effect was small, but noticeable, in practice e.g. Cairo 
  temperature example from chapter 6 of Wood, 2006, book).

* print methods now return first argument invisibly as they should.

* code for (very) old style summary removed. 

* `gam.fit3' now traps derivative iteration divergence, and suggests 
  tightening the convergence tolerance `epsilon' in `gam.control'. 
  Divergence can happen for ill-conditioned models if the PIRLS has 
  not converged sufficiently.

* gamm.Rd updated to reflect change to gammPQL in 1.3-28.

1494 1495
1.3-31

1496 1497
* There was a most annoying warning generated by R 2.7.0 every time `gam'
  was used. Now there isn't.
1498

1499 1500
1.3-30

1501
* change to DESCRIPTION file.
1502

1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517
1.3-29

* `magic' could segfault if supplied with many constraints and relatively 
   high rank penalties, so that after constriant the penalty  matrix 
   square roots had more columns than rows (never happened in additive 
   model case, but can happen in more general settings). Fixed.

* `gamm' now silently drops grouping factors within the correlation 
   structure formulae that duplicate random effects grouping factors 
   (which automatically act as grouping factors on the correlation 
   structures anyway).

* Some replacement of dubious `as.matrix' calls with use of `,drop=FALSE]' 
  in gamm.r   

1518 1519
1.3-28

1520
** `gamm' modified to call a routine `gammPQL' in place of MASS::glmmPQL. 
1521 1522 1523 1524 1525 1526
  This avoids some duplication, and facilitates maintainance. 

* Bug fix in `formXtViX' where matrix dimensions got dropped when 
  subsetting thereby messing up variance calculations for gamm fits in 
  which some group sizes were 1. 

1527 1528
1.3-27

1529 1530 1531
** Fix of nasty bug in large dataset handling with "tp" basis (introduced 
   in 1.3-26). Subsampling code was re-seeding RNG instead of intended 
   behaviour of saving RNG state and  restoring it. Fixed and tested.
1532

1533
1.3-26
1534

1535 1536 1537 1538
* modification to `gam' so that GCV/UBRE scores reported with all fixed 
  smoothing parameters are consistent with equivalent under s.p. 
  estimation.

1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552
* gam.fit3 modified to test for convergence of coefficients as well
  as penalized deviance, otherwise in extreme cases the derivative 
  iterations can diverge.

* modifications of gam.setup, predict.gam and plot.gam to allow smooths
  to contribute an offset term to the model (offset is returned from 
  smooth.construct or Predict.matrix as an "offset" attribute of 
  model/prediction matrix). This is useful for smooths which have known 
  boundary conditions of some sort.

* PredictMat can now handle NAs in a returned prediction matrix.
 
* vis.gam can handle NA's in predictions.

1553 1554 1555 1556 1557 1558 1559 1560
** Modification of large dataset handling for "tp" and "ts" bases. If 
   there are more that 3000 unique covariate combinations for a tprs then 
   3000 combinations are randomly sub-sampled, and used as the initial 
   knots for tprs basis construction. The same random number seed is used 
   every time,  (R's RNG state is unaltered by this). Control of this is 
   usually via the `max.knots' (default 3000) and `seed' (default 1) 
   elements of the `xt' argument of `s'. In consequence, `max.tprs.knots' 
   has been removed from `gam.control'.
1561 1562 1563 1564 1565 1566 1567 1568 1569 1570

* Modification of `s' and `te' to allow an extra argument `xt' which can 
  contain extra information to pass to the basis constructors for smooths.

* removal of `full.call' from smooth.spec objects - it wasn't used 
  anywhere any more, and is a pain to maintain.

* removal of `full.formula' from the `gam' object - it is no longer used 
  anywhere and requires alot of code to construct.

1571 1572 1573 1574 1575 1576
1.3-25

* A bug in `null.space.dimension' caused prediction to fail for `s' terms 
  of 4 or more variables, unless the `m' argument was supplied explicitly 
  (and was large enough for the number of variables). Fixed. 

1577 1578 1579 1580 1581 1582 1583 1584 1585
1.3-24

* summary.gam modified so that it behaves correctly if fitting routines 
  detect and deal with rank deficiency in parameteric part of a model.

* spring cleaning of help files.

* gam.check modified to report more useful convergence diagnostics.

1586
** `model.matrix.gam' added.
1587

1588
** "cr" basis constructor modified to use the same centering conditions 
1589 1590 1591 1592 1593 1594 1595 1596
  as other bases (sum to zero over covariates, rather than parameters 
  sum to zero). This makes centred confidence intervals for smooths, of 
  the sort used in plot.gam, behave in a similar way for all bases. With 
  the old "cr" centering constraint there could be high negative 
  correlation between coefficients of a centered smooth and the intercept: 
  this could make centred "cr" smooth CIs wider than CIs for other bases 
  (not really wrong, but disconcerting).  

1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607
1.3-23

* step size correction bug fixed in gam.fit3. `Perfect' convergence could
  cause the divergence control loop to fail: the divergence control loop
  was asking for near strict decrease in the penalized deviance, which 
  could be numerically impossible to achieve if the algorithm had actually 
  converged completely.... fixed.  

* minor doc bug fixes.


1608 1609 1610 1611 1612
1.3-22

* Cheap but unneccesary code added to gdi.c and magic.c to stop 
  inappropriate uninitialized variable warnings from some compilers.

1613
** Bad bug in gam.fit3 fixed. Prior weights of zero were not handled 
1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626
  correctly - prior weight vector should have been subsetted before
  gdi call, but this didn't happen. Result was infinite derivatives
  and fit failure. fixed.

* Related bug in gam.fit3: dropped observations not handled correctly 
  in deviance calculation, which can result in inappropriate step 
  halving. fixed.

* inner loop 3 in gam.fit2 and gam.fit3 modified so that step halving 
  continues until penalized deviance is at worst non-increasing. 

* stupid bug in summary.gam, p-value calc. fixed.

1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649
1.3-21

* minor bug in gam.fit() - edf array not passed to `mgcv.find.theta'
  if method "perf.magic" used - so wrong EDF used for theta estimation 
  with neagative binomial. fixed. 

* Theta estimate added to family object of fitted gam if negative binomial 
  used...

* extract.lme.cov(2) modified to allow use with single level grouping 
  factors (not really sure when this is useful)

* bug in gam4objective called when using gam.method(outer="nlm") - never 
  used GCV.

* fixed bug in `newton' whereby immediate convergence actually caused
  routine to fail.

* modified `smoothCon' and `predictMat' so that `qrc' attribute always
  created if constraint absorption used, even if there are no constraints.
  This attribute can then be used to test that there are no unabsorbed 
  constraints (e.g. in `gam.outer').

1650 1651 1652 1653 1654 1655 1656 1657 1658 1659
1.3-20

* Bad bug in `newton' - step halving set up so that step *never* 
  accepted (it still beat all previous methods in simulations)

* Minor bug in `newton' step limiting of Newton steps reduced step
  to max component 1, rather than `maxNstep'. 

* Some documentation fixes

1660 1661
1.3-19

1662 1663 1664 1665 1666 1667
*** SUBSTANTIAL CHANGE: Improved outer iteration added via gdi.c coupled 
  with gam.fit3. Exact first and second derivatives of GACV/GCV/UBRE/AIC 
  are now available via new iteration methods. These improve the 
  speed and reliability of fitting in the *generalized* additive model 
  case. 

1668 1669 1670
* numerous changes to NAMESPACE and gamm related functions to pass
  codetools checks.

1671
** gam.method()  modified to allow GACV as an option for outer GCV 
1672 1673 1674 1675 1676 1677 1678 1679
  model selection.

* magic.c::mgcv_mmult modified so that all inner loop calculations are 
  optimal (i.e. inner loop pointers increments are all 1).

* `smooth.construct' functions for "cc" and "cr" smooths now increase `k'
  to the minimum possible value (and warn), if it's too low. 

1680
** `gam' modified to allow passing of `mustart' etc to gam.fit and 
1681 1682 1683 1684 1685
  gam.fit2, properly

* `gam' modified to fix a bug whereby fitting in two steps using argument 
  `G' could fail when some sp's are to be estimated and some fixed.

1686
** an argument `in.out' added to `gam' to allow user initialization of 
1687 1688 1689 1690
  smoothing parameters when using `outer' iteration in the generalized 
  case. This can speed up analyses that rely on several refits of the same 
  model. 

1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711
1.3-18

* gamm modifed so that weights dealt with properly if lme type varFunc 
  used. This is only possible in the non-generalized case, as gamm.Rd 
  now clarifies.

* slight modification to s() to add `width.cutoff=500' to `deparse'

* by variables not handled properly in p-spline example in 
  smooth.construct.Rd - fixed.

* bug fix in summary.gam.Rd example (pmax -> pmin)

* color example added to plot.gam.Rd

* bug fix in `smooth.construct.tensor.smooth.spec' - class "cyclic.smooth"
  marginals no longer re-parameterized.

* `te' documentation modified to mention that marginal reparameterization 
  can destabilize tensor products. 

1712 1713 1714 1715 1716
1.3-17

* print.summary.gam prints estimated ranks more prettily (thanks Martin 
  Maechler)

1717
** `fix.family.link' can now handle the `cauchit' link, and also appends a
1718 1719 1720 1721 1722
   third derivative of link function to the family (not yet used).

* `fix.family.var' now adds a second derivative of the link function to 
   the family (not yet used).

1723 1724
** `magic' modified to (i) accept an argument `rss.extra' which is added 
  to the  RSS(squared norm) term in the GCV/UBRE or scale calculation; (ii)
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734
  accept argument `n.score' (defaults to number of data), the number to 
  use in place of the number of data in the GCV/UBRE calculation.
  These are useful for dealing with very large data sets using 
  pseudo-model approaches.

* `trans' and `shift' arguments added to `plot.gam': allows, e.g. single
   smooth models to be easily plotted on uncentred response scale.

* Some .Rd bug fixes. 

1735 1736
** Addition of choose.k.Rd helpfile, including example code for diagnosing 
   overly restrictive choice of smoothing basis dimension `k'.
1737

1738 1739 1740 1741 1742
1.3-16

* bug fix in predict.gam documentation + example of how to predict from a 
  `gam' outside `R'.

1743 1744
1.3-15

1745 1746 1747
* chol(A,pivot=TRUE) now (R 2.3.0) generates a warning if `A' is not +ve 
  definite. `mroot' modified to supress this (since it only calls 
  `chol(A,pivot=TRUE)' because `A' is usually +ve semi-definite). 
1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758

1.3-14

* mat.c:mgcv_symeig modified to allow selection of the LAPACK routine
  actually used: dsyevd is the routine used previously, and seems very 
  reliable. dsyevr is the faster, smaller more modern version, which it
  seems possible to break... rest of code still calls dsyevd.

* Symbol registration added (thanks largely to Brian Ripley). Version 
  depends on R >= 2.3.0

1759 1760 1761 1762
1.3-13

* some doc changes

1763
** The p-values for smooth terms had too low power sometimes. Modified 
1764 1765 1766 1767 1768 1769
  testing  procedure so that testing rank is at most 
  ceiling(2*edf.for.term). This gives quite close to uniform p-value 
  distributions when the null is true, in simulations, without excessive 
  inflation of the p-values, relative to parametetric equivalents when 
  it is not. Still not really satisfactory.

1770 1771 1772 1773 1774 1775 1776 1777 1778
1.3-12

* vis.gam could fail if the original model formula contained functions of 
  covariates, since vis.gam calls predict.gam with a newdata argument 
  based on the *model frame* of the model object. predict.gam now 
  recognises that this has happened and doesn't fail if newdata is a model 
  frame which contains, e.g. log(x) rather than x itself. offset handling 
  simplified as a result.

1779
* prediction from te smooths could fail because of a bug in handling the 
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790
  list of re-parameterization matrices for 1-D terms in 
  Predict.matrix.tensor.smooth. Fixed. (tensor product docs also updated)

* gamm did not handle s(...,fx=TRUE) terms properly, due to several 
  failures to count s(...,fx=FALSE) terms properly if there were fixed 
  terms present. Now fixed.

* In the gaussian additive mixed model case `gamm' now allows "ML" or 
  "REML" to be selected (and is slightly more self consistent in 
  handling the results of the two alternatives).

1791 1792 1793 1794 1795 1796 1797
1.3-11

* added package doc file

* added French error message support (thanks to Philippe Grosjean), and 
error message quotation characters (thanks to Brian Ripley.)

1798 1799 1800 1801 1802 1803
1.3-10

* a `constant' attribute has been added to the object returned by
  predict.gam(...,type="terms"), although what is returned is still not an 
  exact match to what `predict.lm' would do. 

1804
** na.action handling made closer to glm/lm functions. In particular,
1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818
  default for predict.gam is now to pad predictions with NA's as opposed
  to dropping rows of newdata containing NA's. 

* interpret.gam had a bug caused by a glitch in the terms.object 
  documentation (R <=2.2.0). Formulae such as y ~ a + b:a + s(x) could 
  cause failure. This was because attr(tf,"specials") is documented as 
  returning indices of specials in `terms'. It doesn't, it indexes 
  specials in the variables dimension of the attr(tf,"factors") table: 
  latter now used to translate.

* `by' variable use could fail unreasonably if a `by' variable was not of 
  mode `numeric': now coerced to numeric at appropriate times in smooth
  constructors. 

1819 1820 1821 1822 1823 1824 1825 1826
1.3-9

* constants multiplying TPRS basis functions were `unconventional' for d 
  odd in function eta() in tprs.c. The constants are immaterial if you are 
  using gam, gamm etc, but matter if you are trying to get out the 
  explicit representation of a TPRS term yourself (e.g. to differentiate 
  a smooth exactly).

1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846
1.3-8

* get.var() now checks that result is numeric or factor (avoids 
  occasional problems with variable names that are functions - e.g `t')

* fix.family.var and fix.family.link now pass through unaltered any family 
  already containing the extra derivative functions. Usually, to make a 
  family work with gam.fit2 it is only necessary to add a dvar function.

* defaults modified so that when using outer iteration, several performance
  iteration steps are now used for initialization of smoothing parameters 
  etc. The number is controlled by gam.control(outerPIsteps). This tends
  to lead to better starting values, especially with binary data. gam, 
  gam.fit and gam.control are modified.

* initial.sp modified to allow a more expensive intialization method, but
  this is not currently used by gam.

* minor documentation changes (e.g. removal of full stops from titles)

1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859
1.3-7

* change to `pcls' example to account for model matrix rescaling changing 
smoothing parameter sizes.

* `gamm' `control' argument set to use "L-BFGS-B" method if `lme' is using 
`optim' (only does this if `nlminb' not present). Consequently `mgcv' now 
depends on nlme_3.1-64 or above.

* improvement of the algorithm in `initial.sp'. Previously it was possible 
for very low rank smoothers (e.g. k=3) to cause the initialization to 
fail, because of poor handling of unpenalized parameters. 

1860 1861 1862 1863 1864 1865 1866
1.3-6

* pdIdnot class changed so that parameters are variances not standard 
deviations - this makes for greater consistency with pdTens class, and 
means that limits on notLog2 parameterization should mean the same thing 
for both classes. 

1867
** niterEM set to 0 in lme calls. This is because EM steps in lme are not
1868 1869
 set up to deal properly with user defined pdMat classes (latter 
 confirmed by DB).
1870 1871 1872

1.3-5

1873
** Improvements to anova and summary functions by Henric Nilsson 
1874 1875 1876 1877 1878 1879 1880 1881 1882 1883
  incorporated. Functions are now closer to glm equivalents, and 
  printing is more informative. See ?anova.gam and ?summary.gam.

* nlme 3.1-62 changed the optimizer underlying lme, so that indefintie 
  likelihoods cause problems. See ?logExp2 for the workaround.
  - niterEM now reset to 25, since parameterization prevents parameters 
  wandering to +/- infinity (this is important as starting values for 
  Newton steps are now more critical, since reparameterization 
  introduces new local minima).

1884
** smoothCon modified to rescale penalty coefficient matrices to have 
1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896
  similar `size' to X'X for each term. This is to try and ensure that 
  gamm is reasonably scale invariant in its behaviour, given the 
  logExp2 re-parameterization.

* magic dropped dimensions of an array inapproporiately - fixed.

* gam now checks that model does not have more coefficients than data.

1.3-4

* inst/CITATION file added. Some .Rd fixes

1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925
30/6/2005 1.3-3

* te() smooths were not always estimated correctly by gamm(): invariance 
  lost and different results to equivalent s() smooths. The problem seems
  to lie in a sensitivity of lme() estimation to the absolute size of the 
  `S' attribute matrices of a pdTens class pdMat object: the problem did 
  not occur at the last revision of the pdTens class, and there are no 
  changes logged for nlme that could have caused it, so I guess it's down
  to a change in something that lme calls in the base distribution. 
  To avoid the problem, smooth.construct.tensor.smooth.spec has been 
  modified to scale all marginal penalty matrices so that they have 
  largest singular value 1.

* Changes to GLMs in R 2.1.1 mean that if the response is an array, gam 
  could fail, due to failure of terms like w * X when w is and array 
  rather than a vector. Code modified accordingly.

* Outer iteration now suppresses some warnings, until the final fitted
  model is obtained, in order to avoid printing warnings that actually
  don't apply to the final fit.

* Version number reporting made (hopefully) more robust.

* pdconstruct.pdTens removed absolute lower limit on coef - replaced with
  relative lower limit.

* moved tensor product constraint construction to BEFORE by variable
  stuff in smooth.construct.tensor.smooth.spec.

1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757
1.3-1

* vcov had been left out of namespace - fixed.

* cr and cc smooths now trap the case in which the incorrect number of 
  knots are supplied to them.

* `s(.)' in a formula could cause a segfault, it get's trapped now, 
  hopefully it will be handled nicely at some point in the future. Thanks 
  Martin Maechler.

* wrong n reported in summary.gam() in the generalized case - fixed. 
  Thanks YK Chau. 

1.3-0

*** The GCV/UBRE score used in the generalized case when fitting by 
  outer iteration (the default) in version 1.2 was based on the Pearson 
  statistic. It is prone to serious undersmoothing, particularly of binary 
  data. The default is now to use a GCV/UBRE score based on the deviance: 
  this performs much better, while still maintaining the enhanced 
  numerical convergence performance of outer iteration.

* The Pearson based scores are still available as an option (see 
  ?gam.method)

* For the known scale parameter case the default UBRE score is now 
  just a linearly rescaled AIC criterion. 

1.2-6

* Two bugs in smooth.sconstruct.tensor.smooth.spec: (i) incorrect 
  testing of class of smooth before re-parameterizing, so that cr smooths 
  were re-parameterized, when there is no need to; (ii) knots used in 
  re-parameterization were based on quantiles of the relevant marginal 
  covariate, which meant that repeated knots could be generated: now uses 
  quantiles of unique covariate values.

* Thanks to Henric Nilsson a bug in the documentation of magic.post.proc has 
  been fixed. 

1.2-5

** Bug fix in gam.fit2: prior weights not subsetted for non-informative 
  data in GCV/UBRE calculation. Also plot.gam modified to allow for 
  consequent NA working residuals. Thanks to B. Stollenwerk for reporting 
  this bug.

** vcov.gam written by Henric Nilsson included... see ?vcov.gam

* Some minor documentation fixes.

* Some tweaking of tolerances for outer iteration (was too lax).

** Modification of the way predict.gam picks up variables. 
  (complication is that it should behave like other predict functions, but 
  warn if an incomplete prediction data frame is supplied -since latter 
  violates what white book says). 

1.2-2

*** An alternative approach to GCV/UBRE optimization in the 
  *generalized* additive model case has been implemented. It leads to more 
  reliable convergence for models with concurvity problems, but is slower 
  than the old default `performance iteration'. Basically the GAM IRLS 
  process is iterated to convergence for each trial set of smoothing 
  parameters, and the derivatives of the GCV/UBRE score w.r.t. smoothing 
  parameters are calculated explicitly as part of the IRLS iteration. This 
  means that the GCV/UBRE optimization is now `outer' to the IRLS 
  iteration, rather than being performed on each working model of the IRLS 
  iteration. The faster `performance iteration' is still available as an 
  option. As a side effect, when using outer iteration, it is not possible 
  to find smoothing parameters that marginally improve on the GCV/UBRE 
  scores of the estimated ones by hand tuning: this improves the logical 
  self consistency of using GCV/UBRE scores for model selection purposes.

* To facilitate the expanded list of fitting methods, `gam' now has a 
  `method' argument requiring a 3 item list, specifying which method to 
  use for additive models, which for generalized additive models and if using 
  outer iteration, which optimization routine to use. See ?gam.method for 
  details. `gam.control' has also been modified accordingly.
    
*** By default all smoothing bases are now automatically 
  re-parameterized to absorb centering constraints on smooths into the 
  basis. This makes everything more modular, and is usually user 
  transparent. See ?gam.control to get the old behaviour.
    
** Tensor product smooths (te) now use a reparameterization of the 
  marginal smoothing bases, which ensures that the penalties of a tensor 
  product smooth retain the interpretation, in terms of function shape, of 
  the marginal penalties from which they are induced. In practice this 
  almost always improves MSE performance (at least for smooth underlying 
  functions.) See ?te to turn this off.
    
*** P-values reported by anova.gam and summary.gam are now based on 
  strictly frequentist calculations. This means that they are much better 
  justified theoretically, and are interpretable as ordinary frequentist 
  p-values. They are still conditional on smoothing parameters, however, 
  and are hence underestimates when smoothing parameters have been 
  estimated.

** Identifiability side conditions modified to work with all smooths 
  (including user defined). Now works by identifying possible dependencies 
  symbolically, but dealing with the resulting degeneracies numerically. 
  This allows full ANOVA decompositions of functions using tensor product 
  smooths, for example.

* summary.gam modified to deal with prior weights in adjusted r^2 
  calculation.
    
** `gam' object now contains `Ve' the frequentist covariance matrix of 
  the paremeter estimators, which is useful for p-value calculation. see 
  ?gamObject and ?magic.post.proc for details.

* Now depends on R >=2.0.0
    
* Default residual plots modified in `gam.check'
    
** Added `cooks.distance.gam' function.
    
* Bug whereby te smooths ignored `by' variables is now fixed. 

1.1-6

* Smoothing parameter initialization method changed in magic, to allow 
  better initialization of te() terms. This affects default gam fits.
    
* gamm and extract.lme.cov2 modified to work correctly when the 
  correlation structure applies to a finer grouping than the random 
  effects. (Example of this added to gamm help file)
    
* modifications of pdTens class. pdFactor.pdTens now returns a vector, 
  not a matrix in accordance with documentation (in nlme 3.1-52). Factors 
  are now always of form A=B'B (previously, could be A=BB') in accordance 
  with documentation (nlme 3.1-52). pdConstruct.pdTens now tests whether 
  initializing matrix is proportional to r.e. cov matrix or its inverse 
  and initializes appropriately. gamm fitting with te() class tested 
  extensively with modifications and nlme 3.1-52, and lme fits with pdTens 
  class tested against equivalent fits made using re-parameterization and 
  pdIdent class. In particular for gamm testing : model fits with single 
  argument te() terms now match their equivalent models using s() terms; 
  models fitted using gam() and gamm() match if gam() is called with the 
  gamm() estimated smoothing parameters.
   
* modifications of gamm() for compatibility with nlme 3.1-52: in 
  particular a work around to allow everything to work correctly with a 
  constructed formula object in lme call.
  
* some modifications of plot.gam to allow greater control of 
  appearance of plots of smooths of 2 variables.
  
* added argument `offset' to gam for further compatibility with 
  glm/lm.
  
* change to safe prediction for parameteric terms had a bug in offset 
  handling (offset not picked up if no newdata supplied, since model frame 
  not created in this case). Fixed. (thanks to Jim Young for this) 1.1-5
    
* predict.gam had a further bug introduced with parametric safe 
  prediction. Fixed by using a formula only containing the actual variable 
  names when collecting data for prediction (i.e. no terms like 
  `offset(x)') 

1.1-5

* partial argument matching made col.shade be matched by col passed in 
..in plot.gam, taking away user control of colors. 1.1-5
    
* 2d smooth plotting in plot.gam modified.

* plot.gam could fail with residuals=TRUE due to incorrect counting in 
  the code allowing use of termplot. plot.gam failed to prompt before a 
  newpage if there was only one smooth. gam and gamm .Rd files updated 
  slightly. 

1.1-3

* extract.lme.cov2 could fail for random effect group sizes of 1 
  because submatrices with only a row or column lose their dimensions, and 
  because single number calls to diag() result in an identity matrix. 

1.1-2

* Some model formulae constructed in interpret.gam and used in 
  facilitating safe prediction for parametric terms had the wrong 
  environment - this could cause gam to fail to find data when e.g. lm, 
  would find it. (thanks Thomas Maiwald)
  
* Some items were missing from the NAMESPACE file. (thanks Kurt 
  Hornik)
    
* A very simple formula.gam function added, purely to facilitate 
  better printing of anova method results under R 2.0.0. 

1.1-1

* Due, no doubt, to gross moral turpitude on the part of the author, 
  gamm() calculated the complete estimated covariance matrix of the 
  response data explicitly, despite the fact that this matrix is usually rather 
  sparse. For large datasets this could easily require more memory than 
  was available, and huge computational expense to find the choleski 
  decomposition of the matrix. This has now been rectified: when the 
  covariance matrix has diagonal or block diagonal structure, then this is 
  exploited.
    
* Better examples have been added to gamm().
    
* Some documentation bugs were fixed. 

1.1-0

Main changes are as follows. Note that `gam' object has been modified, so 
old objects will not always work with version 1.1 functions.

** Two new smooth classes "cs" and "ts": these are like "cr" and "tp" 
  but can be penalized all the way down to zero degrees of freedom to 
  allow fully automatic model selection (more self consistent than having a 
  step.gam function).
 
* The gam object expanded to allow inheritance from type lm and type 
  glm, although QR related components of glm and lm are not available 
  because of the difference in fitting method between glm/lm and gam.

** An anova method for gam objects has been added, for *approximate* 
  hypothesis testing with GAMs.
  
** logLik.gam added (logLik.glm with df's fixed): enables AIC() to be 
  used with gam objects.
  
** plot.gam modified to allow plotting of order 1 parametric terms via 
  call to termplot.
    
* Thanks to Henric Nilsson option `shade' added to plot.gam
    
* predict.gam modified to allow safe prediction of parametric model 
  components (such as poly() terms).
    
* predict.gam type="terms" now works like predict.glm for parametric 
  components. (also some enhancements to facilitate calling from 
  termplot())
    
* Range of smoothing parameter estimation iteration methods expanded 
  to help with non-convergent cases --- see ?gam.convergence
    
* monotonic smoothing examples modified in light of above changes.
    
* gamm modified to allow offset terms.
    
* gamm bug fixed whereby terms in a model formula could get lost if 
  there were too many of them.
    
* gamm object modified in light of changes to gam object. 

1.0-7

* Allows a model frame to be passed as `newdata' to predict.gam: it 
  must contain all the terms in the gam objects model frame, `model'.
    
* vis.gam() now passes a model frame to predict.gam and should be more 
  robust as a result. `view' and `cond' must contain names from 
  `names(x$model)' where x is the gam object. 

1.0-6/5/4

* partial residuals modified to be IRLS residuals, weighted by IRLS 
  weights. This is a much better reflecton of the influence of residuals 
  than the raw IRLS residuals used before.
    
* gamm summary sorted out by using NextMethod to get around fact that 
  summary.pdMat can't be called directly (not in nlme namespace exports).
    
* niterPQL and verbosePQL arguments added to gamm to allow more 
  control of PQL iteration.
    
* backquote=TRUE added when deparsing to allow non-standard names. 
  (thanks: Brian Ripley)
    
* bug in gam corrected: now gives correct null deviance when an offset 
  is present. (thanks: Louise Burt)
    
* bug in smooth.construct.tp.smooth.spec corrected: k=2 caused a 
  segfault as the C code was reseting k to 3 (actually null space 
  dimension +1), and not enough space was being allocated in R to handle 
  the resultng returned objects. k reset in R code, with warning. (Thanks: 
  Jari Oksanen)
    
* predict.gam() now has "standard" data searching using a model frame 
  based on a fake formula produced from full.formula in the fitted object. 
  However it also warns if newdata is present but incomplete. This means 
  that if newdata does not meet White book specifications, you get a 
  warning, but the function behaves like predict.lm etc. predict.gam had 
  been segfaulting if variables were missing from newdata (Thanks: Andy 
  Liaw and BR)
    
* contour option added to vis.gam
    
* te smooths can be forced to use only a single penalty (theoretical 
  interest only - not recommended for practical use) 

1.0-3

* Fixes bugs in handling graphics parameters in plot.gam()
    
* Adds option of partial residuals to plot.gam() 

1.0-2/1

* Fixes a bug in evaluating variables of smooths, knots and by-variables.

1.0-0

*** Tensor product smooths - any bases available via s() terms in a gam 
  formula can be used as the basis for tensor product smooths of multiple 
  covariates. A separate wiggliness penalty and smoothing parameter is 
  associated with each `marginal' basis.
    
** Cyclic smoothers: penalized cubic regression splines which have the 
  same value and first two derivatives at their first and last knots.
    
*** An object oriented approach to handling smooth terms which allows 
  the user to add their own smooths. Smooth terms are constructed