A 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 use 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. If model labels are longer than 16 characters, then only the first 16 characters of the labels in the model-list are used to determine a match.
You can specify one or more COMPARE statements. The following code illustrates the use of the COMPARE statement:
proc panel data=a;
id csid tsid;
mod_one: model y = x1 x2 x3 / fixone;
model "Second Model" y = x1 x2 / fixone;
model y = x1 x2 x3 x4 / fixone;
compare;
compare "Second Model" "Model 3";
run;
The first COMPARE statement compares all three fitted models. The second COMPARE statement compares the second and third models and uses the generic “Model 3” to identify the third model.
You can specify the following options in the COMPARE statement 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 every statistic is always calculated. A blank cell in the table indicates that a particular 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.
-
FDENDF
displays the denominator degrees of freedom of the overall test for no fixed effects.
-
FNUMDF
displays the numerator 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.
-
NONE
suppresses the table of model fit statistics.
-
NTS
displays the maximum time series length. 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 due to cross sections in random-effects models.
-
VARERR
displays the error variance component in random-effects models.
-
VARTS
displays the variance component due to time series in random-effects models.
-
OUTPARM=SAS-data-set
names an output data set to contain the data from the comparison table for parameter estimates, standard errors, and t tests.
-
OUTSTAT=SAS-data-set
names an output data set to contain the data from the comparison table for model fit statistics, such as R-square and mean square error.
-
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.
The 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.
-
PROBT
displays the significance level of the t test.
-
STDERR
displays the standard error. This statistic is displayed by default.
-
T
displays the t statistic.
See Example 25.3 for a demonstration of the COMPARE statement.