Learn R Programming

icmstate (version 0.2.0)

smoothmsm: Smooth hazard estimation for general multi-state model with interval censored transitions

Description

For a general Markov chain multi-state model with interval censored transitions calculate the NPMLE of the transition intensities. The estimates are returned as an msfit object. The smallest time in the data will be set to zero.

Usage

smoothmsm(
  gd,
  tmat,
  exact,
  formula,
  data,
  deg_splines = 3,
  n_segments = 20,
  ord_penalty = 2,
  maxit = 100,
  tol = 1e-04,
  Mtol = 1e-04,
  conv_crit = c("haz", "prob", "lik"),
  verbose = FALSE,
  prob_tol = tol/10,
  ode_solver = "lsoda",
  ridge_penalty = 1e-06
)

Arguments

gd

A data.frame with the following named columns

id:

Subject idenitifier;

state:

State at which the subject is observed at time;

time:

Time at which the subject is observed;

The true transition time between states is then interval censored between the times.

tmat

A transition matrix as created by transMat

exact

Numeric vector indicating to which states transitions are observed at exact times. Must coincide with the column number in tmat.

formula

Formula to interpret in data for covariates.

data

A data.frame containing a column called 'id' (identifying the subjects in gd) and variables which to interpret in formula.

deg_splines

Degree to use for the B-spline basis functions. Defaults to 3 (cubic B-splines).

n_segments

Number of segments to use for the P-splines. The segments will space the domain evenly. According to Eilers & Marx (2021), it it OK to choose this number very large. Default = 20.

ord_penalty

Order of the P-spline penalty (penalty on the difference between d-order differences of spline coefficients). See Eilers & Marx Section 2.3. Defaults to 2.

maxit

Maximum number of iterations. Default = 100.

tol

Tolerance of the convergence procedure in the E-step. A change in the value of conv_crit in an iteration of less than tol will make the procedure stop.

Mtol

Tolerance of the convergence procedure of the M-step. The M-step consists of an Iteratively Reweighted Least Squares (IRLS) procedure, where the (unobserved) complete-data likelihood is maximized. Default is 1e-4.

conv_crit

Convergence criterion. Stops procedure when the difference in the chosen quantity between two consecutive iterations is smaller than the tolerance level tol. One of the following:

"haz"

Stop when change in maximum estimated intensities (hazards) < tol.

"prob"

Stop when change in estimated probabilities < tol.

"lik"

Stop when change in observed-data likelihood < tol.

Default is "haz". The options "haz" and "lik" can be compared across different methods, but "prob" is dependent on the chosen method. Most conservative (requiring most iterations) is "prob", followed by "haz" and finally "lik".

verbose

Should iteration messages be printed? Default is FALSE

prob_tol

If an estimated probability is smaller than prob_tol, it will be set to zero during estimation. Default value is tol/10.

ode_solver

The integrator to use for solving the ODE's. See ode(). By default, the "lsoda" solver will be used.

ridge_penalty

The ridge penalty to use for estimating risk-adjustment coefficients. Default = 1e-06.

References

Eilers, P.H.C. and Marx, B.D., Practical Smoothing: The Joys of P-splines, Cambridge University Press (2021)