regression

logisticAssociation

Description

The logisticAssociation action computes indices of rank correlation between predicted probabilities and observed responses, which are used for assessing the predictive ability of a model. This action requires a saved model from the logistic action.

regression.logisticAssociation / accuracy="string", allStats=TRUE | FALSE, association=TRUE | FALSE, binEps=double, casOut={...}, ctable=TRUE | FALSE, cutpt=double | {double-1, ...}, display={...}, fitData=TRUE | FALSE, fnf="string", fpf="string", lift="string", misclass="string", nocounts=TRUE | FALSE, npv="string", outputTables={...}, pc="string", ppv="string", restore={...}, table={...}, tnf="string", tpf="string";
Settings
ParameterDescription
accuracy Includes and names the accuracy in the classification table.
allStats When set to True, requests all available statistics.
association When set to True, creates the association table.
binEps Specifies the precision of the predicted probabilities that are used for classification. Default: 1E-05.
casOut Specifies the settings for an output table to store assessment results.
ctable Creates the classification table.
cutpt Specifies cutpoints (probability thresholds) for the classification table.
display Specifies a list of results tables to send to the client for display.
fitData When set to True, specifies that the data to be scored were also used to fit the model.
fnf Includes and names the false negative fraction in the classification table.
fpf Includes and names the false positive fraction (1-specificity) in the classification table.
lift Includes and names the lift in the classification table.
misclass Includes and names the misclassification rate in the classification table.
nocounts When set to True, removes counts from the classification table.
npv Includes and names the negative predictive value in the classification table.
outputTables Lists the names of results tables to save as CAS tables on the server.
pc Includes and names the percent correct in the classification table.
ppv Includes and names the positive predictive value (precision) in the classification table.
restore Specifies the input model store table, which contains the model information saved from the logistic action.
table Specifies the input data table to score and assess.
tnf Includes and names the true negative fraction (specificity) in the classification table.
tpf Includes and names the true positive fraction (recall, sensitivity) in the classification table.
Data Preparation View data prep sheet
Data Creation

The following code creates the 'mycas.hmeq' table, which is used in the examples. This dataset contains information about home equity loans.

Copied!
1DATA mycas.hmeq; SET sampsio.hmeq; RUN;

Examples

This example first fits a logistic regression model and saves it to a store. Then, it uses the logisticAssociation action to compute and display the model's association statistics.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3regression.logistic
4DATA='hmeq' class={'job','reason'} model={depvar='bad', effects={'job','reason','loan','mortdue','value','yoj','derog','delinq','clage','ninq','clno'}} store={name='myModelStore', replace=true};
5 
6RUN;
7regression.logisticAssociation restore='myModelStore' TABLE='hmeq';
8 
9RUN;
10 
11QUIT;
12 
Result :
The action returns a table named 'Association' which contains various rank correlation statistics like Somers' D, Gamma, Tau-a, and c (ROC Area). These metrics evaluate the model's predictive ability by measuring the association between predicted probabilities and observed responses.

This example extends the basic assessment by generating a classification table. The `ctable=true` parameter produces a table that cross-classifies observations based on whether the predicted event probability is above or below a certain threshold (cutpoint), showing counts of true/false positives and negatives.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3regression.logistic
4DATA='hmeq' class={'job','reason'} model={depvar='bad', effects={'job','reason','loan','mortdue','value','yoj','derog','delinq','clage','ninq','clno'}} store={name='myModelStore', replace=true};
5 
6RUN;
7regression.logisticAssociation restore='myModelStore' TABLE='hmeq' ctable=true;
8 
9RUN;
10 
11QUIT;
12 
Result :
In addition to the 'Association' table, a 'Classification' table is generated. This table shows the number of correct and incorrect classifications for each specified cutpoint, along with metrics like sensitivity and specificity.

This example demonstrates how to specify custom cutpoints for the classification table and how to save the classification results to an output CAS table named 'MyCasOut'. The `cutpt` parameter allows for evaluation at specific probability thresholds.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3regression.logistic
4DATA='hmeq' class={'job','reason'} model={depvar='bad', effects={'job','reason','loan','mortdue','value','yoj','derog','delinq','clage','ninq','clno'}} store={name='myModelStore', replace=true};
5 
6RUN;
7regression.logisticAssociation restore='myModelStore' TABLE='hmeq' ctable=true cutpt={0.3, 0.5, 0.7} casOut={name='MyCasOut', replace=true};
8 
9RUN;
10 
11QUIT;
12 
Result :
The 'Classification' table is produced, but only for the specified cutpoints of 0.3, 0.5, and 0.7. Additionally, a new in-memory table named 'MyCasOut' is created in the active caslib, containing the detailed classification metrics for each cutpoint.

FAQ

What is the purpose of the logisticAssociation action?
What are the primary inputs required for the logisticAssociation action?
How can I generate a classification table using this action?
How can I obtain the association statistics table?
What does the 'fitData' parameter do?