Announcement

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

  • Plotting data overlying a calibration curve?

    Hi Stata Forum -

    Does anyone have code to make this type of plot?

    I have outcome data of Mortality at 1 year and a predictor variable, APACHEII score. I binned the data such that each of 4 bins of APACHEII score contains the same number of outcome events. I would like to make a bar graph where the height of the bar is the proportion of mortality events in each bin, and the width of the bar is the range of values used to create the bin. I would overlay this graph on the raw data and fitted logistic regression curve (on the x-axis is the range of APACHE2 score from zero to 50. The idea of this is to visually show the calibration of the fit logistic regression line.

    Here is the data:

    ----------------+

    | Mort1yr
    apacheCTG2 | 0 1 | Total
    -----------+----------------------+----------
    Q1 | 157 26 | 183
    | 85.79 14.21 | 100.00
    -----------+----------------------+----------
    Q2 | 84 21 | 105
    | 80.00 20.00 | 100.00
    -----------+----------------------+----------
    Q3 | 66 22 | 88
    | 75.00 25.00 | 100.00
    -----------+----------------------+----------
    Q4 | 39 24 | 63
    | 61.90 38.10 | 100.00
    -----------+----------------------+----------
    Total | 346 93 | 439
    | 78.82 21.18 | 100.00


    Here is the ranges of the bins:

    Bin: APACHE2 range:
    Q1 0-17
    Q2 18-23
    Q3 24-30
    Q4 >30

    Here's an example of what the raw data and logistic regression fit looks like:

    Click image for larger version

Name:	Logistic_Pr_APACHE_30d_17-08-07.png
Views:	1
Size:	16.4 KB
ID:	1405472


    I want to overlay the modified bar graft described on top of this data.

    Thanks! --Jason
Working...
X