-------------------------------------------------------------------------------
help stgenreg                                 also see: stgenreg postestimation
-------------------------------------------------------------------------------

Title

stgenreg -- General parametric survival models

Syntax

stgenreg [if] [in] [, options]

options Description ------------------------------------------------------------------------- Model loghazard(string) user-defined log baseline hazard function hazard(string) user-defined baseline hazard function bhazard(varname) invokes relative survival models, defining the expected hazard rate at the time of event eq_name(string) specify the components to include in the linear predictor of each parameter

Reporting showcomponent display each parsed component specified in cov# mataloghazard display the log hazard function passed to Mata matakeep do not drop data from Mata after fitting a model eform exponentiate coefficients of first ml equation} level(#) set confidence level; default is level(95)

Maximization options nodes(#) number of quadrature nodes search(string) search option to pass to ml initmat(matrix_name) matrix of initial values to pass to ml copy parameters in the initial values matrix are entered by position skip any parameters found in initial values matrix but not in model are skipped nolog suppress display of log-likelihood iteration log maximize_options control the maximization process; seldom used ------------------------------------------------------------------------- You must stset your data before using stgenreg; see [ST] stset. fweights, iweights, and pweights may be specified using stset; [ST] stset. Factor variables are not currently supported.

Description

stgenreg fits parametric survival models using any user-defined [log] baseline hazard fuction. Gaussian quadrature is used to evaluate the cumulative hazard function and consequently the survival function allowing the estimation of a parametric survival model with almost any form. The [log] hazard function must be written in Mata code using colon operators. Each parameter defined in a [log] hazard function can include components, whereby each component can contain variables, user-defined functions of time, restricted cubic spline functions and/or fractional polynomial functions. Time-dependent effects can be included in any component. Relative survival models can also be fitted.

Options

+-------+ ----+ Model +------------------------------------------------------------

loghazard(string) is the user-defined log baseline hazard function. This must be written in Mata code using colon operators. Each parameter must be identified in square brackets, for example [xb]. Time must be entered as #t.

hazard(string) is the user-defined baseline hazard function. This must be written in Mata code using colon operators. Each parameter must be identified in square brackets, for example [xb]. Time must be entered as #t.

bhazard(varname) defines the expected hazard rate at the time of event, used in relative survival or cure models. The timescale units used to generate this variable must be the same as the units of _t.

eq_name(string) specifies the components to be included in the linear predictor of each parameter. Components must be split by |, for example, eq_name(comp1 | comp2 | comp3). Each component can be one of the following:

varlist [,nocons]: the user may specify a standard variable list within a component section, with an optional nocons option

g(#t): where g() is any user defined function of #t written in Mata code, for example #t:^2

#rcs(options): which creates restricted cubic splines of either log time or time. options include df(#), the number of degrees of freedom, noorthog which turns off the default orthogonalisation, time, which creates splines using time rather than log time, the default, and offset(varname), which includes an offset variable. See rcsgen for more details.

#fp(numlist [,offset(varname)]): which creates fractional polynomials of time. If 0 is specified, log time is generated. If offset() is specified an offset variable is added to _t before generating the fractional polynomials.

varname:*f(#t): to include time-dependent effects, where f(#t) is one of #rcs(), #fp() or g().

+-----------+ ----+ Reporting +--------------------------------------------------------

showcomponent display each parsed component specified in the eq_name options. This is useful to check that stgenreg has correctly parsed the options.

mataloghazard display the log hazard function passed to Mata. This is useful to check that stgenreg has correctly parsed the log hazard function.

matakeep do not drop the data from Mata following a model fit. By default, all data passed to Mata is dropped.

eform exponentiate the coefficients of the first ml equation.

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

+--------------+ ----+ Maximization +-----------------------------------------------------

nodes(#) defines the number of Gauss-Legendre quadrature points used to evaluate the cumulative hazard function in the maximisation process. Must be an integer > 2, with default 15.

search(string) search option to pass to ml.

initmat(matrix_name) passes a matrix of initial values.

copy pass initial values by position rather than name.

skip any parameters found in the initial values matrix but not in model are skipped.

maximize_options; difficult, technique(algorithm_spec), iterate(#), [no]log, trace, gradient, showstep, hessian, shownrtolerance, tolerance(#), ltolerance(#) gtolerance(#), nrtolerance(#), nonrtolerance, from(init_specs); see [R] maximize. These options are seldom used, but the difficult option may be useful if there are convergence problems.

Remark

Note: As with all models which use numerical integration, the stability of maximum likelihood estimates should be established by using an increasing number of quadrature nodes.

Example

Setup webuse brcancer stset rectime, failure(censrec = 1) scale(365.25)

Weibull proportional hazards model stgenreg, loghazard([ln_lambda] :+ [ln_gamma] :+ (exp([ln_gamma])-1):*log(#t)) ln_lambda(hormon)

Restricted cubic splines on the log hazard scale stgenreg, loghazard([xb]) xb(hormon | #rcs(df(5)))

FP3 model stgenreg, loghazard([xb]) xb(hormon | #fp(0 1 2))

Restricted cubic splines on the log hazard scale, with time-dependent effect stgenreg, loghazard([xb]) xb(hormon | #rcs(df(5)) | hormon:*#rcs(df(3)))

Authors

Michael J. Crowther Department of Health Sciences University of Leicester E-mail: michael.crowther@le.ac.uk

Paul C. Lambert Department of Health Sciences University of Leicester E-mail: paul.lambert@le.ac.uk

Please report any errors you may find.

References

Crowther MJ and Lambert PC. stgenreg: A Stata package for general parametric survival analysis. Journal of Statistical Software 2013; (To Appear).

Also see

Online: stgenreg postestimation