solution_path_function: Estimate Penalized Illness-Death Model Solution Path

View source: R/solution_path_function.R

solution_path_functionR Documentation

Estimate Penalized Illness-Death Model Solution Path

Description

This function estimates penalized illness-death model results along a range of penalty, fused penalty, and smoothing parameters.

Usage

solution_path_function(
  para,
  y1,
  y2,
  delta1,
  delta2,
  Xmat1 = matrix(nrow(length(y1)), ncol = 0),
  Xmat2 = matrix(nrow(length(y1)), ncol = 0),
  Xmat3 = matrix(nrow(length(y1)), ncol = 0),
  hazard,
  frailty,
  model,
  basis1 = NULL,
  basis2 = NULL,
  basis3 = NULL,
  basis3_y1 = NULL,
  dbasis1 = NULL,
  dbasis2 = NULL,
  dbasis3 = NULL,
  penalty,
  lambda_path,
  a,
  penalty_fusedcoef,
  lambda_fusedcoef_path,
  penalty_fusedbaseline = "none",
  lambda_fusedbaseline = 0,
  penweights_list,
  mu_smooth_path,
  ball_L2 = Inf,
  fit_method,
  warm_start = TRUE,
  extra_starts = 0,
  select_tol = 1e-04,
  fusion_tol = 0.001,
  step_size_min = 1e-06,
  step_size_max = 1e+06,
  step_size_init = 1,
  step_size_scale = 0.5,
  step_delta = 0.5,
  maxit = 300,
  conv_crit = "nll_pen_change",
  conv_tol = 1e-06,
  mm_epsilon = 1e-06,
  verbose
)

Arguments

para

A numeric vector of parameters, arranged as follows: the first k_1+k_2+k_3 elements correspond to the baseline hazard parameters, then the k_1+k_2+k_3+1 element corresponds to the gamma frailty log-variance parameter, then the lastq_1+q_2+q_3 elements correspond with the regression parameters.

y1, y2

Numeric vectors of length n with (possibly censored) non-terminal and terminal event times

delta1, delta2

Numeric vectors of length n with indicators of 1 if the event was observed and 0 otherwise

Xmat1, Xmat2, Xmat3

Numeric matrices with n rows and q_1,q_2,q_3 columns containing covariates.

hazard

String specifying the form of the baseline hazard.

frailty

Boolean indicating whether a gamma distributed subject-specific frailty should be included. Currently this must be set to TRUE.

model

String specifying the transition assumption

basis1, basis2, basis3, basis3_y1

Numeric matrices with n rows and k_1,k_2,k_3 columns with piecewise/spline basis function values at the corresponding y1 and y2 values. Under semi-Markov model, basis3 represents basis derived from y_2-y_1 and basis3_y1 is unused, while under Markov model, basis3 represents basis derived from y_2 and basis3_y1 is from y_1 Not used under Weibull model.

dbasis1, dbasis2, dbasis3

Numeric matrices with n rows and k_1,k_2,k_3 columns with piecewise/spline basis function derivative values at the corresponding y1 and y2 values. Used only under Royston-Parmar model.

penalty

A string value indicating the form of parameterwise penalty to apply. "lasso", "scad", and "mcp" are the options.

lambda_path

Numeric sequence of decreasing regularization parameters for the parameterwise penalties, along which the solution path runs. Assumes a single shared penalty across transitions.

a

For two-parameter penalty functions (e.g., scad and mcp), the second parameter.

penalty_fusedcoef

A string value indicating the form of the fusion penalty to apply to the regression parameters. "none" and "fusedlasso" are the options.

lambda_fusedcoef_path

Numeric sequence of increasing regularization parameters for the fusion penalties.

penalty_fusedbaseline

A string value indicating the form of the fusion penalty to apply to the baseline hazard parameters. "none" and "fusedlasso" are the options.

lambda_fusedbaseline

The strength of the fusion penalty on the regression parameters. Either a single non-negative numeric value for all three transitions, or a length 3 vector with elements corresponding to the three transitions.

penweights_list

A list of numeric vectors representing weights for each penalty term (e.g., for adaptive lasso.) Elements of the list should be indexed by the names "coef1", "coef2", "coef3", "fusedcoef12", "fusedcoef13", "fusedcoef23", "fusedbaseline12", "fusedbaseline13", and "fusedbaseline23"

mu_smooth_path

Numeric sequence of decreasing Nesterov smoothing parameters for the fusion penalties.

ball_L2

Positive numeric value for l_2 ball constraint around the origin for the regression parameters. Typically set to Inf indicating no constraint, otherwise equivalent to an extra l_2 penalty.

fit_method

String indicating which optimization method should be used at each step.

warm_start

Boolean indicating whether each step of the solution should start from ending of previous (TRUE) or from the original starting point (FALSE).

extra_starts

numeric indicating how many additional optimization runs from random start values should be performed at each grid point.

select_tol

Positive numeric value for thresholding estimates to be equal to zero.

fusion_tol

Numeric value indicating when to consider fused parameters that are close to be considered the same value, for estimating degrees of freedom.

step_size_min

Positive numeric value for the minimum allowable step size to allow during backtracking.

step_size_max

Positive numeric value for the maximum allowable step size to allow by size increase at each iteration.

step_size_init

Positive numeric value for the initial step size.

step_size_scale

Positive numeric value for the multiplicative change in step size at each step of backtracking.

step_delta

Positive numeric value for the parameter governing sufficient descent criterion.

maxit

Positive integer maximum number of iterations.

conv_crit

String (possibly vector) giving the convergence criterion.

conv_tol

Positive numeric value giving the convergence tolerance for the chosen criterion.

mm_epsilon

Positive numeric tolerance parameter for smooth approximation of absolute value function at 0.

verbose

Numeric indicating the amount of iteration information should be printed to the user. Higher numbers provide more detailed information to user, but will slow down the algorithm.

Details

This is a function to loop through a path of lambda, lambda_fusedcoef, and mu_smooth values in a somewhat thoughtful way to maximize the pathwise connections between starting values and step sizes, with some adjustments tailored to each approach to optimization.

Value

A list.


hreed7/SemiCompRisksPen documentation built on Dec. 15, 2024, 5:41 p.m.