The `countregViewStore` action allows for the inspection and display of a count regression model that has been previously fitted and saved into a CAS item store using the `countregFitModel` action. This is particularly useful for reviewing model details, such as parameter estimates, fit statistics, and covariance matrices, without needing to re-run the entire model fitting process. It essentially loads a saved model state and presents its information in various tabular formats.
| Parameter | Description |
|---|---|
| display | Specifies the list of display tables that you want the action to create. If you omit this parameter, all tables are created. |
| instore | Specifies the input item store from which a regression model will be restored. You can then display various reports about the model. |
| outputTables | Specifies the list of display tables that you want to output as CAS tables. If you omit this parameter, no tables are output as CAS tables. |
| table | Specifies the input data table. This table is necessary to provide context, such as variable information, even though the model is loaded from the store. |
| timingReport | Specifies the kind of timing information that you want the action to provide. |
| viewOptions | Specifies which reports to display about the regression model that is restored from an item store. Options include viewing all details, correlations, covariances, fit summaries, and more. |
This dataset simulates data about scientists. The goal is to model the number of articles published (`articles`) based on gender (`gender`), marital status (`married`), number of children (`kids`), prestige of their PhD program (`phd_prestige`), and number of mentorees (`mentorees`). This data will first be used to fit a model, which is then saved to an item store.
| 1 | DATA casuser.science_articles; |
| 2 | INPUT gender $ married $ kids phd_prestige mentorees articles; |
| 3 | DATALINES; |
| 4 | Male Single 0 5 3 1 |
| 5 | Female Married 2 2 0 2 |
| 6 | Female Single 0 4 2 4 |
| 7 | Male Married 1 1 1 1 |
| 8 | Female Single 0 3 4 3 |
| 9 | Male Married 3 3 2 0 |
| 10 | Male Single 0 2 5 5 |
| 11 | Female Married 1 4 1 2 |
| 12 | ; |
| 13 | RUN; |
First, a simple Poisson regression model is fitted using `countregFitModel` and saved to an item store named `poisson_model_store`. Then, `countregViewStore` is used to display the minimal default information about the stored model.
| 1 | PROC CAS; |
| 2 | countreg.countregFitModel / |
| 3 | TABLE='science_articles', |
| 4 | model={depVars={{name='articles'}}, |
| 5 | effects={{vars={'gender', 'married', 'kids', 'phd_prestige', 'mentorees'}}}, |
| 6 | dist='POISSON'}, |
| 7 | store={name='poisson_model_store', replace=true}; |
| 8 | RUN; |
| 9 | countreg.countregViewStore / |
| 10 | TABLE='science_articles', |
| 11 | instore='poisson_model_store'; |
| 12 | RUN; |
This example first fits a Negative Binomial model to account for overdispersion and saves it to `nb_model_store`. Then, `countregViewStore` is used with the `viewOptions={all=true}` parameter to display all available information for the restored model, including parameter estimates, correlations, and optimizer settings.
| 1 | PROC CAS; |
| 2 | countreg.countregFitModel / |
| 3 | TABLE='science_articles', |
| 4 | model={depVars={{name='articles'}}, |
| 5 | effects={{vars={'gender', 'married', 'kids', 'phd_prestige', 'mentorees'}}}, |
| 6 | dist='NEGBIN'}, |
| 7 | store={name='nb_model_store', replace=true}; |
| 8 | RUN; |
| 9 | countreg.countregViewStore / |
| 10 | TABLE='science_articles', |
| 11 | instore='nb_model_store', |
| 12 | viewOptions={all=true}; |
| 13 | RUN; |
This example demonstrates how to view specific reports, such as the parameter estimates and their covariance matrix, from a stored model. It also shows how to save the `Correlations` table to a new CAS output table named `model_correlations` for further analysis.
| 1 | PROC CAS; |
| 2 | countreg.countregViewStore / |
| 3 | TABLE='science_articles', |
| 4 | instore='nb_model_store', |
| 5 | viewOptions={finalEstimates=true, covariances=true, correlations=true}, |
| 6 | outputTables={names={Correlations='model_correlations', replace=true}}; |
| 7 | RUN; |