Announcement

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

  • How to graph probability of death by a continuous variable in Stata?

    Hi,

    Can anyone help me with how to graph probablity of death (at 1 year) by a continuous variable (such as age) in Stata? For an example of what I'm trying to do see the attached picture.

    Thanks!


    Click image for larger version

Name:	slide23 copy.png
Views:	1
Size:	31.2 KB
ID:	1385838

  • #2
    You don't give any information about what you're starting with, but I suppose you could try something along these lines.
    Code:
    sysuse auto
    logit foreign c.trunk, nolog
    summarize trunk, meanonly
    local numlist `=r(min)'(`=(r(max)-r(min))/50')`=r(max)'
    quietly margins, at(trunk=(`numlist'))
    marginsplot , plotopts(msymbol(none))
    You'll probably want to tweak things a little to get it to look like you want, for example, rendering of the confidence interval band (I assume that that's what you're showing in your picture) by marginsplot.

    Comment


    • #3
      Thank you for your help. I am trying to look at probability of death following transplant with continuous variable such as age or creatinine.
      It looks like this works with stcox.. Is there a way to change the y-axis to be probability of death? Also how do I change the scale of the x-axis (options in graph edit did not let me move past the e notation)?

      stcox ischtime, nolog
      summarize ischtime, meanonly
      local numlist `=r(min)'(`=(r(max)-r(min))/50')`=r(max)'
      quietly margins, at(ischtime=(`numlist'))
      marginsplot , plotopts(msymbol(none))

      Let me know if this coding looks ok.

      Thanks,
      Eugene



      Attached Files

      Comment

      Working...
      X