The COMPARE statement creates tables of side-by-side comparisons of parameter estimates and other model statistics. You can fit multiple models simultaneously by specifying multiple MODEL statements, and you can specify a COMPARE statement to create tables that compare the models.
The COMPARE statement creates two tables: the first table compares model fit statistics such as R-square and mean square error; the second table compares regression coefficients, their standard errors, and (optionally) t tests.
By default, comparison tables are created for all fitted models, but you can use the optional model-list to limit the comparison to a subset of the fitted models. The model-list consists of a set of model labels, as specified in the MODEL statement; for more information, see the section MODEL Statement. If a model does not have a label, you refer to it generically as “Model i,” where the corresponding model is the ith MODEL statement specified.
You can specify one or more COMPARE statements. The following code illustrates the use of the COMPARE statement:
proc cpanel data = mycas.a;
id csid tsid;
mod_one: model y = x1 x2 x3 / fixone;
second: y = x1 x2 / fixone;
model y = x1 x2 x3 x4 / ranone;
compare;
compare "second" "Model 3";
run;
The first COMPARE statement compares all three fitted models. The second COMPARE statement uses the generic “Model 3” to identify the third model and compares it to the second model.
You can specify the following options after a slash (/):
-
MSTAT (mstat-list)
specifies a list of model fit statistics to be displayed. A set of statistics is displayed by default, but you can use this option to specify a custom set of model statistics.
The mstat-list can contain one or more of the following keywords:
- ALL
displays all model fit statistics. Not all statistics are appropriate for all models, and thus not always calculated. A blank cell in the table indicates that the statistic is not appropriate for that model.
- DFE
displays the error degrees of freedom. This statistic is displayed by default.
- F
displays the F statistic of the overall test for no fixed effects.
- FNUMDF
displays the numerator degrees of freedom of the overall test for no fixed effects.
- FDENDF
displays the denominator degrees of freedom of the overall test for no fixed effects.
- M
displays the Hausman test m statistic.
- MDF
displays the Hausman test degrees of freedom.
- MSE
displays the model mean square error. This statistic is displayed by default.
- NCS
displays the number of cross sections. This statistic is displayed by default.
- NOBS
displays the number of observations. This statistic is displayed by default.
- NONE
suppresses the table of model fit statistics when specified alone, and is ignored when specified with other options.
- NTS
displays the maximum length of the time series. This statistic is displayed by default.
- PROBF
displays the significance level of the overall test for no fixed effects.
- PROBM
displays the significance level of the Hausman test.
- RMSE
displays the model root mean square error.
- RSQUARE
displays the model R-square fit statistic. This statistic is displayed by default.
- SSE
displays the model sum of squares.
- VARCS
displays the variance component that corresponds to cross sections in random-effects models.
- VARERR
displays the variance component that corresponds to error in random-effects models.
- VARTS
displays the variance component that corresponds to time series in random-effects models.
-
OUTPARM=CAS-libref.data-table
names an output data table to contain the data from the comparison table for parameter estimates, standard errors, and t tests. CAS-libref.data-table is a two-level name, where CAS-libref refers to the caslib and session identifier, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.
-
OUTSTAT=CAS-libref.data-table
names an output data table to contain the data from the comparison table for model fit statistics, such as R-square and mean square error. CAS-libref.data-table is a two-level name, where CAS-libref refers to the caslib and session identifier, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.
-
PSTAT (pstat-list)
specifies a list of parameter statistics to be displayed. By default, estimated regression coefficients and their standard errors are displayed. Use this option to specify a custom set of parameter statistics.
pstat-list can contain one or more of the following keywords:
- ALL
displays all parameter statistics.
- ESTIMATE
displays the estimated regression coefficient. This statistic is displayed by default.
- NONE
suppresses the table of parameter statistics when specified alone, and is ignored when specified with other options.
- STDERR
displays the standard error. This statistic is displayed by default.
- PROBT
displays the significance level of the t test.
- T
displays the t statistic.
For a demonstration of the COMPARE statement, see Example 9.2.