From 33ac0d327f88076564158d48e0386df301c78052 Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Sat, 8 Feb 2020 16:10:02 +0100 Subject: [PATCH 1/3] spell check --- .travis.yml | 10 ++++++++++ DESCRIPTION | 16 +++------------- NEWS.md | 11 ++++++----- R/add-functions.R | 2 +- R/predict.R | 2 +- README.md | 2 +- cran-comments.md | 2 +- man/add_hazard.Rd | 2 +- man/predictSurvProb.pamm.Rd | 4 +++- tests/testthat/test-cumulative-coefficients.R | 16 ++++++++-------- tests/testthat/test-predict-functions.R | 6 +++--- 11 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index e79cf3dc..dfa52001 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,16 @@ jobs: - Rscript -e 'remotes::install_cran("pammtools", dependencies = TRUE)' - Rscript -e 'remotes::install_cran("TBFmultinomial", dependencies = TRUE)' - Rscript -e 'remotes::install_github("jimhester/covr")' + - Rscript -e 'remotes::install_cran("pkgdown")' + - Rscript -e 'remotes::install_cran("scam")' + - Rscript -e 'remotes::install_cran("RColorBrewer")' + - Rscript -e 'remotes::install_cran("timereg")' + - Rscript -e 'remotes::install_cran("grid")' + - Rscript -e 'remotes::install_cran("gridExtra")' + - Rscript -e 'remotes::install_cran("coxme")' + - Rscript -e 'remotes::install_cran("knitr")' + - Rscript -e 'remotes::install_cran("rmarkdown")' + - Rscript -e 'remotes::install_cran("pec")' # whitelist branches: only: diff --git a/DESCRIPTION b/DESCRIPTION index 78a14bfb..1cf1318a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: pammtools Title: Piece-Wise Exponential Additive Mixed Modeling Tools for Survival Analysis -Version: 0.2.0 -Date: 2020-01-30 +Version: 0.2.1 +Date: 2020-02-07 Authors@R: c( person("Andreas", "Bender", , "andreas.bender@stat.uni-muenchen.de", role = c("aut", "cre"), comment=c(ORCID = "0000-0001-5628-8611")), person("Fabian", "Scheipl", , "fabian.scheipl@stat.uni-muenchen.de", role = c("aut"))) @@ -30,17 +30,7 @@ Imports: mvtnorm, pec Suggests: - RColorBrewer, - scam, - coxme, - testthat, - timereg, - knitr, - rmarkdown, - grid, - gridExtra, - covr, - pkgdown + testthat License: MIT + file LICENSE LazyData: true URL: https://github.com/adibender/pammtools diff --git a/NEWS.md b/NEWS.md index 6eb6081f..c10ab8c4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,10 @@ -# pammtools 0.2.0 +# pammtools 0.2.1 * Adds a new interface for model estimation called `pamm`, which is a thin wrapper around `mgcv::gam` with some arguments pre-set. -* Adds S3 methods `predict.pamm` and `predictSurvProb.pamm` -* Adds support for model evaluation using package **`pec`** +* Adds S3 method `predict.pammpredictSurvProb.pamm` +* Adds support and vignette for model evaluation using package **`pec`** * Fixed bug when CIs were calculated simulation based and model contained factor variables +* Removed unnecessary dependencies in Imports/Suggests # pammtools 0.1.15 * Interface for specification of data transformation in `as_ped` changed. The vertical bar `|` is no longer necessary to indicate concurrent or cumulative effects @@ -32,12 +33,12 @@ Allows to calculate (log-)hazard ratios. * Added new vignette linking to tutorial paper (online only) # pammtools 0.1.9 -* maintainance update: fixes CRAN issues due to new RNG +* maintenance update: fixes CRAN issues due to new RNG # pammtools 0.1.8 ## documentation -* Updates to cummulative effect vignette +* Updates to cumulative effect vignette * Updates to time-dependent covariate vignette (+ data transformation) * Update citation information diff --git a/R/add-functions.R b/R/add-functions.R index 3aaa880c..624b13ea 100644 --- a/R/add-functions.R +++ b/R/add-functions.R @@ -128,7 +128,7 @@ preproc_reference <- function(reference, cnames, n_rows) { #' Add (cumulative) hazard based on the provided data set and model. #' If \code{ci=TRUE} confidence intervals (CI) are also added. Their width can #' be controlled via the \code{se_mult} argument. The method by which the -#' CI are calculated can be specifie by \code{ci_type}. +#' CI are calculated can be specified by \code{ci_type}. #' This is a wrapper around #' \code{\link[mgcv]{predict.gam}}. When \code{reference} is specified, the #' (log-)hazard ratio is calculated. diff --git a/R/predict.R b/R/predict.R index 5ec8fcd4..f4257b9f 100644 --- a/R/predict.R +++ b/R/predict.R @@ -3,7 +3,7 @@ #' @inheritParams pec::predictSurvProb #' @importFrom pec predictSurvProb #' @importFrom purrr map -#' @param times A vector of times for which predictions should be generated. +#' #' @export predictSurvProb.pamm <- function( object, diff --git a/README.md b/README.md index 37b7cf02..21c47ca8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ devtools::install_github("adibender/pammtools") **`pammtools`** facilitates the estimation of Piece-wise exponential Additive Mixed Models (PAMMs) for time-to-event data. -PAMMs can be represeted as generalized additive models and can therefore +PAMMs can be represented as generalized additive models and can therefore be estimated using GAM software (e.g. **`mgcv`**), which, compared to other packages for survival analysis, often offers more flexibility w.r.t. to the specification of covariate effects (e.g. non-linear, time-varying effects, cumulative effects, etc.). diff --git a/cran-comments.md b/cran-comments.md index ad02a786..726fc6e2 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,5 @@ ## Test environments -* Local R 3.6.1 +* Local Ubuntu Linux R 3.6.2 * R release and devel with Travis CI * Appveyor (patched and devel) * win-builder diff --git a/man/add_hazard.Rd b/man/add_hazard.Rd index 0328516f..3a84c0a5 100644 --- a/man/add_hazard.Rd +++ b/man/add_hazard.Rd @@ -78,7 +78,7 @@ Can be either bare unquoted variable name or character. Defaults to \code{"intle Add (cumulative) hazard based on the provided data set and model. If \code{ci=TRUE} confidence intervals (CI) are also added. Their width can be controlled via the \code{se_mult} argument. The method by which the -CI are calculated can be specifie by \code{ci_type}. +CI are calculated can be specified by \code{ci_type}. This is a wrapper around \code{\link[mgcv]{predict.gam}}. When \code{reference} is specified, the (log-)hazard ratio is calculated. diff --git a/man/predictSurvProb.pamm.Rd b/man/predictSurvProb.pamm.Rd index 1001f134..eb6715f2 100644 --- a/man/predictSurvProb.pamm.Rd +++ b/man/predictSurvProb.pamm.Rd @@ -13,7 +13,9 @@ probabilities} \item{newdata}{A data frame containing predictor variable combinations for which to compute predicted survival probabilities.} -\item{times}{A vector of times for which predictions should be generated.} +\item{times}{A vector of times in the range of the response variable, e.g. +times when the response is a survival object, at which to return the +survival probabilities.} } \description{ S3 method for pamm objects for compatibility with package pec diff --git a/tests/testthat/test-cumulative-coefficients.R b/tests/testthat/test-cumulative-coefficients.R index 2e842cf9..b7baea4e 100644 --- a/tests/testthat/test-cumulative-coefficients.R +++ b/tests/testthat/test-cumulative-coefficients.R @@ -6,14 +6,14 @@ test_that("Cumulative coefficients work", { df$x1 <- as.factor(rep(letters[1:3], each = nrow(df) / 3L)) ## aalen model - library(timereg) - mod <- aalen(Surv(days, status) ~ x1 + age, data = df) - cumu_coef_aalen <- get_cumu_coef( - mod, - df, - terms = c("(Intercept)", "x1")) - expect_data_frame(cumu_coef_aalen, nrows = 42L, ncols = 6L) - expect_equal(unique(cumu_coef_aalen$variable), c("(Intercept)", "x1b", "x1c")) + # library(timereg) + # mod <- aalen(Surv(days, status) ~ x1 + age, data = df) + # cumu_coef_aalen <- get_cumu_coef( + # mod, + # df, + # terms = c("(Intercept)", "x1")) + # expect_data_frame(cumu_coef_aalen, nrows = 42L, ncols = 6L) + # expect_equal(unique(cumu_coef_aalen$variable), c("(Intercept)", "x1b", "x1c")) ## pam ped <- as_ped(df, formula = Surv(days, status)~ x1 + age) diff --git a/tests/testthat/test-predict-functions.R b/tests/testthat/test-predict-functions.R index 6283dd3f..c23c5b32 100644 --- a/tests/testthat/test-predict-functions.R +++ b/tests/testthat/test-predict-functions.R @@ -10,7 +10,7 @@ context("Predict functions") engine = "bam", method = "fREML", discrete = TRUE) ## predictSurvProb (pec) generic - spmat <- predictSurvProb(pam, tumor[21:23,], times = c(90, 500, 1217)) + spmat <- predictSurvProb.pamm(pam, tumor[21:23,], times = c(90, 500, 1217)) expect_identical( round(spmat, 2), matrix( @@ -24,8 +24,8 @@ context("Predict functions") ) ) - expect_error(predictSurvProb(pam, tumor[21:23,], times = c(90, 500, 2000))) - spmat2 <- predictSurvProb(pam2, tumor[21:23,], times = c(90, 500, 1217)) + expect_error(predictSurvProb.pamm(pam, tumor[21:23,], times = c(90, 500, 2000))) + spmat2 <- predictSurvProb.pamm(pam2, tumor[21:23,], times = c(90, 500, 1217)) expect_identical(round(spmat, 2), round(spmat2, 2)) } From dfbcaf503dca2309c0ebb6966d287faf66069189 Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Sat, 8 Feb 2020 16:37:28 +0100 Subject: [PATCH 2/3] Minor updates (fix travis for pkgdown) --- .travis.yml | 1 + R/rpexp.R | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dfa52001..ce902c70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ jobs: - Rscript -e 'remotes::install_cran("knitr")' - Rscript -e 'remotes::install_cran("rmarkdown")' - Rscript -e 'remotes::install_cran("pec")' + - Rscript -e 'remotes::install_cran("devtools")' # whitelist branches: only: diff --git a/R/rpexp.R b/R/rpexp.R index 13a45b8d..d74fc603 100644 --- a/R/rpexp.R +++ b/R/rpexp.R @@ -1,6 +1,7 @@ #' Draw random numbers from piece-wise exponential distribution. #' -#' This is a copy of the same function from \code{\link[msm]{rpexp}}. +#' This is a copy of the same function from \code{rpexp} from package +#' \pkg{msm}. #' Copied here to reduce dependencies. #' #' @inheritParams msm::rpexp From 406aedb69d54f24501783fbefbb1517f5c2f9121 Mon Sep 17 00:00:00 2001 From: Andreas Bender Date: Sat, 8 Feb 2020 16:57:08 +0100 Subject: [PATCH 3/3] Remove unnecessary library call and fix doi --- DESCRIPTION | 2 +- vignettes/model-evaluation.Rmd | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1cf1318a..dc410b15 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Authors@R: c( Description: The Piece-wise exponential (Additive Mixed) Model (PAMM; Bender and Scheipl (2018) ) is a powerful model class for the analysis of survival (or time-to-event) data, - based on Generalized Additive (Mixed) Models (GA(M)Ms). It offers intuitive specification and robust estimation of complex survival models with stratified baseline hazards, random effects, time-varying effects, time-dependent covariates and cumulative effects (Bender and others (2018) . + based on Generalized Additive (Mixed) Models (GA(M)Ms). It offers intuitive specification and robust estimation of complex survival models with stratified baseline hazards, random effects, time-varying effects, time-dependent covariates and cumulative effects (Bender and others (2018) . pammtools provides tidy workflow for survival analysis with PAMMs, including data simulation, transformation and other functions for data preprocessing and model post-processing as well as visualization. diff --git a/vignettes/model-evaluation.Rmd b/vignettes/model-evaluation.Rmd index f4176031..4ec3c88e 100644 --- a/vignettes/model-evaluation.Rmd +++ b/vignettes/model-evaluation.Rmd @@ -26,7 +26,6 @@ library(ggplot2) theme_set(theme_bw()) library(survival) library(pec) -library(obliqueRSF) ``` In this vignette we illustrate how to obtain model performance measures for