Announcement

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

  • ROC - lower score is higher risk

    Hi, this is probably a very basic question but I am trying to create ROC curves for strength scores and disease presence (binary) - higher strength scores would be associated with lower disease risk. I am also using probability weighted survey data.

    Code:
    svy: logistic disease1 strength
    predict phat1
    somersd  disease1 phat1 [pweight=pwt], tr(c)
    I have had to invert my disease variable ('disease' -> 'disease1') so that the ROC curve would be the right way up i.e. I changed the scores so that 0 = disease, 1 = no disease. By right way up, I mean AUC >0.5 (it was around 0.3 with the original 'disease' variable).

    My problem is that I now want to compare this to another ROC curve where I have used the original non-inverted disease variable (i.e. 'disease' where 0 = no disease, 1 = disease). However, as I have used 2 different outcome variables (i.e. one where 0 = disease and one where 0 = no disease) this comparison doesn't work.

    Code:
    roccomp disease-variable??? phat1 phat2, graph summary
    Is there a way to tell the logistic regression that low strength scores are 'bad' rather than the way I have inverted the disease variable? Or is there a way to compare the ROC curves with these 2 disease variables.

    I am using stata v16.0.

    I would be really grateful if anyone could give me some advice about how best to approach this. Thank you.

  • #2
    Instead of inverting the disease outcome, change the sign of the strength variable in the first analysis.

    Be careful, in any case, interpreting the results of -roccomp- here. You are working with survey data, and -roccomp- expects independent observations and does not allow pweights. I am not aware of any Stata program that can do this calculation with survey data. If somebody reading along knows of one, please speak up.

    Comment


    • #3
      the community-contributed -somersd- allows pweights; use -search- to find and download

      added in edit: as you can see in #1; also, upgrading to version 16.1 is free so you should do it; see "help upgrade"

      Comment


      • #4
        Dear Clyde and Rich,

        Thank you so much for your help, especially for inverting strength, the curve makes much more sense now! I was also not aware of this limitation with roccomp, so thank you so much for highlighting this to me.

        I've looked into using -somersd- for comparison instead and can I just check that this code is correct/suitable for survey data?

        Code:
        svy: logistic disease1 strength age
        predict phat1
        somersd disease1 phat1 [pweight=pwt], tr(c)
        lincom strength-age
        Thanks again

        Comment

        Working...
        X