--- Claus Dethlefsen <[email protected]> wrote:
> I am doing Cox-regression with a continuous exposure, x
> 
> I would like to fit a crude model with x modelled as a restricted
> cubic spline. In Stata 10, I do
> 
> mkspline rcx = x, cubic nknots(7)
> 
> /* crude */
> stcox rcx*
> 
> Now, I would like to draw the hazard ratio as a function of x with
> one value of x as reference level. Also, I want 95% confidence
limits.
*------------------- begin example ------------------
set more off
use http://www.stata-press.com/data/cgg/reyes, clear
mkspline rsam =  ammonia, cubic nknots(3)
stcox treat rsam*
adjust treat=0, by(ammonia) ci replace exp
twoway rarea lb ub ammonia || ///
       line exp ammonia,      ///
       legend(off)            ///
       ytitle(hazard ratio)
*-------------------- end example -------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
      
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/