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
accuracyIncludes and names the accuracy in the classification table.
allStatsWhen set to True, requests all available statistics.
associationWhen set to True, creates the association table.
binEpsSpecifies the precision of the predicted probabilities that are used for classification. Default: 1E-05.
casOutSpecifies the settings for an output table to store assessment results.
ctableCreates the classification table.
cutptSpecifies cutpoints (probability thresholds) for the classification table.
displaySpecifies a list of results tables to send to the client for display.
fitDataWhen set to True, specifies that the data to be scored were also used to fit the model.
fnfIncludes and names the false negative fraction in the classification table.
fpfIncludes and names the false positive fraction (1-specificity) in the classification table.
liftIncludes and names the lift in the classification table.
misclassIncludes and names the misclassification rate in the classification table.
nocountsWhen set to True, removes counts from the classification table.
npvIncludes and names the negative predictive value in the classification table.
outputTablesLists the names of results tables to save as CAS tables on the server.
pcIncludes and names the percent correct in the classification table.
ppvIncludes and names the positive predictive value (precision) in the classification table.
restoreSpecifies the input model store table, which contains the model information saved from the logistic action.
tableSpecifies the input data table to score and assess.
tnfIncludes and names the true negative fraction (specificity) in the classification table.
tpfIncludes 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?