Announcement

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

  • Sensitivity and specificity versus probability cutoff (lsens) after generalizing estimating equations (xtgee)?

    Hi, I am trying to build a prediction model using 'xtgee', and I'm keen to model a sensitivity and specificity versus probability cutoff like what `lsens` did. However, I noted that `lsens` and `lroc` do not work after xtgee. Is there any similar options to obtain these plots?

    Example dataset:
    Code:
    sysuse bplong.dta, clear
    dataex
    
    gen outcome = round(runiform())
    
    xtset patient when
    xtgee outcome sex, family(binomial) link(logit) corr(exch) vce(robust)
    Thank you very much in advance

  • #2
    Originally posted by Gilbert Lazarus View Post
    . . . I noted that `lsens` and `lroc` do not work after xtgee. Is there any similar options to obtain these plots?
    xtgee is for longitudinal data. Do you want to plot the receiver operating characteristic curves after each time point or pooled across them? Assuming the former, you could do something like the following.
    Code:
    sysuse bplong
    summarize bp, meanonly
    quietly replace bp = bp > r(mean)
    
    *
    * Begin here
    *
    xtgee bp i.sex##i.when, i(patient) family(binomial) link(logit) corr(exchangeable) nolog // vce(robust) doesn't do anything here
    predict double xb, xb
    
    set more on
    quietly levelsof when, local(times)
    foreach time of local times {
        quietly logit bp c.xb if when == `time'
        lsens
        more
    }
    Note that xtset doesn't do what you thought that it did. It does not induce the model to include the time variable. In fact, in your case, adding the time variable to it doesn't do anything at all.

    If you're interested in somehow pooling across time, then maybe take a look at some older threads on the topic, for example, here and here.

    Comment


    • #3
      Hi Joseph, thanks for the insights! I would like to plot the ROC curve pooled across all time points (hence why I use GEE to adjust for multiple observations). In that case could I just use:

      Code:
       
       quietly logit bp c.xb     lsens     more
      Also, do I need to add interaction terms between `sex` and `when`? Or could I just add sex as a covariate like I did. My actual dataset has limited observations so I don't think the model would converge if I add interaction terms. Also, yes, the actual dataset has different number of visits between participants and denote number of visits not before/after

      Thank you very much once again

      Comment

      Working...
      X