-
Notifications
You must be signed in to change notification settings - Fork 92
Adds support for flexsurvspline engine for survival_reg model spec #831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
27f267e
Adds support for flexsurvspline engine for survival_reg model spec
mattwarkentin 92abf70
Add PR number to NEWS
mattwarkentin 68e6b6a
leave deprecated `surv_reg()` as is
hfrick 387d316
make `k` tunable
hfrick 4152982
update `inst/models.tsv`
hfrick 9671db0
update engine docs and knit
hfrick 99b86e8
document()
hfrick 5aadb88
update news, add contributor
hfrick eff3054
import also the generic
hfrick 3cdca0f
Merge branch 'main' into mattwarkentin-main
topepo 52003ef
remove engine arg from template
topepo ec6caf6
notes about case weights
topepo dcbd28f
render docs
topepo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#' Flexible parametric survival regression | ||
#' | ||
#' [flexsurv::flexsurvspline()] fits a flexible parametric survival model. | ||
#' | ||
#' @includeRmd man/rmd/survival_reg_flexsurvspline.md details | ||
#' | ||
#' @name details_survival_reg_flexsurvspline | ||
#' @keywords internal | ||
NULL | ||
|
||
# See inst/README-DOCS.md for a description of how these files are processed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
```{r, child = "aaa.Rmd", include = FALSE} | ||
``` | ||
|
||
`r descr_models("survival_reg", "flexsurvspline")` | ||
|
||
## Tuning Parameters | ||
|
||
This model has one engine-specific tuning parameter: | ||
|
||
* `k`: Number of knots in the spline. The default is `k = 0`. | ||
|
||
## Translation from parsnip to the original package | ||
|
||
`r uses_extension("survival_reg", "flexsurvspline", "censored regression")` | ||
|
||
```{r flexsurvspline-creg} | ||
library(censored) | ||
|
||
survival_reg() %>% | ||
set_engine("flexsurvspline") %>% | ||
set_mode("censored regression") %>% | ||
translate() | ||
``` | ||
|
||
## Other details | ||
|
||
The main interface for this model uses the formula method since the model specification typically involved the use of [survival::Surv()]. | ||
|
||
For this engine, stratification cannot be specified via [`strata()`], please see [flexsurv::flexsurvspline()] for alternative specifications. | ||
|
||
```{r child = "template-survival-mean.Rmd"} | ||
hfrick marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
## Case weights | ||
|
||
```{r child = "template-uses-case-weights.Rmd"} | ||
``` | ||
|
||
|
||
## Saving fitted model objects | ||
|
||
```{r child = "template-butcher.Rmd"} | ||
``` | ||
|
||
|
||
## References | ||
|
||
- Jackson, C. 2016. `flexsurv`: A Platform for Parametric Survival Modeling in R. _Journal of Statistical Software_, 70(8), 1 - 33. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
|
||
|
||
For this engine, there is a single mode: censored regression | ||
|
||
## Tuning Parameters | ||
|
||
This model has one engine-specific tuning parameter: | ||
|
||
* `k`: Number of knots in the spline. The default is `k = 0`. | ||
|
||
## Translation from parsnip to the original package | ||
|
||
The **censored** extension package is required to fit this model. | ||
|
||
|
||
```r | ||
library(censored) | ||
|
||
survival_reg() %>% | ||
set_engine("flexsurvspline") %>% | ||
set_mode("censored regression") %>% | ||
translate() | ||
``` | ||
|
||
``` | ||
## Parametric Survival Regression Model Specification (censored regression) | ||
## | ||
## Computational engine: flexsurvspline | ||
## | ||
## Model fit template: | ||
## flexsurv::flexsurvspline(formula = missing_arg(), data = missing_arg(), | ||
## weights = missing_arg()) | ||
``` | ||
|
||
## Other details | ||
|
||
The main interface for this model uses the formula method since the model specification typically involved the use of [survival::Surv()]. | ||
|
||
For this engine, stratification cannot be specified via [`strata()`], please see [flexsurv::flexsurvspline()] for alternative specifications. | ||
|
||
|
||
|
||
Predictions of type `"time"` are predictions of the mean survival time. | ||
|
||
## Case weights | ||
|
||
|
||
This model can utilize case weights during model fitting. To use them, see the documentation in [case_weights] and the examples on `tidymodels.org`. | ||
|
||
The `fit()` and `fit_xy()` arguments have arguments called `case_weights` that expect vectors of case weights. | ||
|
||
|
||
## Saving fitted model objects | ||
|
||
|
||
This model object contains data that are not required to make predictions. When saving the model for the purpose of prediction, the size of the saved object might be substantially reduced by using functions from the [butcher](https://butcher.tidymodels.org) package. | ||
|
||
|
||
## References | ||
|
||
- Jackson, C. 2016. `flexsurv`: A Platform for Parametric Survival Modeling in R. _Journal of Statistical Software_, 70(8), 1 - 33. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.