Announcement

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

  • How to create AIC table pulled from "stcox"/"rcsgen" commands in a loop?

    Hello all,

    This is my first post on Statalist (I am a very novice Stata user), my apologies for any potential errors.

    I am trying to compare different survival curve models for a variable "testscore" (ranges 1-100). I want to create different spline models (with df ranging from 1 to 5) using the "rcsgen" command, then run them through "stcox / estat ic" command, and subsequently compare their respective AICs to see which models gives me the best fit. I would like the output to show me an AIC table of the different models so I can compare the models.

    I have the following code,

    forvalue i = 1/5 {
    rcsgen testscore, gen(rcs_testscore) df(`i')
    stcox rcs_testscore*
    estat ic
    est store model_df`i'

    drop rcs_testscore*
    }

    //estat summarize model_df* ///


    Please let me know if I can provide any further information, thank you so much.

    Carmen Pajarillo
Working...
X