mlsurv: Fit proportional hazards survival models

Description Usage Arguments Value Examples

View source: R/mlsurv.R

Description

Fit proportional hazards survival models

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
mlsurv(
  formula,
  distribution,
  df = NULL,
  powers = NULL,
  rcs = TRUE,
  data,
  from.null = NULL,
  ...
)

Arguments

formula

A model formula, where the left-hand side is a Surv object.

distribution

A parametric distribution for the baseline hazard. Possible values are exponential, weibull, gompertz, rp, logchazard, and loghazard. rp is equivalent to a logchazard model with restricted cubic splines (argument rcs = TRUE).

df

Represents the number of degrees of freedom used for the restricted cubic splines when flexibly modelling the baseline hazard. Only required when rcs = TRUE.

powers

A vector representing the degree of the fractional polynomials used to model the baseline hazard (with a maximum degree of 2). Only required when rcs = FALSE.

rcs

Use restricted cubic splines when flexibly modelling the baseline hazard? Defaults to TRUE, and the alternative is using fractional polynomials.

data

A data frame containing all variables required for fitting the model. Can be a tibble object.

from.null

A vector of starting values for the null model (used to get improved starting values). This is mostly useful when experiencing issues with default starting values or convergence issues.

...

Further arguments passed to merlin.

Value

An object of class mlsurv.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Weibull model
library(survival)
data("pbc.merlin", package = "merlin")
fit <- mlsurv(
  formula = Surv(stime, died) ~ trt,
  distribution = "weibull",
  data = pbc.merlin
)
summary(fit)

# Royston-Parmar model with 3 degrees of freedom
fit <- mlsurv(
  formula = Surv(stime, died) ~ trt,
  distribution = "rp",
  df = 3,
  data = pbc.merlin
)
summary(fit)

## Not run: 
# Flexible parametric model on the log-hazard scale with fractional polynomials
fit <- mlsurv(
  formula = Surv(stime, died) ~ trt,
  distribution = "loghazard",
  powers = c(0, 1),
  rcs = FALSE,
  data = pbc.merlin
)
summary(fit)

## End(Not run)

merlin documentation built on July 8, 2020, 7:31 p.m.