Announcement

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

  • Missing values generated when used command predict

    I am tried to produce sensitivity and specificity by manually through predict using the result of svy:logit. Below is the syntax I wanted to apply.

    svy:logit y x1 x2 ... , nolog or allbaselevels
    predict prediction, pr
    gen byte predicted = (prediction > 0.1) & !missing(prediction)
    svy, subpop(if srh2021 == 1): proportion predicted
    svy, subpop(if srh2021 == 0): proportion predicted

    However, it shows

    predict prediction, pr
    (999 missing values generated)

    thus, missing portion deterred having an expected result. How to cope with those 999 missing values?

  • #2
    You cannot predict values for observations that have missing entries. See

    Code:
    help e(sample)
    to determine what observations constitute your sample and read up on listwise deletion.

    Comment


    • #3
      Our Colleague Seungwoo Kang posted a very similar query at https://www.statalist.org/forums/for...ommand-predict.
      Multiple posts on (more or less) the same topic started by the same poster increase the risk of scattering potentially useful replies in different messages, which is neither useful for the original poster, nor for those interested in following the query.
      Last edited by Carlo Lazzaro; 15 Jun 2022, 11:18.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment

      Working...
      X