Announcement

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

  • Code for Cost-Effectiveness Acceptability Curve

    Hello

    Does anyone have simple code to create a cost-effectiveness acceptability curve?
    I have a dataset that has 2 columns - one columne (inc_dep_cci) with 1000 bootstrapped estimates of incremental effect and the other column (inc_cost_cci) with 1000 bootstrapped estimates of incremental costs between two care environments.

    When I use the below code, the estimates of probability cost-effective keeps coming up 0.

    capture postutil clear
    postfile ceac n probce using "ceac.dta", replace // Set-up 'postfile' to store results
    use "P:\Omar Projects\Paloma\OSCAR Aim 3\Aim 3 Data Files\bootstrap_mnar.dta", clear
    gen n = _n in 1/1000
    count if ~missing(inc_dep_cci)
    local denom = r(N)
    forvalues n=1/1000 {
    count if (inc_dep_cci*`n' - inc_cost_cci) > 0
    post ceac (`n') ( r(N)/`denom' ) // Proportion of cost-effective BS replicates

    }

    postclose ceac


    Any help is greatly appreciated.

    Thank you,
    Marta

  • #2
    Marta:
    welcome to this forum.
    Some years ago I challenged myself with the same issue (then I switched to the usual spreadsheet-based appraoch).
    The code that I've just retrieved from my folders is the following one (that, with a bit of tweak, can hopefully matches your research needs):
    Code:
    range Threshold_values 0 200000 1000
    g Delta_C_b=runiform()*1000
    g Delta_E_b=runiform()*10
    g double acc=.
    forval i = 1/1000 {
    qui g t`i' =Threshold_values[`i']* Delta_E_b> Delta_C_b
    qui sum t`i', meanonly
    replace acc=r(mean) in `i'
    drop t`i'
     }
    twoway (scatter acc Threshold_values)
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you, Carlo. This was helpful

      Comment


      • #4
        could you please explain this loop statement? I am beginner that i am not familiar with it.

        Comment


        • #5
          Boane:
          the loop calculates for 1000 threshold values the probability to be cost-effective for the healthcare under investigation, so that the cost-effectiveness acceptability curve can be created.
          Last edited by Carlo Lazzaro; 25 Apr 2023, 01:18.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thank you, Carlo, it helps me a lot.

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              Marta:
              welcome to this forum.
              Some years ago I challenged myself with the same issue (then I switched to the usual spreadsheet-based appraoch).
              The code that I've just retrieved from my folders is the following one (that, with a bit of tweak, can hopefully matches your research needs):
              Code:
              range Threshold_values 0 200000 1000
              g Delta_C_b=runiform()*1000
              g Delta_E_b=runiform()*10
              g double acc=.
              forval i = 1/1000 {
              qui g t`i' =Threshold_values[`i']* Delta_E_b> Delta_C_b
              qui sum t`i', meanonly
              replace acc=r(mean) in `i'
              drop t`i'
              }
              twoway (scatter acc Threshold_values)
              Dear Carlo! I am also a new member here and you code is exactly what i look for. Have I understood it correctly that the first part of your code is just to produce example numbers and that the "real code" (i.e. the one to apply for ones own dataset) is
              g double acc=.
              forval i = 1/1000 {
              qui g t`i' =Threshold_values[`i']* Delta_E_b> Delta_C_b
              qui sum t`i', meanonly
              replace acc=r(mean) in `i'
              drop t`i'
              }
              twoway (scatter acc Threshold_values)[/CODE][/QUOTE]

              Where I just change to the names of Delta_E.. and Delta_C--- to my own names?

              Sorry if question is unclear

              Regards

              Erik

              Comment


              • #8
                Erik:
                welcome to this forum.
                Yes, you're correct.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment

                Working...
                X