The logisticOddsRatio action creates a table that compares subpopulations by using odds ratios. This is particularly useful in logistic regression analysis to understand how the odds of a certain outcome change with the value of a predictor variable, potentially at specific levels of other covariates.
| Parameter | Description |
|---|---|
| alpha | Specifies the significance level for the confidence limits of the odds ratios. The default value is 0.05, which corresponds to 95% confidence. |
| at | Specifies the fixed values or levels for covariates that interact with the odds ratio variable. This allows for the computation of odds ratios at specific points or for specific subgroups. |
| diff | Specifies which pairs of response levels to compare when computing odds ratios. 'REF' compares each level to the reference level, while 'ALL' computes for all pairs of levels. |
| display | Specifies which result tables to display. This can be used to limit the output to only the tables of interest. |
| outputTables | Specifies which result tables to save as in-memory CAS tables for further processing. |
| restore | Specifies an input CAS table that contains a previously fitted logistic regression model, from which the odds ratios will be calculated. |
| unit | Specifies the units of change for continuous variables for which odds ratios are to be estimated. This defines the magnitude of change in the variable for which the odds ratio is calculated. |
| vars | Specifies the variables for which odds ratios are computed. This is the main parameter to define the scope of the analysis. |
First, we need a logistic regression model. Let's create a sample dataset 'getheart' and then fit a logistic model to it. This model will predict the 'Status' of a patient based on their 'Age', 'Sex', and 'Cholesterol' levels. The resulting model will be stored in an item store named 'myModelStore' for the logisticOddsRatio action to use.
| 1 | |
| 2 | DATA casuser.getheart; |
| 3 | SET sashelp.heart; |
| 4 | |
| 5 | RUN; |
| 6 | PROC CAS; |
| 7 | ACTION regression.logistic |
| 8 | DATA='getheart', class={'Status', 'Sex'}, model={depvar='Status', effects={'Age', 'Sex', 'Cholesterol'}}, store={name='myModelStore', replace=true}; |
| 9 | |
| 10 | RUN; |
| 11 | |
| 12 | QUIT; |
| 13 |
This example calculates the odds ratio for the 'Age' variable from the previously fitted logistic model stored in 'myModelStore'. It shows the change in odds for the patient's 'Status' for each one-year increase in age.
| 1 | |
| 2 | PROC CAS; |
| 3 | ACTION regression.logisticOddsRatio restore='myModelStore', vars={{var='Age'}}; |
| 4 | |
| 5 | RUN; |
| 6 | |
| 7 | QUIT; |
| 8 |
This example calculates more complex odds ratios. For the 'Age' variable, it calculates the odds ratio for a 10-year increase. For the 'Cholesterol' variable, it calculates odds ratios at specific values (200, 220, 240). Finally, it computes the odds ratio for 'Sex', but specifically for patients who are 50 years old, demonstrating the use of the 'at' parameter to fix a covariate's value.
| 1 | |
| 2 | PROC CAS; |
| 3 | ACTION regression.logisticOddsRatio restore='myModelStore', vars={{var='Age', unit=10}, {var='Cholesterol', at={value={200, 220, 240}}}, {var='Sex', at={var='Age', value=50}}}; |
| 4 | |
| 5 | RUN; |
| 6 | |
| 7 | QUIT; |
| 8 |