nll_func: Negative Log-Likelihood Function for Illness-Death Model

View source: R/nll_ngrad_nhess_functions.R

nll_funcR Documentation

Negative Log-Likelihood Function for Illness-Death Model

Description

Function returning the negative log-likelihood for the illness-death model, under specified baseline hazard, and specified frailty, and specified Markov/semi-Markov transition assumption. Typically, this function will not be used directly by the user, but as part of a larger estimation procedure.

Usage

nll_func(
  para,
  y1,
  y2,
  delta1,
  delta2,
  Xmat1,
  Xmat2,
  Xmat3,
  hazard,
  frailty,
  model,
  basis1,
  basis2,
  basis3,
  basis3_y1,
  dbasis1,
  dbasis2,
  dbasis3
)

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.

Value

Returns numeric sum of negative log likelihood contributions.


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