| NEWS | R Documentation |
NEWS file for the survival package
Changes in version 3.8-2
Round 2 of updates, to pass reverse dependency checks. In3.8-1 I had made a silly copy-paste mistake in the update tosurvfit, and also added a new test for my changes (doublecolon.R).Of course, the only check that I forgot to include in thedoublecolon file was for ... survfit (coxph, survdiff, survreg,survcheck, and concordance were all there).
Changes in version 3.8-1
Changes needed to pass reverse dependency checks, largelytightening things up wrt to the formula fix. In summary, thesurvival package routines now ensure that anything in a formula thatis a part of the package, is found in the package first. There isno need for things like coxph(survival::Surv(time, status) ~ ph.ecog+ survival::strata(inst), data=lung), in fact you should not dothis. Using survival::coxph rather than coxph is a completelydifferent question, these updates have no bearing on that, only onfunctions within a formula. Note that prior to this update usingsurvival::strata(inst) above would give the wrong answer; because ::mucks up formula processing the term would not be recognized as astratum, and the resulting fit equivalent to using factor(inst).
Changes in version 3.8-0
Survival curves which used the id option, for a coxph fit withtime dependent coefficients, would have too small a std error afterthe transition. Github issue 282
Error in the robust variance in survreg, when there were caseweights. (Forgot the weighted=TRUE argument to an internal residcall.) Github issue 287
Fix an oversight in anova.coxph. A comparison of a stratifiedto an unstratified model is not valid; it now checks for this andissues an error. Also, very long variable names would crash anova.
Extend the fix to strata of 3.7-3. Now Surv, strata, cluster,and pspline calls internal to a coxph, survfit, survreg, survdiff,or concordance formula are forced to be internal to the survivalpackage, and will not accidentally pick a local copy of thefunction.
Changes in version 3.7-3
Incorporate a copy of strata() local to coxph, somethingalready done with tt(), so that using strata() in a formula does notsearch for the function. Also, preprocess any coxph formula to replacesurvival::strata() with strata() and likewise with cluster(). Thereason for this is that strata is a special in coxph formulas (seethe specials argument to the terms function) and will not beproperly recognized when survival:: is prepended.
Update survreg6.c. If the first Newton-Raphson step wasparticularly bad the trial solution could have NA or NaN values forthe loglikelihood, first, and/or second derivatives. The"is this solution worse than the prior one" test was not pickingthis up to initiate step halving. Github issue 263.
Changes in version 3.7-2
The change to ties documented below for 3.4.2 actually neverhappened, due to a typo. Now fixed. This forced multiple additionsof ties='breslow' to the test suite, when comparing multi-state tosingle state fits.
Fix an inconsistency: survfit would label a transition fromstate 1 to 3 as "1.3", coxph as "1:3". Use a colon in both places.
Changes in version 3.7-1
Update survreg to allow an interval of (0,t) for the Weibull,lognormal, and other distributions with lower bound of 0. (Internally,it replaces these with the equivalent left censored value.)Addresses github issue 234.
Change the default confidence intervals to "plain" for plotsof the cumulative hazard, which concurs with the default of "log" forthe survival curve.
Add the braking data as part of the 'reliability' bundle.
Add the cumprob option to plot.survfit and lines.survfit. Itis applicable to multi-state models.
Add cex and pch options to plot.cox.zph.
Changes in version 3.7-0
Add n.id element to the coxph object, for a call that uses theid argument
Remove as.integer.Surv and as.numeric.Surv; essentially treat Surv asa matrix for this purpose. (The as.numeric.Surv method never worked anyway, asit should have been as.double.Surv).
Run all tests and submit to CRAN
Changes in version 3.6-5
Update nearly all uses of partially matched arguments, e.g.,fit$coef to fit$coefficients. (MichaelChirico)
Fix error in concordance for a coxph model with (time1, time2)data and timewt='S'. Add new test to tests/concordance3.R. Errorpointed out by Shaunson26.
Begin movement of many vignettes to the survivalVignettespackage. See the "other vignettes" vignette stub for moreinformation.
Fix error in predict.coxph pointed out by JuliannaHarwood. Add text to the help file to clarify prediction at per-subjectvs a global time. Add new test file predsurv.R
Add a data.frame option to summary.survfit and summary.survfitms;it causes the result to be in data frame form.
Changes in version 3.6-4
Oversight in final CRAN submission, change version number andresubmit
Changes in version 3.6-3
Fix small bug in residuals.survfit wrt labeling rows of theoutput. Update helpfile to describe the dimnames.
Submit to CRAN
Changes in version 3.6-2
Change survfitaj.c to avert a spurious compiler warning whichmade the CRAN input unhappy
Changes in version 3.6-1
Major update to survfit routines. Infinitesimal jackknife (IJ)residuals are now primarily computed using the residuals() functionpost fit, de-emphasizing return of an influence component from thefit, with significant work to make the residuals functioncomputationally efficient. New tests for many edge cases.
Addition of a "methods" vignette to more fully documentformulas and code, begining a move away from noweb documentation.
Add test case for the 'extended KM', one where subjects changearms in mid-stream. (I'm not a fan, but some advocate it.) Thisuncovered some inconsistencies in the n.risk and n.censor values;the survival estimates themselves were correct. For a subject with dataof (1, 5+), (5, 7), say, there is no "censor" at time 5; the prior codesometimes emited an unneeded output line for such rows.
Add n.id to the survfit object= number of unique id valuesused in creating a curve; available when the survfit call containsan id argument. This is used as "n" in the default printout.Useful when a subject spans multiple rows.
Add a new option to survfit. If
entry=TRUEthe outputwill containn.enter= the number of entries at this time;new rows are added for each unique entry time. The default optionof FALSE creates rows only at event/censor times; the historical behavior.Fix a bug in survfit.coxph. If the start.time option resultedin 0 subjects for a curve it didn't catch it properly.
Update the US and Minnesota rate tables, adding years up to2020.
Updates to the Aalen-Johansen, i.e., survfit when 'status' isa factor variable. 1. If case weights varied between rows in thesame cluster, the infinitesimal jackknife could be wrong and hencethe variance incorrect. 2. n.censor is now reported per state 3. newelements of n.transtions and count.
Changes in version 3.5-7
Improve the algorithm for score residuals from O(ndp) toO((n+d)p), where n= number of observations, d= number of events, p =number of covariates. For large data sets this can have a substantialimpact. (Score residuals are used for robust variance.)
Add short vignette on how we compute mulitstate Cox modelcurves.
13Aug23, check dependent CRAN packages (860) and submitto CRAN
Changes in version 3.5-6
Fix error in a (time1, time2) coxph model with both strata andtt() terms; pointed out by Pierre Joly. Add a new test case forthis to the tests directory.
Small update to coxph prompted by a user query: for a modelwith an offset, the mean offset is no longer subtracted from thelinear.predictor component. This make it agree with predict.coxph.
Add the brier function, along with tests and a new vignette.Update rttright and strengthen the tests.
Update coxph.detail; the roder argument now applies to the x,y, and riskmat components.
Changes in version 3.5-5
Add the hoel data set, cancer in irradiated male mice, foundin Kalbfleisch and Prentice. It is useful for illustratingcompeting risks.
Update some S3 methods in NAMESPACE, and rename theinternal terms.inner function to innerterms. Both were generatingwarnings with the latest CRAN check suite.
Submit to CRAN
Changes in version 3.5-4
Update the help file for the finegray command. It wasincorrect with respect to time-dependent covariates.
Add model= as an option to survfit, and add amodel.frame.survfit method. These are needed to call thesurvfit/pseudo pair inside another function.
Small bug in survfit: if start.time was present, the 'type' elementcould be missing from the output object.
Enhance the concordance command: one can now put multiplepredictions on the right hand side of the equation; this will givethe set of concordances and their variance-covariance matrix.
Add a couple of overlooked S3 methods to the NAMESPACE
Changes in version 3.5-3
Fix final compiler warnings that affect CRAN
Restore backwards compatability for ratetable() calls in aformula. The feature is used by the relsurv package.
Add information on trust regions to the fail directory.
Changes in version 3.5-2
New release for CRAN; chase down some challenging (for me)C-code memory issues
Clean up test case for drop.special
Changes in version 3.5-1
Minor edits to survreg (fit$coef to fit$coefficients) andsummary.coxph (a model with only an offset)
Fix error in fastkm.c (new routine, edge case, no one hadfound it yet.)
Fix a few niggles in .c code, found by the new compiler chain
Remove backwards compatability for ratetable() calls in aformula; this was changed in the main code many years ago.
Changes in version 3.5-0
Final check and updates for CRAN submission
Changes in version 3.4-2
For a multi-state coxph model, the default is nowties='breslow'. When there is a tied transition of the same type, A:Band A:B say, the Efron approx is justified and was correctly computed.However, ties of different types such as an A:B and A:C (competing risks)transition at the same time or A:B and C:D are effectively ignoredby the code; and this would be very hard to change. Using Breslowrather than a partial Efron was felt to be more defensible.
Add the survcondense function.
Improve tmerge handling of a wide data set and add a test casefor it. Add a caution to the vignette wrt using wide data sets.
Improve the speed of concordance (request of Frank H). Updatethe vignette and add more tests.
Fix bug in cox.zph: if there was any NA coefficient in thecoxph fit, the residuals used for the plot would also be NA.
Run all tests and submit to CRAN (2023-01-06)
Changes in version 3.4-1
Add newdata argument to basehaz, along with more documentation
survfit.coxph would fail for the combination of newdata and amodel with only an offset term, fixed
Add a check to pseudo. The algorithm was not designed for asurvfit curve from interval censored data, but still produced aresult (assuredly an incorrect one). Interval censored curves nowhave type='interval' to help support this.
Predict.coxph with reference='zero' and missing newdataincorrectly assumed it could simply return fit$residuals. Pointedout by David Collett.
Change the prototype in a few .c routines, per a request fromCRAN. (chinv.c for instance was using the old K&R style declaration,which shows how long ago it was written.)
Check and submit to CRAN
Changes in version 3.4-0
Replace .[terms call in predict.coxph with drop.term();due to an error in [.term discovered by Jorge Menezes. Adddropterm.R to the test suite.
Fix all errors in R CMD check, and submit to CRAN
Changes in version 3.3-2
Error in concordance(fit, newdata) if newdata had missingvalues: the derived x and y could be different lengths.
Add test cases for the (rather difficult) case of predictedsurvival for multi-state coxph model that has shared hazards
nsk(..., Boundary.knots=FALSE) was not being handled properly.
Fix error in terms.inner; it failed for a function with noarguments. Pointed out by Daniel Sjberg and Duncan Murdoch.
Remove Sint from C code.
anova.coxph sometimes used P(>Chi) and somtimes Pr(>Chi) as aprintout label, depending on the argument; the base packages all use"Pr". Changed this to be consistent.
Changes in version 3.3-1
Update the saved tests/Examples/survival-Ex.Rout.save file soas to remove timings, at the behest of CRAN. (Footnote 21 in thepackages manual talks about this.)
Changes in version 3.3-0
Change any calls to Calloc or Free in the C code to R_Callocand R_Free, at the request of R core.
Fix an oversight in aareg: when coxph and survreg wereconverted from using +cluster() in a formula to cluster as anargument, that same change needed to be made in aareg. Pointed outby zdgager.
The std of the cumulative hazard is now present, for selectcases of a coxph model curve. More work remains to be done toreturn the std for all cases.
Add a paragraph to the help page for survfit.Rd, pointing outthat robust variance is now the default for interval censored data,and why.
Add the median.survfit method
Improve the examples in pseudo.Rd
Fix error in survreg.distributions$gaussian$deviance. Thedeviance of an interval censored observation was NA due to a signthat was backwards, leading to log of a negative value. (Simpletypo.)
Error in predict.coxph: it would fail for a model that had twostrata terms. Reported by Hanna Frick.
Fix github issue 130. If newdata contained the stratainformation, and there was only one curve requested, survfit.coxphwould return too many curves.
Changes in version 3.2-15
Fix an inconsistency with the start.time argument. One ofthe survfit paths would include an event at start.time (curve startswith an immediate drop) others did not. All paths now do so. Thismakes start.time=0 behave the same as ordinary survfit, without theargument, when there is a death at time 0.
Changes in version 3.2-14
Update the royston function to report the scaled Cox-SnellR-squared as the Nagelkerke estimate, and clarify the documentation.
Update for coxph with ties=exact, for the case of an infinitecoefficient where the information matrix becomes singular. Code forthis case had been developed for coxfit6.c (Breslow/Efron) but notreplicated in coxexact.c
Changes in version 3.2-13
Clarify some sentences in tmerge help file.
Fix a memory access error in concordance3.c, found by CRAN.
Add the drop.special function (internal) to work around offsetproblems in [.terms.
Changes in version 3.2-12
Avoid a downstream error from infinte coefficients incoxph. In special case it would fail by passing an NA to C code.
The df column from cox.zph could be incorrect for a coxmemodel.
cox.zph would crash for a coxme model whose random effectcontained a factor (odd issue with model.frame).
yates error for a coxph model with a strata * covariateinteraction
Clarify documentation for the royston command.
Add error for survexp applied to a multistate model.
Make the labeling of restricted mean consistent in print andsummary, for single state and multistate survfit.
With just the right data the coxexact.c routine would do avery inefficient calculation: so slow it appeared to be an infiniteloop.
Bug in pspline.R: I had neglected to include 'degree' in theretained arguments for makepredictcall.
Fix scale factor error in cholesky3.c, which could cause it toincorrectly mark a column as singular. Found via a survreg examplefrom Nathan Adams, where y had large values.
2021-08-12: update CRAN
Changes in version 3.2-11
Missing labels for the "pairwise" option in yates(), fixed.
Bug in plot.survfit – could not use conf.int=T and xmax inthe same call. Pointed out by Dirk Larson.
Failure of survfit, when applied to a multi-state coxph model withstrata(). Repaired and added this as a test case.
Change seq(along= to seq(along.with=, to match the completeargument name.
In pyears(...,data.frame=TRUE), if the levels of a tcut arenumeric return a numeric rather than a factor. (Version 2.4 featurethat had been inadvertently removed.)
Fix mistake in survfit.coxphms(..., stype=1): had pmin when Imeant pmax. (Resulting curves were not even close.) Add a testcase.
update anova.survreg to have class("anova", "data.table").Error pointed out by Daniel Sjoberg.
Changes in version 3.2-10
CRAN valgrind checks discovered an uninitialized vector inone of the C routines. Now fixed. Updated version is now on CRAN.
Changes in version 3.2-9
More careful tests of the rttright function.
Fix bug in tmerge that was introduced in 3.2-8. A newconsistency check was too aggressive and would flag a legal dataset.
Fix tmerge bug reported by E Lundt: if two or more additionswere before the start of a subject's timeline, tdc would pick thefirst rather than the last.sou
Add the last test case for residuals.survfit (auc for tstart,tstop data), and yes, it uncovered an error.
Error in survit.coxph for a multistate fit with strata, an arraydimension was wrong (but contents correct). It led to downstreamproblems with print and plot. Pointed out by Matthew Hall.
Add ability for a multistate coxph model to have shared(proportional) baselines for transitions.
The coxph routine no longer recenters 0/1 predictors (fit$meanwill be 0), per the default value of the new
nocenterargument. Application of survfit to a coxph model without specifyingnewdata remains a bad idea, but this change makes it a littleless bad since for factors the curve will refer to the referencelevel. The results of predict(fit) are now more defensible for afactor variable.Add an explicit error message for survreg() with a frailtyterm. This usage was never supported – it is integrating out theappropriate density for a coxph model, which is the wrong one forsurvreg – but because the code would run we've found that peopleassumed it must be right, despite a statement to the contrary in thesurvival vignette. Long overdue fix.
Changes in version 3.2-8
In tmerge, if data2 contains identifiers not found in data1these rows are now counted in the "missid" column of the tcountattribute, rather than treated as an error.
In a survfit() call with the start.time option, if one curvehad no subjects past the start time the dim of the result was wrong,leading to multiple downstream failures.
Add a scale argument to quantile.survfit.
Revert a change to plot.survfit, which was the use of clip() tokeep lines away from the right margin. This had some unforseen downstreamconsequences, e.g., later addition of a legend.
Minor fix to survcheck: if the events table had only 1 row thematrix property was lost. Pointed out by Oleguer Plana-Ripoll.
Error in plot.survfit: the noplot argument had been overlookedfor the confidence intervals, and the wrong interval could be matched toeach curve.
The neardate routine implicitly assumed that data set 2 was insorted order, if it is not an error message ensues from the internalcall to findInterval. Now repaired and a new test added. Pointedout by Bruce Macwilliams.
Add an error message to survfit recognizing that it can notyet deal with multistate coxph models that have shared baselinehazards.
Add the pseudo function for psuedo-values. The vignette is invignette2 since it uses svyglm (survey) to get proper standarderrors (see the 'other' vignette).Add supporting routine residuals.survfit (which does the real work.)
Add the nsk function.
Add the aggregate.survfit method
Formally depricate survConcordance, replaced with the more capableconcordance method which has formula, lm, glm, and coxph methods.
Changes in version 3.2-7
Fix one URL, revealed by the CRAN submission.
Column labels had been lost on the riskmat argument ofcoxph.detail, which broke the linERR package. Found in reversedependency checks for CRAN.
Changes in version 3.2-5
Fix error in summary.coxph.penal; it was incorrectly copyingse(concordance) to the new object.
Minor error in survfit.coxphms; it would fail if the model hadan NA coefficient.
Relax a check in concordance, to allow comparing two modelswith the same subjects but different response vector.
If multiple strata() terms were first in a coxph model, the labelsof the assign component would be incorrect, which affected labeling ofcox.zph results (numeric values were correct, however).
The riskmat option of the coxph.detail command now returns thematrix in data order rather than time-sorted order.
The summary.survfit function had overlooked the std.chazcomponent when subsetting based on the times argument.
The documentation for print.survfit stated that rmean="common"would use the largest time across curves, the code had the median.Make code agree with the documentation. Pointed out by Qingxia Chen.
Add the rttright function (redistribute to the right) and theR^2 measure of Royston and Sauerbrei.
Add residuals.survfit, which will be important forpseudo-values. Still incomplete.
Better hardening of coxph against a particular kind of skewedvariable, based on a test case from Michael Young. This had led to the"This should never happen, please contact the author" message.
Changes in version 3.2-4
Add na.omit to the output of survcheck.
Undo an ifelse typo (added in 3.2-3) in survexpm that caused it toreturn NULL for an upper triangular rate matrix, breaking survfitfor a multi-state coxph model. (Upper triangular has the simplestalgorithm, and all the tests in the suite were for the more complexcases of course – aargh.)
Changes in version 3.2-3
Fix error in survfit.coxphms: an internal routine was beingcalled with arguments in the wrong order.
Add support routines for the derivative of a matrixexponential, needed for survival curve variance (post Cox model).
Add explicit error message to summary.survfit, when the timesargument asks only for times beyond the end of a curve and extend=FALSE.
Clipping could be too tight in plot.survfit.
Changes in version 3.2-2
Add support for "timeline" style survival data. Ihope this will be a step forward in usability for multi-statemodels, since data sets can be built with standard data manipulation tools.
Fix error in survfit.coxphms, the weight vector could be thewrong length when the start.time option was used.
Formulas in a multistate coxph model can now have "-x1" todelete variable x1, in secondary formulas. (Update.formula is now usedbehind the scenes).
Multistate coxph models now handle strata in full generality– a stratum can apply to all transitions or just to some. Oneconsequence is that the cmap element of the returned fit has been broken intotwo portions: stratum_map contains strata information and cmap thecoefficient information.
Revert (partially) a change to tmerge. Using tdc() to update avariable that already exists in the baseline data was a problem, sotdc had been changed to replace rather than update. Now allow updates tovariables created by a prior tdc.
Fix error in survfit, 0/1 status variable: the start.timeoption worked correctly only if the data set was sorted by time,which unfortunately was true of the test data in tests/survtest.R.Fix code and strengthen the test.
Multiple updates to multi-state coxph models + follow-oncurves. A current clinical project is providing a stress test.
Changes in version 3.1-12
Change the default for a robust variance: if there is acluster argument, non-integer case weight, or an id statement andat least one id has more than one event.
cox.zph would fail if the coxph fit had NA coefficients(something that used to work). Add a test case to futureproofthis. Caught by Ville Ponkilainen.
Minor: pyears + data.frame option would not preserve the orderof factor levels from a tcut operator.
Edge case from Andrea Jaensch: a coxph model with strata +psline terms, plus a (time1, time2) data set containing observationsthat do not overlap any events, in just the right spot, could cause aninfinite loop in agmart3.c.
Add subset and na.action arguments to survcheck.
Minor updates to plot.survfit and survcheck.
Add cluster= option to replace +cluster() in a formula.Remove all mention of the latter from documentation andexamples. Make the cluster, id, and robust options consistent acrossall the functions.
Fix bug in plot.survfit with xaxs='S'. At some point one lineof code got lost.
Changes in version 3.1-11
Add 'n' vector to survcheck, update tests.
Improve multistate coxph printout
Fix a memory reference error in multicheck.c
Changes in version 3.1-10
Fix error in concordance(fit, newdata= xxx): it used the olddata at one point. Pointed out by Matjin van't Hooft.
Minor update to tmerge – print a warning when a user attemptsto update a variable using tdc, namely that this results in completereplacement of said variable, with no retention of prior values.
Minor fixes to plot.survfit, when both xlim and xaxs='S' arespecified. Error and suggested fixes from Heinz Tuechler.
Two failures in makepredictcall.pspline, found by 2 differentusers, both cases of options that should have been carried forward.A subsequent termplot() call failed if pspline had 'nterm' or'combine'.
Fix memory leak (forgotten PROTECT) in zph[12].c; caught by B Ripley
Changes in version 3.1-9
The plot.cox.zph function would fail for a stratified model,if some covariate was a constant in one of the strata. The cox.zphroutine correctly labeled those points as uninformative via NA, theplot routine needed to actually ignore them.
Changes in version 3.1-8
For a multistate model with no covariates, the start.timevalue (if present) was inadvertently omitted from the result. Thisaffects the default plot.
Per user request, the tmerge function can now use Dates as thetime variable for the merge.
Fix an invalid read (one element past the end of a vector)that could occur in tmerge.c; reported by Brian Ripley.
A multi-state coxph model with strata would fail when parsingthe formula, pointed out by Martin van't Hooft.
Changes in version 3.1-7
For a coxph model with covariate*strata interactions theinformation matrix will be block diagonal, and the cox.zph functionwould generate a 0/0 when scaling it for plots. This led to aBLAS error on some architectures (reported by B. Ripley within 24hours of 3.1-6 being published on CRAN). Tests were unaffected,subsequent plots fail due to an infinite axis.Repair, and add more checks to the test suite.
Change in version 3.1-6
Repair issues in coxph.getdata and lines.survfit that werefound with reverse dependency checks
Submit to CRAN
Changes in version 3.1-5
Update coxph.getdata and coxph.detail to work with coxphmsobjects. A deficiency in the first affected cox.zph results formulti-state coxph fits.
Add a formal test suite for the cox.zph routine.
Changes in version 3.1-4
Move some vignettes to the vignette2 directory, found on thegithub website. Add an index to those files.
Add the timefix option to coxph results, and ensure thatdownstream survfit calls correctly retain it.
Expand the main survival vignette.
Changes in version 3.1-3
The results of anova.coxph were incorrect for the case of asingle model with ties="breslow" and tied event times: the breslowoption was not being passed forward to the secondary fits.
Add more sanity checks to anova.coxph, e.g., all models musthave used the same ties option.
Update tmerge to allow more variable types as the argument totdc. A user pointed out that Dates were not preserved; now fixed.
Changes in version 3.1-2
The cox.zph command now refuses models with tt() terms, beforeit had an incorrect computation.
Fix 2 errors in plot, for survfit of a coxph model. (I had notscanned the pdf pages from the vignettes, which is the only way toverify plots.)
Fix labeling error for combination of pyears, tcut variable,data.frame option. (The numerical values were correct).
Changes in version 3.1-1
Fix error in [.cox.zph, when applied to a stratified model
Changes in version 3.1-0
Respond to some CRAN queries and resubmit.
Better documentation of the survfit0 routine
Add the sas.Rnw vignette to inst/doc: it takes too long torun for inclusion in the vignettes directory
Fix two edge case errors pointed out on github: coxph on adata set with 0 events, and models with only a frailty term
Update residuals.coxph to deal with larger matrices, i.e.,change two .C calls to .Call
Changes in version 3.0-11
Multiple small updates, after running tests for allreverse dependencies
Send to CRAN
Changes in version 3.0-10
Make sure all calls to data.frame explicitly select a valuefor the stringsAsFactors option.
Updates to cox.zph for the singledf option
Add formal test of the cox.zph statistics
Add the sas vignette to the vignettes2 directory (it takes toolong to run).
Changes in version 3.0
Major revision of the survfit routines, see the survival vignette.
Allow multi-state coxph models.
Rename remaining .S files as .R
vcov of a survreg object now contains dimnames (important for thestats::confint function)
Subscripting survfit object removes the na.action. This is aloss in the sense that the printout no longer tells us thatobservations were removed, but the information about which and howmany rows were removed was incorrect after the selection.
The survexp function, applied to a coxph model with strata,would sometimes produce extraneous y=0 values at the start of acurve.
Multiple small bug fixes.
Changes in version 2.44-1
Fix error in survreg when the init argument was used.
B. Ripley found/fixed an incorrect size in survfitkm.c, thatcould lead to memory overwrite and a hard crash.
Changes in version 2.44-0
Add several data sets from the reliability literature, whichhad been used in the tests directory, to the package'sdata and add a help page of 'reliability'.
Fix error in residuals.survreg, type="matrix", pointed out byAchim Zelies. Another check has been added to the tests.
The survfit routine now returns the cumulative hazard alongwith its standard error, and allows for robust variance.
For (start, stop) data, the survfit result only includesunique stop times.
Update plot.survfit to plot the cumulative hazard whenfun='cumhaz', rather than plotting log(surv).
The Nagelkerke R^2 has been removed from summary.coxph.The shortcomings of this measure are well known, concordance is abetter measure.
A cluster() term is not allowed in the finegray function; nowgive an explicit error message to that effect.
Track down a failure that occured with some infinitecoefficient data sets. When iterations run out, the routine nowreturns the last successful iterate rather than the last attempt, e.g.,if the loglik maximizes at infinity the routine now returns thelast step at which the partial likelihood, first and secondderivatives were all finite. This stops some downstream"non-finite" messages.
Add concordancefit function to help pages and exports, soother packages can more easily invoke it.
Changes in version 2.43-4
Added a hex sticker. It is found in man/figures.
Small grammar changes in a help page.
Fix bug pointed out by A Ruten-Budde. The coxph routine wasnot passing the timefix option forward to a subseqent concordancecall.
Fine tune the checks for an infinite coefficient. A data setfrom rehbergT managed to have overflows in the first and secondderivative at the same iteration, leading to an update of inf * 0.
Formally add some small reliability data sets to the package, with ahelp page of 'reliability'. They had been used in the tests.
Changes in version 2.43-2
In concordance, allow y to be an orderable factor (eitheris.ordered=TRUE or it has only 2 levels), instead of giving an errormessage. Repair some missing references in the vignette.
Fix an error check in survSplit, when the response has missingvalues. The routine would fail with an error message when there wasno error. (Pointed out by Daniel Wollschläger.)
Fix serious error in the finegray function when called with(start, stop) data, e.g., with time-dependent covariates: thecensoring distribution G was incorrect which leads to incorrect weights,including NA. Pointed out by Deqiang Zheng along with an example.(The use of time-dependent covariates in a FG model has serious – Ithink fatal – statistical issues, however. The FG approach addsextra 'imputed' follow-up to each subject; but what is the futurevalue of a time-dependent covariate over this new interval?)
Update the finegray function to allow case weights. If theoriginal data has sampling weights, for instance, this propogatesthem properly to the created fgwt variable.
Changes in version 2.43-1
Minor change to the concordance method to better accomodateanother package; add one more test case as well.
Change coxph to use concordance() rather than survConcordance. Be aware that this changes the default variance estimate (to abetter estimator however).
Add a test to verify that tmerge works with Date objects asthe time scale
Add timefix=TRUE option to survdiff
Add code for an edge case to coxph: a data set with no events.
Changes in version 2.43.0
Finish test suite and vignette for concordance.
Run the tests for all packages that depend on survival.Submit to CRAN
Changes in version 2.42-7
Add arguments to survfit: survfit.matrix did not havestart.time, and survfitCI did not have p0. Now both of them haveboth.
Fix two small errors triggered by the new checks for the useof && or || with arguments whose length is >1. Pointed out byMartin Maechler.
Add the concordance function, an upgrade of the oldersurvConcordance function. The latter will be depricated. (The draftvignette still needs some polish.)
Change survreg so that a returned "y" in the object is theoriginal response, not the transformed y used for computation. Thiswas prompted by the concordance.survreg method, but is also moreconsistent. It forced a change in residuals.survreg and uncovereda long standing bug for any fit that had specified y=FALSE.
Fix bug pointed out by C McCort: tmerge with "tdc(time, x)"would fail if x is of mode character. Add this case to the test suite.
Changes in version 2.42-6
Remove the cbind.Surv and rbind.Surv methods. The problem is when one is called with mixed arguments, e.g.cbind(Surv(1:4), data.frame(x=6:9, z=c('a', 'b', 'a', 'a'))In the above cbind.Surv is never called, but thepresenceof a cbind.Surv method messes up the default behavior, see theDispatch section of help('cbind').
Changes in version 2.42-5
Add a plot.Surv method per the suggestion of Goran Brostram.Improve the cbind.Surv and rbind.Surv methods to handle mixedargument lists (when there are some Surv arguments and some not).
Add a Survmethods.Rd page documenting the added methods.
Add "F" and "S" to the list of fun= arguments to plot.survfit,they are aliases for "event" and "identity", respectively.
Changes in version 2.42-4
Undo a bug that was introduced in tmerge in 2.42-3; an essentialline got commented out with the result that if sequential tmerge callsmodify the same variable only the final change was retained. Add acheck to the test suite to prevent this in the future.
Improve multi-state survfit when the input data has extracensored rows, e.g., a subject with transitions to state 1 at time 2and state 2 at time 8 but data of (0,2,1), (2,5,0), (5,8,2); thesurvSplit routine often generates such rows.Formerly the transitions table in the output would be incorrect forthis case, and the life table would get an extra "censoring" line attime 5. The estimated P(state) and its se was correct.
Fix an edge case in tmerge, when using cumevent and the inputdata has a 'censored' row. Add a test for this, and for another edgecase of repeated updates at the same time point.
repair xtfrm.Surv: it had returned a partial ordering forsurvival objects (like order()), it instead needs to be the analogof order(order(x)), a vector of integers with the same sort order asx. Add test cases and a manual page.
Add more Surv methods: head, tail, rep, rbind, c, rev, t,mean, median, plot, points, lines, levels.
Changes in version 2.42-3
Remove the coxph warning "X matrix deemed to be singular".The coefficients are NA, just as before, we simply say less.
Fix minor bug in coxph: a covariate that was a constant wouldhave its coefficent reported as 0 rather than NA, if (and only if)it was the only variable in the model, e.g.,coxph(Surv(1:10) ~ rep(4,10)).
Changes in version 2.42-1
Add xtfrm method for Surv objects.
Fix error in logLik.coxph.null (incorrect class)
Fix error in pyears, would fail for a model with nopredictors and dataframe=TRUE.
tmerge would fail if an id was missing, give a messageinstead
Stronger date checks in survexp, i.e., that the columnof a data frame is a date if and only if the matching ratetabledimension is a date.
Restore the order of the elements of coxph objects; as someother packages depend on both the names and the order. It had beenmodified when the residual argument was added to coxph.fit.
Add a more rigorous check for overflow in the coxph iteration:M Tsagris supplied an edge case example where the information matrixfails one iteration before anything else.
Changes in version 2.42-0
Fix a bug in the agfit4.c routine, based on data sets from IvoSousa Ferreira and Marloes Derks. This was introduced in 2.39-1 andleads to incorrect solutions for selected data sets. Such data setsare a rare edge case, however. In detail:In a start stop data set with strata assume two adjacent event timesin one stratum of d1 and d2, say, and a set of k censored intervals(a,b) also in that stratum such that a>=d1 and b<d2. (Such intervals arenever at risk for an event and could be elminated from the data setwithout loss.) If k >= the number of intervals that overlap both d1and d2, and in the prior stratum the smallest time was an event,some variables that track who is in the risk set got out of sync,and contributions to the loglik, first and second derivative at d1would be incorrect. I expect such data sets are extremely rare.However, the survSplit routine and mstate packages can generate datasets with a LOT of the unneeded intervals. (The data set inquestion came from mstate.)
Use format.pval() and printCoefmat in more of the printfunctions. This aligns the format with that of base R.
Update the vcov function to accept the new complete= argument.
Update statefig to accept vectors of colors.
The [.survfit routine would complain on the use of fit[1]when fit contained a single curve. This is now legal.
Change NAMED() to MAYBE_REFERENCED() at the suggestion of Rcore
Add the yates() routine for population prediction,and accompanying vignette.
Update the survival rate tables (survexp.mn, survexp.us,survexp.usr), to add data for more calendar years.
Bow to user pressure: marks now appear on survival curves forcensoring times that are tied with an event time, plotted at themidpoint of the vertical step. Also, replace the outdated
markoption withpch.
Changes in version 2.41-5
Update the survexp.us and survexp.usr rate tables. They nowcontain years 1940 to 2012. They however lost the breakdown of thefirst year of life into smaller intervals as the recent US census datalacks that information. Update the code for ratetables: a cutpointattribute vector can now be of class Date, and names(dimnames) cansupplant the dimid attribute. (Only creators of rate tables are impactedby these last two.)
Change all instances of "1-pchisq(...)" to instead use thelower.tail=FALSE argument.
Changes in version 2.41-4
The coxph routine did not check for infinite predictors (theseare not screened out by na.action), and these could cause theiteration to fail. Added a check and stop() statement. The examplewas provided by Glenn Tisdale.
When conf.times was used in plot.survfit, the bars were notperfectly centered on the target values
Add the residual and concordance argument to coxph.fit andagreg.fit, at the request of S Venkat. These speed up the functionwhen a calling routine only needs the partial likelihood.
Fix error in survfit: if timefix=FALSE was specified we forgotto set a key variable and the routine fails. Pointed out by SarahStreett. 8Apr2017.
Change the scale argument of summary.coxph so that it affectsthe coefficient and se(coef), not just the confidence interval.
Fix an error in survfitCI when using the start.time argument, andadd a test case for it.
Add tail.Surv method per a request from Michael Lawrence.Also add duplicated, anyDuplicated, and unique methods.
Changes in version 2.41-3
A check for infinite loglik was incorrect in agfit4.c, and couldfail to detect the need for step halving. It required a veryunusual data set to trigger this.
The survfit routine would fail for interval censored data, ona group that had only a single step in the curve. (Needed to adddrop=FALSE to a matrix subscript.)
Minor change to Surv to ensure that its check for difftimeobjects will not trigger a "length >1 inside an if ()" warning.
The summary.survfit function had n.censor wrong when therewere multiple curves and censor=TRUE (spurious NA values). Added morelines to the test suite.
Pointed out by Mikko Korpela: the dynamic symbols check addedin 2.41-0 requires R version 2.16 or later. Add an ifdef to init.cthat checks the version of R, mimicking a similar line in the MASS library.
Changes in version 2.41-2
Fix two memory leaks and an uninitialized array, found by B Ripley.
With Surv(a,b, type='interval2') and a or b infinite, theinfinite values were incorrectly retained rather then beingtransformed into left or right censoring. The downstream survfitand/or survreg results could then sometimes be in error.
Update cch to correctly deal with nearly tied times, in linewith the many changes in version 2.40.
Update the README.md file, for github users who didn't readnoweb/Readme and then get R CMD build errors.
Changes in version 2.41-0
Per request if the R-core, add R_useDynamicSymbols(dll,FALSE)to the initialization. This prevents .Call from accessing thelibrary when its first argument is a character string. The reasonis to stop accidental linking to the routines.
Fix a bug in tmerge, if data2 was not sorted by time within idthen a tdc(time, x) call's outcomte was incorrect. Add the abilityto use a factor as the second variable in a tdc call, and add thetdcstart option.
Expose the aeqSurv routine, which is used rectify tiedtime issues.
The survfit routines now save the start.time option (if used) inthe output object. This is then used as a default starting point forthe x-axis in any plots.
Allow survfit.matrix to use different p0 values for differentcurves.
Add type="survival" to predict.coxph
Changes in version 2.40-2
Fix an error in the finegray routine: with strata() theresulting data sets could have incorrect status values. Pointed outby Mark Donoghoe. Added a strata test to tests/finegray.R.
Remove many "is.R" and "oldClass" calls (vestiges of Splus).
The summary.pyears routine now prints pandoc style tables.
Fix multiple spelling errors in the Rd files; contributed byLuca Braglia.
For a multi-state curve, the cumhaz component accidentally hadthe final state removed. All values were correct, simply anoverzealous trimming of the final result.
Add a short vignette describing the issue with round off errorand tied survival times.
Errors in survSplit: a factor status was not propogated, and amissing time gave a spurious error message.
Changes in version 2.40-1
For multi-state survival with a big data set and theinfluence=TRUE option, the resulting object could be so long that itoverflowed an integer counter in the C code. Add a check in the Rcode and a caution in the help file.
Changes in version 2.40-0
Code changes to avoid the new warnings for multiplication of avector * (1 by 1 matrix).
Add a more thorough test case for multi-state survival:not all subjects start in the same state, delayed entry, andcase weights that change within a subject. This uncovered someerrors. More carefully document the influence option.
Consistently deal with "almost tied" survival times in the survfit andcoxph routines. Uses the same rule and tolerance as the all.equalfunction to declare two time value equal. The issue arises due toround off errors, e.g., from cacluations using days/365.25.
Add the statefig function and a multi-state vignette.
The rsurvreg function was not exported. NAMESPACE fix.
Fix some labeling errors in the graphs for the adjustedsurvival curves vignette (consequences of the xscale change in2.38-5).
Update multi-state survival so that the robust (default)variance for a weighted data set treats these as sampling weightsrather than case weights. This makes it consistent with thebehavior of coxph. (Multiplication of all the weights by a constantnow leaves the variance unchanged.) (9/2016)
Surv(time, status) would fail when status was a factor withonly two levels. This was due to an assumption that no user wouldever want this, i.e., ever do it on purpose, and so it must be a mistakewhich should be caught. This was a bad assumption.
Add the start.time argument to survfit.coxph. 10Sep2017
Changes in version 2.39-5
The summary.survfit routine assumed that the times argumentwas sorted, contrary to the documentation. Pointed out by TorstenHothorn.
The tmerge function would fail if the time variable was a Dateobject. It was due to the fact that as.Date(as.numeric(x)) fails when x is a date. (A design flaw in Date, IMHO). There werealso flaws when both the first and second data set were not sortedby id; added a more complete test case for this.
An earlier change in dim.survfit had felled the survfit.matrixfunction: it incorrectly assumed strata when there were none.Unfortunately this didn't generate an error but rather multiplecopies of a single curve (and an incomprehensible explanation ofthis single curve in the vignette). Pointed out by E Lundt.
print.summary.survfitms would complain if only a single timewas returned. A case where drop=FALSE was needed.
Add a test for survSplit to ensure that it works with both theformula based and old interface. Add documention onhow variable names are chosen to the help file.
Error in subscripting survival curves: if fit was a survfitcurve from left-truncated data, fit[k] had an incorrect n.entercomponent. (An old error, which shows how rarely that component isused.) Pointed out by Beth Atkinson.
Remove n.enter from the default printout of summary.survfit,to make the printout more compact.It remains in the summary object but was very rarely used.
Update the points.survfit function to handle multiple colorsand/or plotting characters. If a survfit object has multiple curveswe cycle through these in the same manner as matpoints would.
Changes in version 2.39-4
Create a stronger test suite for summary.survfit, and useit to actually fix the error that 2.39-3 claimed to fix. Thisuncovered a long-standing inaccuracy with n.risk for in-betweentime points.
Add a section on monotone splines to the splines vignette.
Changes in version 2.39-3
For multi-state curves, the returned n.event component lostits dimensions if any of the curves had only one observation.
Fix error in summary.survreg. For multiple curves andrequested time points at or before the first time point in the data,the values from curve 1 was used for all. Pointed out by T Eigentler.
Fix an unitialized variable in C code, pointed out by Brian Ripley.
Changes in version 2.39-2
Small updates based on feedback from CRAN
Changes in version 2.39-1
Label the output dimnames from pyears with the variable namesfrom the model. This makes it easier to read.
Replace any refrences to model.frame with "stats::model.frame"(all 38 of them). The model.frame function uses non-standardevaluation rules, and holding its hand like this is the only way toensure that we don't call a user function of the same name.
The Surv function would almost always label the columns of theresulting matrix, and the glmnet function depended on this. It nowalways labels them per a request from Trevor Hastie.
Add the finegray function and expand the competing risksvignette to document it.
Add a check to the quantile.survfit function for multi-statemodels; quantiles are not well defined for this case.
Changes to the iteration path and convergence tests for coxphmodels with (start, stop] data, driven by two user examples thatfailed. The data sets had serious statistical issues ofcollinearity and/or outliers such that the final fits are notpractically useful, but now the routine finishes gracefully insteadof dying. The upshot is much more care about the order in whichadditions and subtractions of large numbers are done so as to avoidcancellation error.
Fix an error to summary.survfit with the times argument: forintermediate time points it would sometimes choose the wrong valuefor the number at risk. (Number at risk is a left continuousfunction.)
Changes in version 2.38-5
Add more graphical arguments to plot.cox.zph in response to a userrequest.
Remove some of last vestiges of Splus support from the headerfiles for the C code, per a request from R core to remove mention of S.h.
Multiple updates and corrections to the tmerge function,including improvements to the vignette. (As a result of using it ina class where the TA tried out all manner of combinations.)
Update survSplit: it now handles all types of status variables(0/1, TRUE/FALSE, factors), the id and episode arguments are usefulfor start/stop data, the data retains its original sort order (newobservations are inserted rather than put at the end), and thefunction is illustrated in a vignette.
Add the conf.times argument to plot.survfit. Thisallows for confidence bars at specified times, which are usefulwhen the plot is crowded.
Survfit changes that are NOT backward compatable!
Change the default for mark.time to FALSE
Change the behavior of xscale so that it matches that ofyscale, i.e., it changes only the label and not the underlyingscale. Follow on annotations such as legend or locator are in theorignal scale of the data.
For a matrix of curves, e.g. competing risks, print andplot them in column major order rather than row major, so as to match the usual R behavior.
Fix an error in the help page for the cohortargument of survexp, pointed out by Karl Ove Hufthammer.
The anova and logLik functions would fail when given anull model (right hand side of 1 or only an offset). Pointedout by Karl Ove Hufthammer.
The recently added code to generate an error when the samevariable appears on both sides of a formula in coxph (a good idea)caused a failure if there was offset statement that contains a '-'sign. Pointed out by Abra Jeffers.
Changes in version 2.38-3
Add more imports to the NAMESPACE file per a request from CRAN
Add a length method for Surv objects. Requested by Max Kuhn.(2015/6/17).
Fix an error in neardate. When both input data sets wereunsorted the last match could be wrong.
Changes in version 2.38-2
Change print.coxph to use the printCoefmat routine, which lleads to nicer p-values. Other print routines will follow unlessthere is an outcry. (But I forced signif.stars=FALSE: my tolerance ofbad practice has limits.)
Make those parts of the competing risks vignette which dependon the cmprsk library conditional. Otherwise the build fails forthose without the pacakge.
The coxph function could fail converge for a set of very collinearpredictors when using (start, stop) data; revealed in a test casesent by G Borstrom. This was due to deficiency in a check fornear infinite coefficients, which had already been updated for somebut not all cases. (2015/6/3)
Update anova.coxph to use the model.frame.coxph function; the current code had scoping errors if embedded in a function. Add ananova.coxph.penal function to correctly handle models with psplineterms.
Fix an error in the tmerge function. Using the optionsargument would generate a spurious error.
Pyears could fail on very long formulas due to a deparse() issue.
Add the number of observations used and deleted due to missingto summary.pyears.
Allow the combination of a null coxph model (~1 on the right)and the exact calculation for tied times. No one had ever asked forthis before. (2015/3/25)
Shorten the default printout for survfit. The records, n.maxand n.start columns are often the same: if so suppress duplicates.
Move the anova.coxphlist function from the survival package tocoxme. (2015/3/3)
Change the logLik method for coxph models so that the nobscomponent is the number of events rather than the number of rows inthe data. This is superior for follow on methods such as AIC.
Add a test to the coxexact.c routine for too large a data set;too many tied times could lead to integer overflow. "Fixing" the erroris not sensible: the computation for such a data set would take decades.Add some more explanation to the help pages as well.
Changes in version 2.38-1
Fix an error discovered by CRAN, which triggered a core dumpfor them on a particular manual page (but never for me). The linearpredictors from a frailty model contained NA values (incorrect),leading to failure in survConcordance.fit. (2015/2/16).
An error was found in the mgus data set (a progression afterdeath). Now corrected, and added a little more follow-up time forsome subjects.
Add error check for infitinte weights or offsets. This in resposeto a bug report where someone did this on purpose, trying to mimiccure fractions, and then found that survfit.coxph failed.
Robust variance is not supported for a coxph model with the"exact" approximation. (Rarely requested and a lot of work to add.)Add an error message to clogit(), so users get a more useful notice ofthe issue rather than a late error from residuals.coxph.
Update the rats data set: it now includes both female and malelitters so as to match the documentation.
The term frailty(x) would fail if x were a factor, and not alllevels were present. Pointed out by Theodor Balan.
Fix error of "abs" instead of "fabs" in the agfit4.c code;pointed out to me by CRAN.
Replace all instances of the obsolete prmatrix function.
Modify pyears to allow cbind(time, count) as the response,giving a cumulative sum of counts, when the counts per observationmay be other than 0/1.
The lines.survfit function was incorrect for data sets thatused the start.time option and xscale (it neglected to rescale thestart time.)
An increasingly common error is for user to put the timevariable on both sides of a coxph equation in the mistaken beliefthat this is a way to create time-dependent coefficients. Generatea warning message for this case.
Update the basehaz function to a simple alias for "survfit".Prior versions called surfit but then only returned part of theobject. Update 2/2015: reverted the change. It turns out that 6different packages that depend on survival also depended on theold behavior.
Make the default value for the shortlabel argument of strata()more nuanced. If the argument is a single factor, assume that wedon't need to prepend the variable name to its levels.
Return the weights vector, if present, as part of the survregobject.
For interval censored points and the symmetric distributions(Gaussian and logistic) response type residuals were incorrect.Silly error: needed (x-mean)/scale not x/scale - mean.
Martingale residuals could be incorrect for the case of model with(start, stop] data and a pspline term. Refactor the code so thatall of the possible code paths call the same C routine to do the residuals.Add a new test for this case, and further tests to verify thatpredict(type='expected') and residuals agree.
Fix bug pointed out by D Dunker: if a model had both tt() andcluster() terms it would fail with a length error.
Fix a rare bug in plot.survfit: if a multistate curve rose andthen later fell to exactly the same value, the line would beincorrect.
Add calls to the R_CheckUserInterrupt to several routines, sothat long calculations can be interrupted by the user.
The anova.coxph function would fail if the original call had asubset argument. Pointed out by R Fisher. 11May2014
Changes in version 2.37-7
Remove a dependency on the survey package from the adjustedsurvival curves vignette, at the request of CRAN. (The base +required bundle needs to be capable of a stand-alone build.)
Fix error in calcuation of the y-axis range for survival curveplots whenever the "fun" argument could produce infinite values,e.g., complimentary log-log plots transform 1 to -Inf. Pointed outby Eva Boj del Val. (Add finite=TRUE to range() call).
Changes in version 2.37-6
The plot for competing risk curves could have a spurioussegment. (Found within 3 hours of submitting 2.37-5 to CRAN.)
The lines method for survexp objects was defaulting to astep function, restore the documented default of a connectedline.
Add a levels method for tcut objects. 14Jan2014
Changes in version 2.37-5
Add vignette on adjusted survival curves.
Add vignette concerning "type 3" tests.
Make the tt() function invisible outside of a coxph formula.There was a complaint about conflicts with another package, andthere is not really a good reason to have it be a global name.An R-devel discussion just over 1 year ago showed how to accomplish this.
The modeling routines are set in two parts, e.g., coxph setsup the model and coxph.fit does the work. Export more of the ".fit"routines to make it easier for other packages to build on top ofthis one.
Updates to the model.matrix and model.frame logic forcoxph. A note from F Harrell showed that I was not correctlydealing with the "assign" attribute when there are strata * factorinteractions. This led to cleanup in other cases that I had missedbut which never had proven fatal. Also added support for tt() termsto the stand alone model.matrix and model.frame functions.(Residuals for tt models are still not available, but this was anecessary first step to that end.) 26Dec13
The Surv function now remembers attributes of the inputvariables that were passed to it; they are saved as"inputAttributes". This allows the rms package, for instance, toretain labels and units through the call.
Update summary.coxph.penal to produce an object, which in turnhas a print method, i.e., make it a "standard" summary function.
Add a logLik method for coxph and survfit objects.
Allow for Inf as the end of the time interval, for intervalcensored data in the Surv function.
The predict.coxph function would fail if it had both a newdataand a collapse argument. Pointed out by Julian Bothe. 25Sep13
Survexp can now produce expecteds based on a stratified Coxmodel. Add the 'individual.s' and 'individual.h' options to returnindivudual survival and cumulative hazard estimates, respectively.The result of survfit now (sometimes) includes the cumulativehazard. This will be expanded. 29Jul13
2
Change code in the coxpenal.fit routine: the use of a vector ofsymbols as arguments to my .C calls was confusing to a new CRANconsistency check. Both the old and new are legal R; but the oldwas admittedly an unusual construction and it was simpler to change it.
Fix a bug in survfit.coxph pointed out by Chris Andrews, whoseroot cause was incorrect curve labels when the id option is used. 27Jun13
Add rsurvreg routine.
Change survfit.coxph routine so that it detects whethernewdata contains or does not contain strata variables, and actsaccordingly. If newdata does containe strata then the output willcontain only those data-value and strata combinations specified by theuser. Retain strata levels in the coxph routine for usein the survfit routine, to correctly reconstruct strata levels.Warn about curves with interactions. 18Ju13
Add a dim method for survival curves.
For competing risks curves that use the istate option, theplotted curves now start with the correct (initial) prevalence ofeach state. 22May13
The survreg function failed with the "robust=T"option. Pointed out by Jon Peck. Test case added. 6May13
Kazuki Yoshida pointed out that rep() had no method for Survobjects. This caused the survSplit routine to fail if the dataframe contained a Surv object. 3May13
Per a request from Milan Bouchet-Valet fix an issue in survfitthat arose when the OutDec option is set to ',': it did notcorrectly convert times back from character to numeric.
The plot.survfit function now obeys "cex" for the size of themarks used for censored observations.
Changes in version 2.37-4
Subscripting error in predict.coxph for type=expected, se=T,strata in the model, newdata, and multiple strata in the new dataset. Pointed out by Chris Andrews. The test program has beentweaked to include multiple strata in newdata.
Changes in version 2.37-3
Minor flaw in [.survfit. If "fit" had multiple curves, andfit$surv was a matrix, and one of those curves had only a single observationtime, fit[i,] would collapse columns when "i" selected that curve,though it shouldn't.
Changed all of the .C and .Call statements to make use of"registered native routines", per R-core request. Add file src/init.c
Error in plot.survfit pointed out by K Hoggart – the "+"signs for censored observations were printing one survival time tothe left of the proper spot. Eik Vettorazi found another error ifmark.time is a vector of numerics. These are the results of mergingthe code for plot, lines and points due to some discrepancies betweenthem, plus not having any graphical checks in the test suite.
Repair an error in using double subscripts for the survfitmsobjects.
Add the US population data set, with yearly totals by age and sex for 2000 onward. It is named uspop2, since there is already a "uspop" data set containing decennial totals from 1790 to 1970.
Not all combinations of strata Y/N and CI Y/N worked in thequantile.survfit function, pointed out by Daniel Wallschlaeger(missing a function argument in one if-else combination).Added a new test routine that verifies all paths.
The first example in predict.survreg help file needed to have
I(age^2)instead ofage^2in the model: R ignores thesecond form. (I'm almost sure this worked at one time, perhaps in Splus).It also needed different plot symbols to actually match thereferenced figure. Pointed out by Evan Newell.Fix a long-standing problem with cch pointed out by Ornulf Borganleading to incorrect standard errors. A check in the underlyingcoxph routines to deal with out of bounds exponents, added inversion 2.36-6, interacted badly with the -100 offset used in cch.It only affected models using (start, stop) survival times.
Changes in version 2.37-2
Two bugs were turned up by running tests for all thepackages that depend on survival (158 of them).
Changes in version 2.37-1
Add a new multi-state type to the Surv object. Update thesurvfit routine to work with it. The major change is additionof a proper variance for this case.More functionality is planned.
Remove the fr_colon.R test program. It tests an ability thathas been superseded by coxme, on a numerically touchy data set, andit was slow besides. For several other tests that produce warningmessages and are supposed to produce said messages, add extracomments to that effect so testers will know it is expected.
The code has had several "if.R" clauses to accomodate Splus vsR differences, which are mostly class vs oldClass. These are now beingremoved as I encounter them; since our institution no longer usesSplus I can no longer test the clauses' validity.
The fast subsets routine coxexact.fit incorrectly returned thelinear predictor vector in the (internal) sorted order rather thandata set order. Pointed out by Tatsuki Koyama, affecting the resultof a clogit call. 6Nov2012
Jason Law pointed out that the sample data set "rats" is fromthe paper by Mantel et.al, but the documentation was for a dataset from Gail, Santner and Brown. Added the Gail data as rats2 andfixed the documentation for rats.
For predict.coxph with type="terms", use "sample" as thedefault value for the reference option. For all others the defaultremains "strata", the current value. Type terms are nearly always passedforward for further manipulation and per strata centering can messthings up: termplot() for instance will no longer show a smoothfunction if the results are recentered within strata.
Fix bug in summary.aareg, which was unhappy (without cause) ifthe maxtime option was used for a fit that did not include thedfbeta option. Pointed out by Asa Johannesen.
The coxph fitting functions would report an error for a null model(no X variables) if init was specified as numeric(0) rather than NULL.
Update the description and citation files to use the new"person" function described in the R Journal. Also add theByteCompile directive per suggestion of R core.
Allow an ordinary vector as the left hand side of survConcordance.
Update anova.coxphlist to reject models with a robust variance.
The survfit function had an undocumented backwards-compatability that allows the newdata argument to be a vector with no names. Anexample from Damon Krstajic showed that this does not work when theoriginal model has a matrix in the formula. Removed the feature.(This is for survfit.coxph.) Also clarified the code and its documentation about what is found where – environments, formulas,and the arguments of eval, which fixes a problem pointed out by xxxwhere the result of a Surv call is used in the coxph formula.
Fix an issue in summary.survfit pointed out by Frank Harrell. Thestrata variable for the output always had its labels in sorted order,even when a factor creating the survival curves was otherwise. (This wasdue to a call to factor() in the code.) The print routine would thenlist curves in sorted order, which might well be contrary to the user'swishes. The curves were numerically correct.
Add the anova.coxmelist function to the namespace so that it isvisible. If someone has a list of models the first of which wasa coxph fit and the list includes coxme fits, then anova.coxph willbe the function called by R, and it will call anova.coxmelist.
Fix a bug pointed out by Yi Zhang and Mickael Hartweg.If a coxph model used an offset, then a predicted survival curvethat used newdata (and the offset variable of course) would bewrong, e.g. survival values > 1.A simple misplaced parenthesis was the cause.A recent paper by Langholz shows how to get absolute survival fromcase-control data using an offset, which seems to have suddenly made thisfeature popular.
Per further interaction with Yi Zhang, a few items weremissing from the S3methods in the NAMESPACE file: as.matrix.Surv,model.matrix.coxph, model.matrix.survreg, model.frame.survreg.
Changes in version 2.36-14
A supposedly cosmetic change to coxph in the last releasecaused formulas with a "." on the right hand side to fail. Fix thisand add a case with "." to the test suite.
Changes in version 2.36-13
Add the anova.coxmelist function. This is in the survivalpackage rather than in coxme since "anova(fit1, fit2)" is valid whenfit1 is a coxph and fit2 a coxme object, a case which will cause thisfunction to be called by way of anova.coxph.
More work on "predvars" handling for the pspline function,when used in predict calls. Add a new test of this to the suite,and the makepredictcall method to the namespace.Fixes a bug pointed out by C Crowson.
Deprecate the "robust" option of coxph. When there aremultiple observations per subject it is almost surely the wrongthing to do, while adding a "cluster(id)" term does the correctthing. When there is only one obs per subject both methods workcorrectly.
Add documentation of the output structure to the aareg helpfile.
Change ratetableDate so that it still allows use of chronobjects, but doesn't need the chron library. This eliminates awarning messge from the package checks, but is also a reasonablesupport strategy for a moribund package. (Some of the local users keepdatasets for a long long time.)
Fix a bug in summary.survfit for a multiple-strata survivalobject. If one of the curves had no data after application of thetimes argument, an output label was the wrong length.
Fix a bug pointed out by Charles Berry: predict for a Coxmodel which has strata, and the strata is a factor with not all itslevels represented in the data. I had a mistake in the subscriptinglogic: number of groups is not equal to max(as.integer(strata)).
Changes to avoid overflow in the exponent made in 2.36-6caused failure for one special usage: in case-cohort designs a dummyoffset of -100 could be added to some observations. This was beingrounded away. The solution is to 1: have coxsafe not truncate smallexponents and 2: do not recenter user provided offset values.
Fix bug in survfit.coxph. Due to an indexing error I wouldsometimes create a huge scratch vector midway through thecalculations (size = max value of "id"); the final result was alwayscorrect however. Data set provided by Cindy Crowson which had auser id in the billions.
Fix bug pointed out by Nicholas Horton: predictions oftype expected, with newdata, from a Cox model without a stratastatement would fail with "x not found". A misplaced parenthesisfrom an earlier update caused it to not recreate the X matrix eventhough it was needed later. Also add some further information tothe predict manual page to clarify an issue with frailty terms.
Changes in version 2.36-12
Fix a bug in the new fast subsets code. The test suite had noexamples of strata + lots of tied times, so of course that's thecase where I had an indexing error. Add a test case using theclogit function, which exercises this.
Further memory tuning for survexp.
Changes in version 2.36-11
Make survexp more efficient. The X matrix was being modifiedin several places, leading to multiple copies of the data. When thedata set was large this would lead to a memory shortage.
Cause anova.coxph to call anova.coxme when a list of modelshas both coxph and coxme objects.
Add the quantile.survfit function. This allows a user toextract arbitrary quantiles from a fitted curve (and std err).
Fix an error in predict.coxph. When the model had a strataand the newdata and reference="sample" arguments were used, itwould (incorrectly) ask for a strata variable in the new data set.
Incorporate the fast subsets algorithm of Gail et al, when using coxph with the "exact" option. The speed increase is profound though at the cost of some memory. Reflect this in thedocumentation for the clogit routine.Note that the fast computation is not yet implemented for(start,stop) coxph models.
Change the C routine used by coxph.fit from .C to .Callsemantics to improve memory efficiency, in particular fewer copiesof the X matrix.
Add scaling to the above routine. This was prompted by a userwho had some variables with a 0-1 range and others that were0 - 10^7, resulting in 0 digits of accuracy in the variance matrix.(Economics data).
Comment out some code sections that are specific to Splus.This reduced the number of "function not found" warnings from R CMD check.
Changes in version 2.36-10
30 Sept 2011: The na.action argument was being ignored inpredict.coxph; pointed out by Cindy Crowson.
The log-likelihood for survreg was incorrect when there arecase weights in the model. The error is a fixed constant for anygiven data set, so had no impact on tests or inferences. The errorand correction were pointed out by Robert Kusher.
A variable name was incorrect in survpenal.fit. This was in aprogram path that had never been traversed until Carina Salt usedsurvreg with a psline(..., method='aic') call, leading to a"variable not found" message.
Punctuation error in psline made it impossible for a user tospecify the boundary.knots argument. Pointed out by BrandonStewart.
Add an "id" variable to the output of survobrien.
The survfitCI routine would fail for a curve with only onejump point (a matrix collapsed into a vector).
Fix an error in survfit.coxph when the coxph model has both astrata by covariate interaction and a cluster statement. Thecluster term was not dropped from the Terms object as it should havebeen, led to a spurious "variable not found" error. Pointed outby Eva Bouguen.
If a coxph model with penalized terms (frailty, pspline) alsohad a redundant covariate, the linear predictor would be returned asNA. Pointed out by Pavel Krivitsky.
Changes in version 2.36-9
Due to a mistake in my script that submits to CRAN, the fix in2.36-8 below was actually not propogated to the CRAN submission.
Fix an error in the Cauchy example found in the survreg.distributionshelp page, pointed out by James Price.
Update the coxph.getdata routine to use the model.frame.coxphand model.matrix.coxph methods.
Add the concordance statistic to the printout for penalized models.
Changes in version 2.36-8
Unitialized variable in calcuation of the variance of theconcordance. Found on platform cross-checking by Brian Ripley.
Changed testci to use a fixed file of results from cmprskrather than invoking that package on-the-fly. Suggested by the CRANmaintainers.
Changes in version 2.36-7
Due to changes in R 2.13 default printout, the results of many ofthe test programs change in trivial way (one more or fewer digits).Update the necessary test/___.Rout.save files. Per the core team'ssuggestion the dependency for the package is marked as >=2.13.
Changes in version 2.36-6
An example from A Drummond caused iteration failure incoxph: x=c(1,1,1,0,1, rep(0,35)), time=1:40, status=1. The firstiteration overshoots the solution and lands on an almost perfectlylinear part of the loglik surface, which made the second iterationgo to a huge number and exp() overflows. A sanity check routinecoxsafe is now invoked on all values of the linear predictor.
1 April: Fix minor bug in survfit. For left censored datawhere all the left censored are on the very left, it would give aspurious warning message when trying to create a 0 row matrix thatit didn't need or use. Pointed out by Steve Su.
31 March 2011: One of the plots in the r_sas test was wrong(it's been a long time since I visually checked these). The errorwas in predict.survreg; it had not taken into account a change inR2.7.1: the intercept attribute is reset to 1 whenever onesubscripts a terms object, leading to incorrect results for a modelwith "-1" in the formula and a strata(): the intercept returnedwhen removing the strata. I used this opportunity to move most ofthe logic into model.frame.survreg and model.matrix.survregfunctions. Small change to the model.frame.coxph andmodel.matrix.coxph functions due to a better understanding ofxlevels processing.
Round off error issue in survfit: it used both unique(time)and table(time), and the resulting number of unique values is notguarranteed to be the same for times that differ by a tiny amount.Now times are coverted to a factor first. Peter Savicky from the Rcore team provided a nice discussion of the issue and helped meclarify how best to deal with it. The prior fix of first roundingto 15 digits was good enough for almost every data set – except theone found by a local user just last week.
Round off error in print.survfit pointed out by Micheal Faye.If a survival value was .5 in truth, but .5- eps due to round offthe printed median was wrong. But it was ok for .5+eps. Simpleif-then logic error.
Re-fix a bug in survfit. It uses both unique and table invarious places, which do not round the same; I had added apre-rounding step to the code. A data set from Fan Chun showed thatI didn't round quite enough. But the prior rounding did work for atime of 2 vs (sqrt(2))^2: this bug is very hard to produce. I nowuse as.numeric(as.character(factor(x))), which induces exactly thesame rounding as table, since it is the same compuation path.
Further changes to pspline. The new Boundary.knots argumentallows a user to set the boundary knots inside the range of data.Code for extrapolation outside that range was needed,essentially a copy of the code found in ns() for the same issue.Also added a psplineinverse function, which may be useful withcertain tt() calls in coxph.
10 Mar 2011: Add the capablilty for time-dependenttransformations to coxph, along with a small vignette describing useof the feature. This code is still incompletely incorporated inthat the models work but other methods (residuals, predict, etc) arenot yet defined.
8 Mar 2011: Expand the survConcordance function. The functionnow correctly handles strata and time dependent covariates, andcomputes a standard error for the estimate. All computation is basedon a balanced binary tree strucure, which leads to computation in
O(n \log_2(n))time.Thecoxphfunction now adds concordance to its output, andsummary.coxphdisplays the result.8 Mar 2011: Add the "reference" option to predict.coxph, afeature and need pointed out by Stephen Bond.
4 Mar 2011: Add a makepredictcall method for pspline(), whichin turn required addition of a Boundary.knots argument to thefunction.
25 Feb 2011: Bug in pyears pointed out by Norm Phillips. If asubject started out with "off table" time, their age was notincremented by that amount as they moved forward to the next "intable" cell of the result. This could lead to using the wrongexpected rate from the rate table.
Changes in version 2.36-5
20 Feb 2011: Update survConcordance to correctly handle caseweights, time dependent covariates, and strata.
18 Feb 2011: Bug in predict.coxph found by a user (1 day after36-4!). If the coxph call had a subset and predict used newdata,the subset clause was "remembered" in the newdata construction,which is not appropriate.
Changes in version 2.36-4
17 Feb 2011: Fix to predict.coxph. A small typo that only wasexercised if the coxph model had x=T. Discovered via induced error inthe rankhazard package. Added lines to the test suite to test forthis in the future.
Removed some files from test and src that are no longer needed.
Update the configure script per suggestion from Kurt H.
Changes in version 2.36-3
13 Feb 2011: Add the rmap argument to pyears, as was done forsurvexp, and update the manual pages and examples. Fix one last bugin predict.coxph (na.action use). Passes all thetests for inclusion on the next R release.
8 Feb 2011: Change the name of the new survfit.coxph.fit routine tosurvfitcoxph.fit; R was mistaking it for a survfit method. Fixerrors in predict.coxph when there is a newdata argument, includingadding yet another test program.
1 Feb 2011: Fix bugs in coxph and survreg pointed out by HeinzTuechler and dtdenes@cogpsyphy.hu, independently, that were the samewrong line in both programs. With interactions, a non-penalizedterm could be marked as penalized due to a mismatched vector length,leading to a spurious error message later in the code.
1 Feb 2011: Update survfit.coxph to handle the case of a strata bycovariate interaction. All prior releases of the code did thiswrong, but it is a very rare case (found by Frank Harrell). Added anew test routine coxsurv4. Also found a bug in [.survfit; for acurve with both strata and multiple columns, as produced bysurvfit.coxph, it could drop the n.censored item when subscripting.A minor issue was fixed in coxph: when iter=0 the output coefficientvector should be equal to the input even when the variance issingular.
30 Jan 2011: Move the noweb files to a top level directory, out ofinst/. They don't need to be copied to binary installs.
22 Jan 2011: Convert the Changelog files to the new inst/NEWS.Rdformat.
1 Jan 202011: The match.ratetable would fail when passed a dataframe with a character variable. This was pointed out by HeinzTuechler, who also did most of the legwork to find it. It wastriggered by the first few lines of tests/jasa.R (expect <- ....)when options(stringsAsFactors=FALSE) is set.
Changes in version 2.36-2
20 Dec 2010: Add more test cases for survfit.coxph,which led to significant updates in the code.
18 Nov 2010: Add nevent to the coxph output and printout inresponse to a long standing user request.
14 Dec 2010: Add an as.matrix method for Surv objects.
11 Nov 2010: The prior changes broke 5 packages: the dependencies form a biggertest suite than mine! 1. Survival curve for a coxph model with sparsefrailty fit; fixed and added a new test case. 2. survexp could fail if called from within a function due to a scoping error. 3. "Tsiatis" was oncea valid type (alias for 'aalen') for survfit.coxph; now removed from the documentation but the code needed to be backwards compatable. The other twoconflicts were fixed in the packages that call survival. There are stillissues with the rms package which I am working out with Frank H.
Changes in version 2.36-1
27 Oct 2010: Finish corrections and test to the new code. It now passesthe checks. The predict.coxph routine now does strata and standard errorscorrectly, factors propogate through to predictions, and numerous small errors are addressed. Predicted survival curves for a Cox model has beenrewritten in noweb and expanded. Change the version number to 2.36-1.
17 Oct 2010: Per a request from Frank Harrell (interaction with his library),survfit.coxph no longer reconstructs the model frame unless it really needsit: in some cases the 'x' and 'y' matrices may be sufficient, and may besaved in the result. Add an argument "mf" to model.matrix.coxph for more efficient interaction when a parent routine has already recovered the model frame.In general, we are trying to make use of model.matrix.coxph in many of theroutines, so that the logic contained there (remove cluster() calls, pullout strata, how to handle intercepts) need not be replicated in multiple places.
12 Oct 2010: Fix a bug in the modified lower limits for survfit (Dory & Korn).A logical vector was being inadvertently converted to numeric. Pointed outby Andy Mugglin. A new case was added to the test suite.
Changes in version 2.35
15 July 2010: Add a coxph method for the logLik function. This is used bythe AIC function and was requested by a user.
29 July 2010: Fix 2 bugs in pyears. The check for a US rate table was off(minor effect on calculations), and there was a call to julian which assumedthat the origin argument could be a vector.
21 July 2010: Fix a problem pointed out by a user: calling survfit with almosttied times, e.g., c(2, sqrt(2)^2), could lead to an inconsistent result. Someparts of the code saw these as 2 unique values per the unique() function, someas a single value using the results of table(). We now pre-round the inputtimes to one less decimal digit than the max from .Machine$double.digits.Also added the noweb.R processing function from the coxme package, so thatthe noweb code can be extracted "on the fly" during installation usingcommands in the configure and cleanup scripts.
11 July 2010: A rewrite of the majority of the survfit.coxph code. The primarybenefits are 1: finally tracked down and eliminated the bug for standard errorsof case weights + Cox survival + Efron method; 2: the individual=TRUE and FALSEoptions now use the same underlying code for curves, before there were someoptions valid only for one or the other; 3: code was rewritten using noweb with a considerable increase in documentation; 4: during the verificationprocess some errors were found in the test suite and corrected, e.g., a typo in my book led to failure of an all.equal test in book4.R. Similarto the rewrite for survfit several years ago, the new code has far less useof .C to help transparency.
21 May 2010: Fix bug in summary.survfit. For a survival curve from a Cox modelwith start,stop data, the 'times' argument would generate an error.
24 May 2010: Fix an annoyance in summary.survfit. When the survival data had an event or censor at time 0 and summary is called with a times argument,then my constructed call to approx() would have duplicate x values. The answerwas always right, but approx has begun to print a bothersome warning message. A small change to the constructed argument vector avoids it.
7 April 2010: Minor bug pointed out by Fredrik Lundgren. In survfit if themethod was KM (default) and error = Tsiatis an error message results. Simplefix: code went down the wrong branch.
24 Feb 2010: Serious bug pointed out by Kevin Buhr. In Surv(time1, time2,stat)if there were i) missing values in time1 and/or time2, ii) illegal valuesets with time1 >=time2, and iii) all the instances of ii do not preceed allthe instances of i, then the wrong observation (not the illegal) will be thrown out. Repaired, and a new test added.Minor updates to 3 test files: survreg2, testci, ratetable.
8 Feb 2010: Bug pointed out by Heinz Tuechler – if a subscript was dropped froma rate table the 'type' attribute got dropped, e.g. survexp.usr[,1,,].
26 Jan 2010: At the request of Alex Bokov, added the xmax, xscale, and funarguments to points.survfit.
26 Jan 2010: Fix bug pointed out by Thomas Lumley – with case weights <1 a Cox model with (start, stop) input would inappropriately decide it needed to dostep halving to find a solution, eventually failing to converge. It wastreating a loglik >0 as an indication of failure, but such values arise forsmall case weights. Let L(w) be the loglik for a data set where everyone isgiven a weight of w, then L(w)= wL(1) - d log(w) where d=number of deaths inthe data. For small enough w positivity of L(w) is certain.
25 Jan 2010: Fix bug in summary.ratetable pointed out by Heinze Tuechler. Addeda call to the function to the test suite as well.
15 Dec 2009: Two users pointed out a bug that crept into survreg() with acluster statement, when a t(x)fix, but in response I added another test that more formally checks thedfbeta residuals and found a major oversight for the case of multiplestrata.
14 Dec 2009: 1.Fix bug in frailty.xxx, if there is a missing value in the levelsit gets counted by "length(unique(x))" (frailty is called before NAremoval.) 2.SurvfitCI had an incorrect CI with case weights, and 3. insurvreg a call to resid instead of residuals.survreg, before the classwas attached.
11 Nov 2009: The 'type' argument does not make sense for plot.survfit. (If type='p', should one plot the tops of the step function, the bottoms, orboth?). Make it explicitly disallowed in response to an R-help query,rather than the confusing error message that currently arose.
28 Oct 2009: The basehaz function would reorder the labels of the stratafactor. Not a bug really, but a "why do this?" Unintended consequence ofa character -> factor conversion.
1 Oct 2009: Fix a bug pointed out by Ben Domingue. There was one if-then-elsepath into step-halving in the frailty.controldf routine that would refer toa non-existent variable. A very rarely followed path, obviously, and withthe obvious fix. The mathematics of the update was fine.
30 Sep 2009: For coxph and model.matrix.coxph, re-attach theattributues lost from the X matrix when the intercept is removed,i.e., X <- X[,1]. In particular, some downstream libraries depend onthe assign attribute. For predict.coxph remove an earlier edit so that a single variable model+ type='terms' returns a matrix, not a vector. This is expected by the termplot() function. It led to a whole lot of changes in the test suiteresults, though, due to more "matrix" printouts.
4 Sep 2009: Added a model.matrix.coxph and model.frame.coxph methods. Themodel.matrix.default function ceased to work for coxph models sometimebetween R 2.9 and 2.9.2 (best guess). This wasn't picked up in the testsuite but rather by failure of 3 packages that depend on survival. Also addeda test. Update CRAN since this broke other's packages.
20 Aug 2009: One more fix to predict.coxph. It needed to use delete.response(Terms) rather than Terms, so as to not look for (unnecessarily)the response variable when the newdata argment is used. Pointed out by MichaelConklin.
17 Aug 2009: Small bug in survfit.coxph.null pointed out by Frank Harrell. The'n' component would be missing if the input data included strata, i.e., theinitial model had used x=TRUE. He also pointed out the fix.
10 June 2009: Fix an error pointed out by Nick Reich, who was the first to useinterval censored data + user defined distribution in survreg, jointly. Therewas no test case and creating one uncovered several errors (but only for thiscombination). All the error cases led to catastrophic failure, highlightingthe extreme rarity of a user requesting this combination.
2 June 2009: Surv(time1, time2, status, type='interval') would fail for an NAstatus code. Pointed out by Achim Zeilus.
22 May 2009: Allow single subscripts to rate tables, e.g. survexp[1:10: . Returns a simple vector of values. The str() function does this to print outa short summary. Problem pointed out by Heinz Tuechler.
21 May 2009: Create a test case for factor variables/newdata/predict for coxph and survreg. This led to a set of minor fixes; the code is now in line withthe R standard for model functions. One consequence is that model.frame.coxphand model.frame.survreg are no longer needed, so have been removed.
20 May 2009: The manual page for survfit was confusing, since it tries to document both the standard KM (formula method) and the coxph method. I'vesplit them out so that now survfit documents only the basic method and points a user the appropriate specialized page.
1 May 2009: The anova.coxph function was incorrect for models with a strataterm. Fixed this, and made chisquare tests the default.
22 April 2009: The coxph code had an override to iter and eps, making both ofthem more strict for a penalized model. However, the overall default valueshave changed over time, so that these lines actually decreased accuracy - theopposite of their intent. Removed the lines. Also removed the iter.miss andeps.miss components (on which this check depended) from coxph.control, whichmakes that function match its documentation.
Changes in version 2.34 and earlier
Merge of the TMT source code tree with the Lumley code tree
Issues/decisions in remerging the Mayo and R code: For most of routines, it was easier to start with the Lumley code and addthe Therneau fixes. This is because Tom had expanded a lot of partial matches, e.g., fit$coef in the TT code vs fit$coefficients. Routines withsubstantial changes were, of course, a special case.The most common change is an is.R() construct to choose class vs oldClass.
xtras.R: Move anova.coxph and anova.coxphlist to their ownsource files.The remainder of the code is R only.
survsum: removed from package
survreg.old: has been removed from the package
survfit.s: Depreciate the "formula with no ~1" optionMayo code for [ allows for reordering curvesSeparate out the R "basehaz" function as a separate source file
survfit.km.s: The major change of did not get copied into R, so lots ofchanges. R had "new.time" and Splus 'start.time' for the same argument. Allowthem both as synonyms.The output structure also changed: adapt the new one. This is mostly somename changes in the components, removing unneeded redundancies created bya different programmer.
survfit.coxph.s: TMT code finally fixed the "Can't (yet) to case weights" problem. There must have been 10 years been the intent and execution.
survexp.s: Add "bareterms" function from R, which replaces a prior use ofterms.inner (in Splus but not R).
survdiff.s: R code had the old (incorrect) expected <- sum(1-offset), sincecorrected to sum(-log(offset)) .
summary.coxph.s: This was a mess, since Tom and I had independently made theaddition of a print.summary.coxph function. Below, TMT means that it was thechoice in the Splus code, TL means that it was the choice in R1. Put the coef=T argument in the print function, not summary (TMT)2. Change the output's name from coef to coefficients (suggestion ofPeter Dalgaard). Also change one column name to Pr(>|z|) for R.3. Remove last vestiges of a reference to the 'icc' component (TMT)4. Do not include score, rscore, naive.var in the result (TL)5. Do include loglik in the result (TMT)6. Compute the test statistics (loglik, Wald, etc) in the summaryfunction rather than in the print.summary function (TL)7. Remove the digits option from summary, it belongs in print.summary.(neither)
strata.s: R code added a sep argument, this is okR changed the character string NA to as.character(NA). Not okay1. won't work with Splus, 2. This is a label, designed for printing, and so it should be a character string.
residuals.coxph.s: R had added type='partial'. (Which I'm not very partial to,from their statistical properties. But they are legal, and I assume thatsomeone requested them).
print.survfit.s: Rewritten as a part of the general survival rewrite. Createdthe function 'survmean' which does most of the work, and is shared by print andsummary, so that the values from 'print' are now available.Fix the minmin function: min(NULL) gives NA in Splus, which is the rightanswer for a non-estimable median, but Inf in R. Explicitly deal with thiscase, and add a bunch of comments.R had the print.rmean option, this has been expanded to a more generalrmean option that allows setting the cutoff point.R added a print.n option with 3 choices, my code includes all 3 in the output.
lines.survfit.s: The S version has a new block of code for guessing "firstx" moreintellegently when it is missing. (Or, one hopes is is more intellegent!)
coxph.control.s: The R code had tighter tolerances (eps= 1e-9) than Splus (1e-4) anda higher iterationn count (20 vs 10). Set eps to 1e-8 and iter to 15, mostly bending to the world. The tighteriteration is defensible, but I still maintain that a Cox model that takes >10 iterations is not going to finish if you give it 100. The likelihood surfaceis almost perfectly quadratic near the minimum. (Not true for survreg by theway).
: In Surv, the Mayo code creates NA's out of invalid status values orstart,stop pairs, rather than a stop and error message. This is toallow for examplecoxph(Surv(time1,time2, status).... , subset=(goodlines))succeed, when "goodlines" is the subset with correct values.
Older changes
25SepO7: How embarrassing – someone pointed out that I had DaveHarrington's name spelled wrong in the options to survfit.coxph!
9Jul07: In a model with offsets, survreg mistakenly omitted the offsetfrom the returned linear.predictor component.
10May07: Change summary.coxph so that it returns an object of classsummary.coxph, and add a print method for that object.
22Jun06: Update match.ratetable, so that more liberal matches are nowallowed. For instance, 'F', 'f', 'female', 'fem', 'FEMA', etc are now all considered matches to the dimname "female" in survexp.us.
26Apr06: Fix bug in summary.survfit, pointed out by Bob Treder. Withthe times option, the value of n.risk would be wrong for "in between"times; e.g., the data had events and/or censoring at times 10,20,... and we asked for printout at time 15. It should give n.risk at time20, it was returning the value at time 10. Interestingly, the code hada very careful treatment of this case, along with an example in thecomments, and the "the right answer is" part of the comment was wrong!So the code correctly computed an incorrect answer. Added anothertest case to the test suite, survtest2.
21Apr06: Fix problem in [.survfit, pointed out by Thomas Lumley. Iffit <- survfit(Surv(time, status) ~ ph.ecog, lung), then fit[2:1] didnot reorder the output correctly. I had never tested putting the subscripts in non-increasing order.
7Feb06: Fix a problem in the coxph iteration (coxfit2.c, coxfit5, agfit3,agfit5, agexact). It will likely never catch anyone again, even if I didn't fix it. In a particular data set, beta overshot and step halvingwas invoked. During step halving, a loglik happened to occur that waswithin eps of the prior step's loglik — and the routine decided, erroneously,that it had converged! (A nice quadratic curve, a first guess b1 to the left of the desired max of the curve. The next guess b2 overshot and ends up with a lower loglik, on the right side of the max. Back up to the midpoint of b1 and b2, and this guess, still to the right of the max (stilltoo large) has EXACTLY the same value of y as b1 did, but on the other sideof the max from b1. "Last two guesses give the same answer, I'm done" saidthe routine).
27Sep05: Found and fixed a nasty bug in survfit. When method='fh2' andthere were multiple groups I had a subscripting bug, leading to vectorsthat were supposed to be the same length, but weren't, passed into C.The resulting curves were obviously wrong – survival precipitously drops to zero.
5May05: Add the drop=F arg to one subscripting selection in survfit.coxph.temp <- (matrix(surv$y, ncol=3))[ntime,,drop=F] If you selected only 1 time point (1 row) in the final output, the codewould fail. Pointed out by Cindy Crowson.
18Apr05: Bug in survfit.turnbull. The strata variable was not beingfilled in (number of points per curve). So if multiple curves weregenerated at once, i.e., with something on the right hand side of ~ inthe formula, all the downstream print/plot functions would not workwith the result.
8Feb05: Fix small typo in is.ratetable, introduced on 24Nov04: (Todaywas the first time I added to the standard library, and thus endedup using the non-verbose mode.)
8Feb05: Add the data.frame argument to pyears. This causes the outputto contain a dataframe rather than a set of arrays. It is useful forfurther processing of the data using Poisson regression.
7Feb05: Modified print.ratetable to be more useful. It now tells about the ratetable, rather than printing all of its values.
8Dec04: Fix a small bug in survfit.turnbull. If there are people left censored before the firsttime point of any other kind (interval, exact, or right censored),the the plotted height of the curve from "rightmost left censoring time"to "leftmost event time", that is the flat tail on the left, was atthe wrong height.Added another test to testreg/reliability.s for this.
24Nov04: Change is.ratetable to give longer messages