```.-
help for ^stgtcalc^, ^stgtplot^                    (Patrick Royston, Peter Sasi
> eni)
.-

Time-varying regression coefficients in Cox PH models
(via Grambsch and Therneau residuals)
-----------------------------------------------------

^stgtcalc^

^stgtplot^ varlist [^, ci le^vel^(^#^)^ ^me^an graph_options ]

Description
-----------

^stgtcalc^ calculates local estimates of the regression coefficients in the Cox
model most recently fitted for using @stcox@.

^stgtplot^ plots the estimates and confidence intervals against the failure
times. varlist is (a subset of) the independent variables in model fitted by
^stcox^.

Options
-------

^ci^ causes a ^level()^% confidence band to be plotted around the estimates of
> the
regression coefficients. The pointwise confidence intervals are derived
from the running line smoother @running@.

^level(^#^)^ sets the width of a pointwise confidence band for the estimated
b(t). Default: current value of system macro ^\$S_level^ (usually 95%).

^mean^ uses the ^mean^ option of @running@ to produce a running mean smoother.

graph_options are any of Stata's ^graph, twoway^ options

Remarks
-------

^stgtcalc^ implements a suggestion of Grambsch and Therneau (1994). For an xvar
with estimated regression coefficient b, ^stgtcalc^ calculates

g(T) = b + #deaths * V^^-1 * r(T)

at each failure time T, where V is the estimated dispersion matrix of the
regression coefficients, #deaths is the number of uncensored observations and
r(T) is the vector of Schoenfeld residuals at T. The g(T)'s are smoothed and
the smoothed values are saved. g(T) is a local estimate of beta, so the shape
of the smoothed profile may indicate whether beta depends on time. If so, the
dataset has non-proportional hazards and the model will need to be refined.

Note that the smoothed g(T) may be unreliable in the initial and final phases
of follow-up.  This may be partly due to lack of robustness in the smoother.

The values of g(T) for each xvar are saved with names ^GT^xvar1, ^GT^xvar2, etc
> .

If more than one xvar is to be plotted by ^stgtplot^, a panel of plots is produ
> ced.

Example
-------

. ^stset survtime cens^
. ^stcox x1 x2^
. ^stgtcalc^
. ^stgtplot x1^
. ^stgtplot x1 x2, ci mean^

Reference
---------

Grambsch PM, Therneau TM. Proportional hazards tests and diagnostics based
on weighted residuals. Biometrika 81: 515-526 (1994).

Authors
-------

Patrick Royston
Imperial College School of Medicine, London
FAX:  (011)-44-181-383-8573

Peter Sasieni
Imperial Cancer Research Fund, London
FAX:  (011)-44-171-269-3429

Also see
--------

Manual:  [R] st stcox
On-line:  help for @stcox@, @stbtcalc@
```