Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Cubic splines in stcox

From   "Roger B. Newson" <>
Subject   Re: st: Cubic splines in stcox
Date   Fri, 04 Jan 2013 19:15:00 +0000

You might like to try parameterizing your cubic spline in a more sensible way, using a reference spline method. That way, the parameters may be hazard ratios between a reference year and a baseline year. This can be done using the -flexcurv- module of the -bspline- package, which you can download from SSC. The methods are given in detail in Newson (2012), and presented in a conference presentation in Newson (2011).

I hope this helps.

Best wishes



Newson RB. Sensible parameters for univariate and multivariate splines. The Stata Journal 2012; 12(3): 479-504. Download pre-publication draft from

Sensible parameters for polynomials and other splines. Presented at the 17th UK Stata User Meeting, 15-16 September, 2011. Download from

Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 04/01/2013 18:43, Marc Peters wrote:
Dear Maarten,

Thank you do much for your kind advice, I really appreciate it.
Unfortunately, the problem remains. It does not seem to be due to the
correlation between the two spline variables. I get the same error
message when running the model with only sp_year1.

I would me most grateful if you (or anyone else) has other ideas about
what the problem might be.



On Fri, Jan 4, 2013 at 10:42 AM, Marc Peters <> wrote:
Dear Statalist users,

I am new to event history models and am estimating a Cox proportional
hazard model, with civil war as the dependent variable. the dependent
variable is measured at discrete intervals (yearly).

My basic model is estimated using the following syntax:

stset year, failure(cwar)

stcox dem gdp, cluster (country)

This model runs well, but I encounter problems when including cubic
splines, using this syntax:

mkspline sp_year=year, cubic nknots(3)

stcox dem gdp sp_year*, cluster (country)

When running the command I get the following message "flat region
resulting in a missing likelihood"

I am sure this is a very trivial question, but I would greatly
appreciate if anyone could help me in explaining what the problem is
and how I might fix it.

Thank you,

*   For searches and help try:
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index