.-
help for ^stbtcalc^, ^stbtplot^                    (Patrick Royston, Peter Sasieni)
.-

Time-varying regression coefficients in Cox PH models
-----------------------------------------------------


	^stbtcalc^ varlist [^,^ ^w^indow^(^#^)^ ^i^ncrement^(^#^)^ ^sm^ooth stcox_options ]


	^stbtplot^ [varlist] [^, ci le^vel^(^#^)^ graph_options ]


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

^stbtcalc^ calculates local estimates of the regression coefficients in the Cox
model defined by ^stset^ with predictors in varlist. The estimates are
calculated within moving windows which bracket a fixed number of "deaths"
(events).

^stbtplot^ plots the estimates and confidence intervals against the failure
times.  varlist is (a subset of) the predictors in ^stbtcalc^'s varlist.


Options (^stbtcalc^)
-------

^window(^#^)^ sets the window size. The larger the value of #, the smoother the
    estimated b(t) curve is, but the less far it reaches into the tails of the
    distribution of failure times.  The default value of # is 10 * (number of
    xvars) or 20, whichever is the larger.

^increment(^#^)^ sets the incremental number of events.  The event window is
    advanced by # failures.  If # is set greater than 1, fewer Cox models are
    fitted and the execution time diminishes, which may be desirable in
    datasets with a large number of events.  The default value of # is
    ((number of deaths) - (window size))/50 or 1, whichever is the larger.
    Provided there are enough deaths, this choice guarantees at least 50 local
    estimates of b(t).

^smooth^ smooths the estimated b(t) curve and its standard error using a
    running line smoother (see help @running@).

stcox_options are any of ^cluster()^, ^hr^, ^robust^.


Options (^stbtplot^)
-------

^ci^ causes a ^level()^% confidence band to be plotted around the windowed
    estimates of b(t). The pointwise confidence intervals are based on the
    standard error of each b(t).

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

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


Remarks
-------

^stbtcalc^ provides a simple method of finding local estimates of the regression
coefficient for each covariate.  All failures which occur outside the moving
time window circumscribed by the minimum and maximum failure times of a fixed
number of events become censored.  Because of the mode of calculation, no
estimates are available in the initial and final phases of follow-up.

^stbtcalc^ saves the local estimates of b(t) to new variables called ^BT^xvar1,
^BT^xvar2 etc, corresponding to the xvars.  Standard errors are saved in other
new variables called ^BS^xvar1, ^BS^xvar2, ... .

If more than one xvar is to be plotted by ^stbtplot^, a panel of plots is
produced.

The smoothing for b(t) and its standard error (see the ^smooth^ option) uses
@running@ with resmoothing option ^repeat(2)^.


Example
-------

 . ^stset survtime cens^
 . ^stbtcalc x1 x2 x3 x4 x5^
 . ^stbtplot x2^
 . ^stbtplot x1 x2 x3 x4, ci xlabel ylabel^


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@, @stgtcalc@
