Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • What's the relationship between -rcsgen- and -stpm2-?

    Dear Stata specialists,

    I have seen the description of -rcsgen- on Paul Lambert's blog, stating that "The rcsgen command generates basis function for restricted cubic splines. The command is used by my stpm2 command to fit flexible parameric survival models.".

    I was wondering what's the actual relationship between -rcsgen- and -stpm2-? Does -rcsgen- always be followed by -stpm2- (Or can -stpm2- work without -rcsgen-)?


    (Some brief info about my study and data if you'd like to refer to:
    I'm trying to use flexible parametric model to estimate Hazard ratio over time (at 1 year, 5 years and 10 years after start of follow up) and visualize HR change over time using survival data.

    outcome: development of CVD (0/1)
    main exposure: RA (0/1)
    covariates: age (continuous), sex (0/1), region (categorical noted by 0-20)
    censoring: death during follow-up, emigration during follow-up or end of study (0/1)
    follow-up time: in years (from diagnosis of RA to development of CVD or censoring) )


    Thank you in advance!

    Best,
    Z.

  • #2
    -stpm2- need -rcsgen- to work. -rcsgen- can be installed using
    Code:
    ssc install rcsgen
    Ref.: P. C. Lambert and P. Royston. Further development of flexible parametric models for survival analysis. Stata Journal 2009;9:265-290
    Last edited by Bjarte Aagnes; 27 Mar 2021, 12:42.

    Comment


    • #3
      Originally posted by Bjarte Aagnes View Post
      -stpm2- need -rcsgen- to work. -rcsgen- can be installed using
      Code:
      ssc install rcsgen
      Ref.: P. C. Lambert and P. Royston. Further development of flexible parametric models for survival analysis. Stata Journal 2009;9:265-290
      Thank you very much!

      Comment


      • #4
        Excuse me but I want ask more.... Could you tell me what kind of variables I shoul put in -rcsgen-?
        I already read Paul Lambert's blog and Paul Dickman's blog but one put "age" into the command and the other put "year from diagnosis", so I get confused.

        Comment


        • #5
          -rcsgen- generates basis function for restricted cubic splines. It has very similar functionality to base Stata's -mkspline, cubic nknots(4)- but has additional options.

          With flexible parametric models (-stpm2-), the baseline cumulative hazard is modelled using a restricted cubic spline. When you use the -stpm2- command, -rcsgen- is used in the background to create the basis functions for the baseline hazard. As such, -rcsgen- must be installed whenever -stpm2- is used. You can also use -rcsgen- (or -mkspline-) if you want to model an explanatory variable using restricted cubic splines. You can apply this in any model (e.g., flexible parametric model, Cox, Poisson, linear, logistic, etc).

          Could you tell me what kind of variables I shoul put in -rcsgen-?
          In short, -stpm2- (if you are using it) will "put" the baseline hazard in -rcsgen- for you automatically. You can, additionally, model the effect of any continuous covariate as a restricted cubic spline by using rcsgen to create the basis vectors and putting the resulting basis variables as explanatory variables in your model.

          Comment

          Working...
          X