将截断应用于具有 ID 的数据集

Applying cutoff to data set with IDs

我正在使用 SAS 并设法 运行 proc logistic,这给了我一个 table 像这样。

Classification Table
Prob    Correct Incorrect   Percentages
Level   Event   Non-    Event   Non-    Correct Sensi-  Speci-  FALSE   FALSE
                Event           Event           tivity  ficity  POS     NEG  J
0       33      0       328     0       9.1     100     0       90.9    .    99
0.02    33      62      266     0       26.3    100     18.9    89      0   117.9
0.04    31      162     166     2       53.5    93.9    49.4    84.3    1.2 142.3
0.06    26      209     119     7       65.1    78.8    63.7    82.1    3.2 141.5

如何为下方 lib.POST_201505_PRED 中概率至少为 0.6 的数据行添加 ID?

proc logistic data=lib.POST_201503 outmodel=lib.POST_201503_MODEL descending;
model BUYER = 
    age
    tenure
    usage
    payment
    loyalty_card
    /outroc=lib.POST_201503_ROC;
    Score data=lib.POST_201505 out=lib.POST_201505_PRED outroc=lib.POST_201505_ROC;
run;

我一直在阅读 documentation 并在线搜索,但没有找到任何内容。我一定是在搜索错误的关键字,因为我认为这是一个经常使用的过程。

原来我只需要在 lib.POST_201505

中包含 ID

您只需要一个 id 语句来告诉 SAS 您的 ID 变量识别您的观察结果;

proc logistic data=lib.POST_201503 outmodel=lib.POST_201503_MODEL descending;
    id ID; 
    model BUYER = age tenure usage payment loyalty_card
        /outroc=lib.POST_201503_ROC;
    Score data=lib.POST_201505 
        out=lib.POST_201505_PRED 
        outroc=lib.POST_201505_ROC;
run;

现在您的输出包含了您需要的一切。 例如,打印出至少有 0.6 的概率被分配给他们的 ID;

proc print data=lib.POST_201505_PRED (where=(P_1 GE 0.6));
    var ID P_1;
run;

您会在 SAS 的整个统计过程中找到这些 id yourKey; 语句,例如 ;

proc univariate data=psydata.stroop;
    id Subject;
    var ReadTime;
run;

** 将 ReadTime 的最极端值报告为

;