Skip to content

Commit

Permalink
Added pkgdown website
Browse files Browse the repository at this point in the history
  • Loading branch information
chjackson committed Aug 22, 2023
1 parent 830f3e3 commit 70a65a6
Show file tree
Hide file tree
Showing 155 changed files with 28,366 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ vignettes/_region_.tex
vignettes/Sweave.sty
^revdep$
^man-roxygen$
^_pkgdown\.yml$
^docs$
^pkgdown$
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ R/#*
/temp/
/revdep/
inst/doc

5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: flexsurv
Type: Package
Title: Flexible Parametric Survival and Multi-State Models
Version: 2.3
Date: 2023-05-26
Date: 2023-08-22
Authors@R: c(person("Christopher", "Jackson",
email="chris.jackson@mrc-bsu.cam.ac.uk",
role=c("aut", "cre")),
Expand Down Expand Up @@ -62,7 +62,8 @@ Suggests:
testthat,
TH.data,
broom
URL: https://github.com/chjackson/flexsurv-dev
URL: https://github.com/chjackson/flexsurv-dev,
http://chjackson.github.io/flexsurv-dev/
BugReports: https://github.com/chjackson/flexsurv-dev/issues
VignetteBuilder: knitr
LazyData: yes
Expand Down
11 changes: 11 additions & 0 deletions R/flexsurvmix.R
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,17 @@ inv.transform.res <- function(x, dlists) {
c(probs, pcov, unlist(est))
}

##' Model frame from a flexsurvmix object
##'
##' Returns a list of data frames, with each component containing the
##' data that were used for the model fit for that mixture component.
##'
##' @param formula Fitted model object from \code{\link{flexsurvmix}}.
##'
##' @param ... Further arguments (currently unused).
##'
##' @return A list of data frames
##'
##' @export
model.frame.flexsurvmix <- function(formula, ...)
{
Expand Down
20 changes: 20 additions & 0 deletions R/flexsurvreg.R
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,14 @@ form.model.matrix <- function(object, newdata, na.action=na.pass, forms=NULL){
}


##' Variance-covariance matrix from a flexsurvreg model
##'
##' @inheritParams logLik.flexsurvreg
##'
##' @return Variance-covariance matrix of the estimated parameters, on
##' the scale that they were estimated on (for positive parameters
##' this is the log scale).
##'
##' @export
vcov.flexsurvreg <- function (object, ...)
{
Expand Down Expand Up @@ -1124,6 +1132,18 @@ model.matrix.flexsurvreg <- function(object, par=NULL, ...)
if (is.null(par)) compress.model.matrices(x$data$mml) else x$data$mml[[par]]
}

##' Log likelihood from a flexsurvreg model
##'
##' @param object A fitted model object of class
##' \code{\link{flexsurvreg}}, e.g. as returned by
##' \code{flexsurvreg} or \code{flexsurvspline}.
##'
##' @param ... Other arguments (currently unused).
##'
##' @return Log-likelihood (numeric) with additional attributes \code{df} (degrees of freedom, or number
##' of parameters that were estimated), and number of observations \code{nobs} (including observed
##' events and censored observations).
##'
##' @export
logLik.flexsurvreg <- function(object, ...){
val <- object$loglik
Expand Down
12 changes: 12 additions & 0 deletions R/mstate.R
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,18 @@ print.fmsm <- function(x, ...){
}
}

##' Akaike's information criterion from a flexible parametric multistate model
##'
##' Defined as the sum of the AICs of the transition-specific models.
##'
##' @param object Object returned by \code{\link{fmsm}} representing a multistate model.
##'
##' @param k Penalty applied to number of parameters (defaults to the standard 2).
##'
##' @param ... Further arguments (currently unused).
##'
##' @return The sum of the AICs of the transition-specific models.
##'
##' @export
AIC.fmsm <- function(object,...,k=2){
nmods <- length(object)
Expand Down
7 changes: 4 additions & 3 deletions R/predict.flexsurvreg.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@
#'
#' @param ... Not currently used.
#'
#' @return A \code{\link{tibble}} with same number of rows as \code{newdata}
#' and in the same order. If multiple predictions are requested, a
#' \code{\link{tibble}} containing a single list-column of data frames.
#' @return A \code{\link{tibble}} with same number of rows as
#' \code{newdata} and in the same order. If multiple predictions are
#' requested, a \code{\link{tibble}} containing a single list-column
#' of data frames.
#'
#' For the list-column of data frames - the dimensions of each data frame
#' will be identical. Rows are added for each value of \code{times} or
Expand Down
2 changes: 1 addition & 1 deletion R/survsplinek.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##' Royston/Parmar spline survival distribution functions
##' Royston/Parmar spline survival distribution functions with one argument per parameter
##'
##' Probability density, distribution, quantile, random generation, hazard,
##' cumulative hazard, mean and restricted mean functions for the Royston/Parmar
Expand Down
6 changes: 3 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ rbase <- function(dname, n, ...){
}


##' Generic function to find restricted mean survival of a distribution
##' Generic function to find restricted mean survival time for some distribution
##'
##' Generic function to find the restricted mean of a distribution, given the
##' equivalent probability distribution function using numeric integration.
##' equivalent probability distribution function, using numeric integration.
##'
##' This function is used by default for custom distributions for which an
##' rmst function is not provided.
##' \code{rmst} function is not provided.
##'
##' This assumes a suitably smooth, continuous distribution.
##'
Expand Down
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
flexsurv-dev
============
flexsurv
========

The development repository for the [flexsurv](http://cran.r-project.org/package=flexsurv) R package for parametric survival modelling.
The [flexsurv](http://cran.r-project.org/package=flexsurv) R package for parametric survival and multi-state modelling.


## Key features

* Parametric models for time-to-event (survival) data. Data may be right-censored, and/or left-censored, and/or left-truncated. Several built-in parametric distributions are available, including a very flexible model based on splines (Royston and Parmar).

* Any user-defined parametric model can be employed by supplying R functions defining the distribution.

* Covariates can be included using a (log-)linear model on any parameter of any distribution. This typically defines an accelerated failure time or proportional hazards model.

* Multi-state models for continuously-observed data can be defined by piecing together transition-specific parametric models of any kind. (For intermittently-observed data, see instead the [msm](http://CRAN.R-project.org/package=msm) package.)


## Learn more

[User guide (PDF)](articles/flexsurv.pdf).

[Guide to multi-state modelling in flexsurv](articles/multistate.pdf).

[Full reference manual](reference/index.html) for all the package's functions.

[Paper in Journal of Statistical Software (Jackson 2016)](https://www.jstatsoft.org/article/view/v070i08). Mostly the same as the user guide, but not kept up to date.


## Installation (stable CRAN version)
Expand Down
105 changes: 105 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
url: http://chjackson.github.io/flexsurv-dev/
template:
bootstrap: 5
reference:
- title: Fitting survival models
- contents:
- flexsurvreg
- flexsurvspline
- flexsurvrtrunc
- survrtrunc
- title: Getting results from survival models
- contents:
- summary.flexsurvreg
- standsurv
- coef.flexsurvreg
- normboot.flexsurvreg
- hr_flexsurvreg
- vcov.flexsurvreg
- simulate.flexsurvreg
- plot.flexsurvreg
- lines.flexsurvreg
- plot.standsurv
- summary.flexsurvrtrunc
- plot.survrtrunc
- lines.survrtrunc
- title: Multi-state models based on transition-specific hazards
- contents:
- fmsm
- pars.fmsm
- pmatrix.fs
- pmatrix.simfs
- totlos.fs
- totlos.simfs
- sim.fmsm
- simfs_bytrans
- bootci.fmsm
- pfinal_fmsm
- simfinal_fmsm
- ajfit_fmsm
- msfit.flexsurvreg
- title: Competing risks and multi-state models based on mixtures
- contents:
- flexsurvmix
- get_basepars
- mean_flexsurvmix
- pdf_flexsurvmix
- probs_flexsurvmix
- p_flexsurvmix
- quantile_flexsurvmix
- rmst_flexsurvmix
- simt_flexsurvmix
- fmixmsm
- meanfinal_fmixmsm
- ppath_fmixmsm
- qfinal_fmixmsm
- ajfit
- ajfit_flexsurvmix
- title: Model comparison and checking
- contents:
- logLik.flexsurvreg
- AICc.flexsurvreg
- AICc
- BIC.flexsurvreg
- AIC.fmsm
- nobs.flexsurvreg
- residuals.flexsurvreg
- coxsnell_flexsurvreg
- title: Probability distributions
- contents:
- Survspline
- Survsplinek
- WeibullPH
- GenGamma
- GenGamma.orig
- GenF
- GenF.orig
- Gompertz
- Llogis
- hexp
- Hexp
- mean_exp
- rmst_exp
- qgeneric
- title: Tools for using flexsurv with tidyverse
- contents:
- predict.flexsurvreg
- tidy.flexsurvreg
- tidy.standsurv
- augment.flexsurvreg
- glance.flexsurvreg
- title: Datasets
- contents:
- bc
- bos
- title: Miscellaneous / advanced tools
- contents:
- model.frame.flexsurvreg
- model.matrix.flexsurvreg
- model.frame.flexsurvmix
- basis
- rmst_generic
- unroll.function
- title: Package overview
- contents:
- flexsurv-package
Loading

0 comments on commit 70a65a6

Please sign in to comment.