Announcement

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

  • Programming: combine two commands into one in order to bootstrap

    Hello all

    I need to write my own STATA program that combines two commands into one, in order to bootstrap the value "Harrell's C statistic" I get from these commands.


    These are my commands: 1) stcox age gender sex ecog 2) estat concordance

    Here is what I have so far:
    program define Cscore, rclass
    stcox age gender sex ecog if ecog<3
    estat concordance
    return scalar tqm=r(mean)
    end


    I based the code I wrote from an example I found on this website under "Bootstrapping Results You've Calculated." https://www.ssc.wisc.edu/sscc/pubs/4-27.htm

    The 4th line "return scalar tqm=r(mean)" is what is giving me trouble. The statistic I need is the output I get from estat concordance called the "Harrell's C." What exactly am I supposed to put in inside the parenthesis that says "mean"?

    Thank you so much!
    Last edited by Sun Gno; 17 Jun 2016, 10:45.

  • #2
    If you check -help stcox postestimation- and follow the link to -estat concordance-, you will see that Harrel's C is returned in r(C).
    Last edited by Clyde Schechter; 17 Jun 2016, 11:10.

    Comment


    • #3
      Thank you Dr. Schechter. I've changed it to r(c). But when I bootstrap per the website's directions I get the following results:

      . program define Cscore, rclass
      1. stcox age gender sex ecog if ecog<3
      2. estat concordance
      3. return scalar tqm=r(c)
      4. end

      . bootstrap tqm=r(tqm), reps(200) seed(12345): Cscore
      (running Cscore1 on estimation sample)
      'r(tqm)' evaluated to missing in full sample
      r(322);

      My question is:
      -Should I change something in the fourth line of my program code (tqm?) What is "tqm=r(c)" supposed to mean?
      -What does it mean when it says that r(tqm) has evaluated to missing in full sample?

      Comment


      • #4
        Perhaps the answer to your question posted on Stack Overflow will help resolve your problem.

        http://stackoverflow.com/questions/3...-bootstrapping

        ​Or, if what you typed was
        Code:
        return scalar tqm=r(c)
        then do reread Clyde's post carefully, what you need is
        Code:
        return scalar tqm=r(C)
        Stata is case-sensitive, c is not the same as C.

        Your question about the meaning of "tqm=r(c)" on the return command is addressed by reading help return .
        Last edited by William Lisowski; 17 Jun 2016, 11:58.

        Comment


        • #5
          I got it! Thank you all! the case sensitive suggestion did the trick.

          Comment

          Working...
          X