Syntax


The following statements are available in PROC REG.

  • PROC REG < options > ;

    • < label: > MODEL dependents= < regressors >< / options > ;

    • BY variables ;

    • FREQ variable ;

    • ID variables ;

    • VAR variables ;

    • WEIGHT variable ;

    • ADD variables ;

    • DELETE variables ;

    • < label: > MTEST < equation, ... ,equation >< / options > ;

    • OUTPUT < OUT= SAS-data-set > keyword= names

    • < ... keyword=names > ;

    • PAINT < condition ALLOBS >

    • < / options > < STATUS UNDO > ;

    • PLOT < yvariable*xvariable >< =symbol >

    • < ... yvariable*xvariable >< =symbol >< / options > ;

    • PRINT < options >< ANOVA >< MODELDATA > ;

    • REFIT;

    • RESTRICT equation, ,equation ;

    • REWEIGHT < condition ALLOBS >

    • < / options > < STATUS UNDO > ;

    • < label: > TEST equation , <, , equation >< / option > ;

Although there are numerous statements and options available in PROC REG, many analyses use only a few of them. Often you can find the features you need by looking at an example or by scanning this section.

In the preceding list, brackets denote optional specifications, and vertical bars denote a choice of one of the specifications separated by the vertical bars. In all cases, label is optional.

The PROC REG statement is required. To fit a model to the data, you must specify the MODEL statement. If you want to use only the options available in the PROC REG statement, you do not need a MODEL statement, but you must use a VAR statement. (See the example in the OUTSSCP= Data Sets section on page 3868.) Several MODEL statements can be used. In addition, several MTEST, OUTPUT, PAINT, PLOT, PRINT, RESTRICT, and TEST statements can follow each MODEL statement. The ADD, DELETE, and REWEIGHT statements are used interactively to change the regression model and the data used in fitting the model. The ADD, DELETE, MTEST, OUTPUT, PLOT, PRINT, RESTRICT, and TEST statements implicitly refit the model; changes made to the model are reflected in the results from these statements. The REFIT statement is used to refit the model explicitly and is most helpful when it follows PAINT and REWEIGHT statements, which do not refit the model. The BY, FREQ, ID, VAR, and WEIGHT statements are optionally specified once for the entire PROC step, and they must appear before the first RUN statement.

When TYPE=CORR, TYPE=COV, or TYPE=SSCP data sets are used as input data sets to PROC REG, statements and options that require the original data are not available. Specifically, the OUTPUT, PAINT, PLOT, and REWEIGHT statements and the MODEL and PRINT statement options P, R, CLM, CLI, DW, DWPROB, INFLUENCE, and PARTIAL are disabled.

You can specify the following statements with the REG procedure in addition to the PROC REG statement:

ADD

adds independent variables to the regression model.

BY

specifies variables to define subgroups for the analysis.

DELETE

deletes independent variables from the regression model.

FREQ

specifies a frequency variable.

ID

names a variable to identify observations in the tables.

MODEL

specifies the dependent and independent variables in the regression model, requests a model selection method, displays predicted values, and provides details on the estimates (according to which options are selected).

MTEST

performs multivariate tests across multiple dependent variables.

OUTPUT

creates an output data set and names the variables to contain predicted values, residuals, and other diagnostic statistics.

PAINT

paints points in scatter plots.

PLOT

generates scatter plots.

PRINT

displays information about the model and can reset options.

REFIT

refits the model.

RESTRICT

places linear equality restrictions on the parameter estimates.

REWEIGHT

excludes specific observations from analysis or changes the weights of observations used.

TEST

performs an F test on linear functions of the parameters.

VAR

lists variables for which crossproducts are to be computed, variables that can be interactively added to the model, or variables to be used in scatter plots.

WEIGHT

declares a variable to weight observations.

PROC REG Statement

  • PROC REG < options > ;

The PROC REG statement is required. If you want to fit a model to the data, you must also use a MODEL statement. If you want to use only the PROC REG options, you do not need a MODEL statement, but you must use a VAR statement. If you do not use a MODEL statement, then the COVOUT and OUTEST= options are not available.

Table 61.1 lists the options you can use with the PROC REG statement. Note that any option specified in the PROC REG statement applies to all MODEL statements.

Table 61.1: PROC REG Statement Options

Option

Description

Data Set Options

DATA=

names a data set to use for the regression

OUTEST=

outputs a data set that contains parameter estimates and other model fit summary statistics

OUTSSCP=

outputs a data set that contains sums of squares and crossproducts

COVOUT

outputs the covariance matrix for parameter estimates to the OUTEST= data set

EDF

outputs the number of regressors, the error degrees of freedom, and the model R 2 to the OUTEST= data set

OUTSTB

outputs standardized parameter estimates to the OUTEST= data set. Use only with the RIDGE= or PCOMIT= option.

OUTSEB

outputs standard errors of the parameter estimates to the OUTEST= data set

OUTVIF

outputs the variance inflation factors to the OUTEST= data set. Use only with the RIDGE= or PCOMIT= option.

PCOMIT=

performs incomplete principal component analysis and outputs estimates to the OUTEST= data set

PRESS

outputs the PRESS statistic to the OUTEST= data set

RIDGE=

performs ridge regression analysis and outputs estimates to the OUTEST= data set

RSQUARE

same effect as the EDF option

TABLEOUT

outputs standard errors, confidence limits, and associated test statistics of the parameter estimates to the OUTEST= data set

High Resolution Graphics Options

ANNOTATE=

specifies an annotation data set

GOUT=

specifies the graphics catalog in which graphics output is saved

Display Options

CORR

displays correlation matrix for variables listed in MODEL and

VAR

statements

SIMPLE

displays simple statistics for each variable listed in MODEL and

VAR

statements

USCCP

displays uncorrected sums of squares and crossproducts matrix

ALL

displays all statistics (CORR, SIMPLE, and USSCP)

NOPRINT

suppresses output

LINEPRINTER

creates plots requested as line printer plot

Other Options

ALPHA=

sets significance value for confidence and prediction intervals and tests

SINGULAR=

sets criterion for checking for singularity

Following are explanations of the options that you can specify in the PROC REG statement (in alphabetical order). Note that any option specified in the PROC REG statement applies to all MODEL statements.

ALL

  • requests the display of many tables. Using the ALL option in the PROC REG statement is equivalent to specifying ALL in every MODEL statement. The ALL option also implies the CORR, SIMPLE, and USSCP options.

ALPHA = number

  • sets the significance level used for the construction of confidence intervals. The value must be between 0 and 1; the default value of 0.05 results in 95% intervals. This option affects the PROC REG option TABLEOUT; the MODEL options CLB, CLI, and CLM; the OUTPUT statement keywords LCL, LCLM, UCL, and UCLM; the PLOT statement keywords LCL., LCLM., UCL., and UCLM.; and the PLOT statement options CONF and PRED.

ANNOTATE = SAS-data-set

ANNO = SAS-data-set

  • specifies an input data set containing annotate variables, as described in SAS/GRAPH Software: Reference . You can use this data set to add features to plots. Features provided in this data set are applied to all plots produced in the current run of PROC REG. To add features to individual plots, use the ANNOTATE= option in the PLOT statement. This option cannot be used if the LINEPRINTER option is specified.

CORR

  • displays the correlation matrix for all variables listed in the MODEL or VAR statement.

COVOUT

  • outputs the covariance matrices for the parameter estimates to the OUTEST= data set. This option is valid only if the OUTEST= option is also specified. See the OUTEST= Data Set section on page 3863.

DATA = SAS-data-set

EDF

  • outputs the number of regressors in the model excluding and including the intercept, the error degrees of freedom, and the model R 2 to the OUTEST= data set.

GOUT = graphics-catalog

  • specifies the graphics catalog in which graphics output is saved. The default graphicscatalog is WORK.GSEG. The GOUT= option cannot be used if the LINEPRINTER option is specified.

LINEPRINTER LP

  • creates plots requested as line printer plots. If you do not specify this option, requested plots are created on a high resolution graphics device. This option is required if plots are requested and you do not have SAS/GRAPH software.

NOPRINT

OUTEST = SAS-data-set

  • requests that parameter estimates and optional model fit summary statistics be output to this data set. See the OUTEST= Data Set section on page 3863 for details. If you want to create a permanent SAS data set, you must specify a two-level name (refer to the section SAS Files in SAS Language Reference: Concepts for more information on permanent SAS data sets).

OUTSEB

  • outputs the standard errors of the parameter estimates to the OUTEST= data set. The value SEB for the variable _TYPE_ identifies the standard errors. If the RIDGE= or PCOMIT= option is specified, additional observations are included and identified by the values RIDGESEB and IPCSEB, respectively, for the variable _TYPE_ .The standard errors for ridge regression estimates and IPC estimates are limited in their usefulness because these estimates are biased . This option is available for all model selection methods except RSQUARE, ADJRSQ, and CP.

OUTSSCP = SAS-data-set

  • requests that the sums of squares and crossproducts matrix be output to this TYPE=SSCP data set. See the OUTSSCP= Data Sets section on page 3868 for details. If you want to create a permanent SAS data set, you must specify a two-level name (refer to the section SAS Files in SAS Language Reference: Concepts for more information on permanent SAS data sets).

OUTSTB

  • outputs the standardized parameter estimates as well as the usual estimates to the OUTEST= data set when the RIDGE= or PCOMIT= option is specified. The values RIDGESTB and IPCSTB for the variable _TYPE_ identify ridge regression estimates and IPC estimates, respectively.

OUTVIF

  • outputs the variance inflation factors (VIF) to the OUTEST= data set when the RIDGE= or PCOMIT= option is specified. The factors are the diagonal elements of the inverse of the correlation matrix of regressors as adjusted by ridge regression or IPC analysis. These observations are identified in the output data set by the values RIDGEVIF and IPCVIF for the variable _TYPE_ .

PCOMIT = list

  • requests an incomplete principal components (IPC) analysis for each value m in the list. The procedure computes parameter estimates using all but the last m principal components. Each value of m produces a set of IPC estimates, which are output to the OUTEST= data set. The values of m are saved by the variable _PCOMIT_ , and the value of the variable _TYPE_ is set to IPC to identify the estimates. Only nonnegative integers can be specified with the PCOMIT= option.

    If you specify the PCOMIT= option, RESTRICT statements are ignored.

PRESS

  • outputs the PRESS statistic to the OUTEST= data set. The values of this statistic are saved in the variable _PRESS_ . This option is available for all model selection methods except RSQUARE, ADJRSQ, and CP.

RIDGE = list

  • requests a ridge regression analysis and specifies the values of the ridge constant k (see the Computations for Ridge Regression and IPC Analysis section on page 3916). Each value of k produces a set of ridge regression estimates that are placed in the OUTEST= data set. The values of k are saved by the variable _RIDGE_ , and the value of the variable _TYPE_ is set to RIDGE to identify the estimates.

  • Only nonnegative numbers can be specified with the RIDGE= option. Example 61.10 on page 3956 illustrates this option.

  • If ODS graphics are in effect (see the ODS Graphics section on page 3922), then ridge regression plots are automatically produced. These plots consist of panels containing ridge traces for the regressors, with at most eight ridge traces per panel.

    If you specify the RIDGE= option, RESTRICT statements are ignored.

RSQUARE

  • has the same effect as the EDF option.

SIMPLE

  • displays the sum, mean, variance, standard deviation, and uncorrected sum of squares for each variable used in PROC REG.

SINGULAR = n

  • tunes the mechanism used to check for singularities. The default value is machine dependent but is approximately 1E “ 7 on most machines. This option is rarely needed. Singularity checking is described in the Computational Methods section on page 3917.

TABLEOUT

  • outputs the standard errors and 100(1 ˆ’ ± )% confidence limits for the parameter estimates, the t statistics for testing if the estimates are zero, and the associated p -values to the OUTEST= data set. The _TYPE_ variable values STDERR, L n B, U n B, T, and PVALUE, where n = 100(1 ˆ’ ± ), identify these rows in the OUTEST= data set. The ± -level can be set with the ALPHA= option in the PROC REG or MODEL statement. The OUTEST= option must be specified in the PROC REG statement for this option to take effect.

USSCP

  • displays the uncorrected sums-of-squares and crossproducts matrix for all variables used in the procedure.

ADD Statement

  • ADD variables ;

The ADD statement adds independent variables to the regression model. Only variables used in the VAR statement or used in MODEL statements before the first RUN statement can be added to the model. You can use the ADD statement interactively to add variables to the model or to include a variable that was previously deleted with a DELETE statement. Each use of the ADD statement modifies the MODEL label. See the Interactive Analysis section on page 3869 for an example.

BY Statement

  • BY variables ;

You can specify a BY statement with PROC REG to obtain separate analyses on observations in groups defined by the BY variables. When a BY statement appears, the procedure expects the input data set to be sorted in the order of the BY variables. The variables are one or more variables in the input data set.

If your input data set is not sorted in ascending order, use one of the following alternatives.

  • Sort the data using the SORT procedure with a similar BY statement.

  • Specify the BY statement option NOTSORTED or DESCENDING in the BY statement for the REG procedure. The NOTSORTED option does not mean that the data are unsorted but rather that the data are arranged in groups (according to values of the BY variables) and that these groups are not necessarily in alphabetical or increasing numeric order.

  • Create an index on the BY variables using the DATASETS procedure (in base SAS software).

When a BY statement is used with PROC REG, interactive processing is not possible; that is, once the first RUN statement is encountered , processing proceeds for each BY group in the data set, and no further statements are accepted by the procedure. A BY statement that appears after the first RUN statement is ignored.

For more information on the BY statement, refer to the discussion in SAS Language Reference: Contents . For more information on the DATASETS procedure, refer to the discussion in the SAS Procedures Guide .

DELETE Statement

  • DELETE variables ;

The DELETE statement deletes independent The DELETE statement performs the opposite function of the ADD statement and is used in a similar manner. Each use of the DELETE statement modifies the MODEL label. For an example of how the ADD statement is used (and how the DELETE statement can be used), see the Interactive Analysis section on page 3869.

FREQ Statement

  • FREQ variable ;

When a FREQ statement appears, each observation in the input data set is assumed to represent n observations, where n is the value of the FREQ variable. The analysis produced using a FREQ statement is the same as an analysis produced using a data set that contains n observations in place of each observation in the input data set. When the procedure determines degrees of freedom for significance tests, the total number of observations is considered to be equal to the sum of the values of the FREQ variable.

If the value of the FREQ variable is missing or is less than 1, the observation is not used in the analysis. If the value is not an integer, only the integer portion is used.

The FREQ statement must appear before the first RUN statement, or it is ignored.

ID Statement

  • ID variables ;

When one of the MODEL statement options CLI, CLM, P, R, or INFLUENCE is requested, the variables listed in the ID statement are displayed beside each observation. These variables can be used to identify each observation. If the ID statement is omitted, the observation number is used to identify the observations.

Although there are no restrictions on the length of ID variables, PROC REG may truncate ID values to 16 characters for display purposes.

MODEL Statement

  • < label: > MODEL dependents = < regressors >< / options > ;

After the keyword MODEL, the dependent (response) variables are specified, followed by an equal sign and the regressor variables. Variables specified in the MODEL statement must be numeric variables in the data set being analyzed . For example, if you want to specify a quadratic term for variable X1 in the model, you cannot use X1*X1 in the MODEL statement but must create a new variable (for example, X1SQUARE=X1*X1) in a DATA step and use this new variable in the MODEL statement. The label in the MODEL statement is optional.

Table 61.2 lists the options available in the MODEL statement. Equations for the statistics available are given in the Model Fit and Diagnostic Statistics section on page 3896.

Table 61.2: MODEL Statement Options

Option

Description

Model Selection and Details of Selection

SELECTION=

specifies model selection method

BEST=

specifies maximum number of subset models displayed or output to the OUTEST= data set

DETAILS

produces summary statistics at each step

DETAILS=

specifies the display details for forward, backward, and stepwise methods

GROUPNAMES=

provides names for groups of variables

INCLUDE=

includes first n variables in the model

MAXSTEP=

specifies maximum number of steps that may be performed

NOINT

fits a model without the intercept term

PCOMIT=

performs incomplete principal component analysis and outputs estimates to the OUTEST= data set

SLE=

sets criterion for entry into model

RIDGE=

performs ridge regression analysis and outputs estimates to the OUTEST= data set

SLS=

sets criterion for staying in model

START=

specifies number of variables in model to begin the comparing and switching process

STOP=

stops selection criterion

Fit Statistics

ADJRSQ

computes adjusted R 2

AIC

computes Akaike s information criterion

B

computes parameter estimates for each model

BIC

computes Sawa s Bayesian information criterion

CP

computes Mallows C p statistic

GMSEP

computes estimated MSE of prediction assuming multivariate normality

JP

computes J p , the final prediction error

MSE

computes MSE for each model

PC

computes Amemiya s prediction criterion

RMSE

displays root MSE for each model

SBC

computes the SBC statistic

SP

computes S p statistic for each model

SSE

computes error sum of squares for each model

Data Set Options

EDF

outputs the number of regressors, the error degrees of freedom, and the model R 2 to the OUTEST= data set

OUTSEB

outputs standard errors of the parameter estimates to the

OUTEST=

data set

OUTSTB

outputs standardized parameter estimates to the OUTEST= data set. Use only with the RIDGE= or PCOMIT= option.

OUTVIF

outputs the variance inflation factors to the OUTEST= data set. Use only with the RIDGE= or PCOMIT= option.

PRESS

outputs the PRESS statistic to the OUTEST= data set

RSQUARE

has same effect as the EDF option

Regression Calculations

I

displays inverse of sums of squares and crossproducts

XPX

displays sums-of-squares and crossproducts matrix

Details on Estimates

ACOV

displays asymptotic covariance matrix of estimates assuming heteroscedasticity

COLLIN

produces collinearity analysis

COLLINOINT

produces collinearity analysis with intercept adjusted out

CORRB

displays correlation matrix of estimates

COVB

displays covariance matrix of estimates

PARTIALR2

displays squared semi-partial correlation coefficients using Type I sums of squares

PCORR1

displays squared partial correlation coefficients using Type I sums of squares

PCORR2

displays squared partial correlation coefficients using Type II sums of squares

SCORR1

displays squared semi-partial correlation coefficients using Type I sums of squares

SCORR2

displays squared semi-partial correlation coefficients using Type II sums of squares

SEQB

displays a sequence of parameter estimates during selection process

SPEC

tests that first and second moments of model are correctly specified

SS1

displays the sequential sums of squares

SS2

displays the partial sums of squares

STB

displays standardized parameter estimates

TOL

displays tolerance values for parameter estimates

VIF

computes variance-inflation factors

Predicted and Residual Values

CLB

computes 100(1 ˆ’ ± )%confidence limits for the parameter estimates

CLI

computes 100(1 ˆ’ ± )%confidence limits for an individual predicted value

CLM

computes 100(1 ˆ’ ± )%confidence limits for the expected value of the dependent variable

DW

computes a Durbin-Watson statistic

DWPROB

computes a Durbin-Watson statistic and p-value

INFLUENCE

computes influence statistics

P

computes predicted values

PARTIAL

displays partial regression plots for each regressor

R

produces analysis of residuals

Display Options and Other Options

ALL

requests the following options:

ACOV, CLB, CLI, CLM, CORRB, COVB, I, P, PCORR1, PCORR2, R, SCORR1, SCORR2, SEQB, SPEC, SS1, SS2, STB, TOL, VIF, XPX

ALPHA=

sets significance value for confidence and prediction intervals and tests

NOPRINT

suppresses display of results

SIGMA=

specifies the true standard deviation of error term for computing CP and BIC

SINGULAR=

sets criterion for checking for singularity

You can specify the following options in the MODEL statement after a slash (/).

ACOV

  • displays the estimated asymptotic covariance matrix of the estimates under the hypothesis of heteroscedasticity. See the section Testing for Heteroscedasticity on page 3910 for more information.

ADJRSQ

  • computes R 2 adjusted for degrees of freedom for each model selected (Darlington 1968; Judge et al. 1980).

AIC

  • outputs Akaike s information criterion for each model selected (Akaike 1969; Judge et al. 1980) to the OUTEST= data set. If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the AIC statistic is also added to the SubsetSelSummary table.

ALL

  • requests all these options: ACOV, CLB, CLI, CLM, CORRB, COVB, I, P, PCORR1, PCORR2, R, SCORR1, SCORR2, SEQB, SPEC, SS1, SS2, STB, TOL, VIF, and XPX.

ALPHA= number

  • sets the significance level used for the construction of confidence intervals for the current MODEL statement. The value must be between 0 and 1; the default value of 0.05 results in 95% intervals. This option affects the MODEL options CLB, CLI, and CLM; the OUTPUT statement keywords LCL, LCLM, UCL, and UCLM; the PLOT statement keywords LCL., LCLM., UCL., and UCLM.; and the PLOT statement options CONF and PRED. Specifying this option in the MODEL statement takes precedence over the ALPHA= option in the PROC REG statement.

B

  • is used with the RSQUARE, ADJRSQ, and CP model-selection methods to compute estimated regression coefficients for each model selected.

BEST= n

  • is used with the RSQUARE, ADJRSQ, and CP model-selection methods. If SELECTION=CP or SELECTION=ADJRSQ is specified, the BEST= option specifies the maximum number of subset models to be displayed or output to the OUTEST= data set. For SELECTION=RSQUARE, the BEST= option requests the maximum number of subset models for each size .

  • If the BEST= option is used without the B option (displaying estimated regression coefficients), the variables in each MODEL are listed in order of inclusion instead of the order in which they appear in the MODEL statement.

  • If the BEST= option is omitted and the number of regressors is less than 11, all possible subsets are evaluated. If the BEST= option is omitted and the number of regressors is greater than 10, the number of subsets selected is, at most, equal to the number of regressors. A small value of the BEST= option greatly reduces the CPU time required for large problems.

BIC

  • outputs Sawa s Bayesian information criterion for each model selected (Sawa 1978; Judge et al. 1980) to the OUTEST= data set. If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the BIC statistic is also added to the SubsetSelSummary table.

CLB

  • requests the 100(1 ˆ’ ± )% upper- and lower-confidence limits for the parameter estimates. By default, the 95% limits are computed; the ALPHA= option in the PROC REG or MODEL statement can be used to change the ± -level.

CLI

  • requests the 100(1 ˆ’ ± )% upper- and lower-confidence limits for an individual predicted value. By default, the 95% limits are computed; the ALPHA= option in the PROC REG or MODEL statement can be used to change the ± -level. The confidence limits reflect variation in the error, as well as variation in the parameter estimates. See the Predicted and Residual Values section on page 3879 and Chapter 2, Introduction to Regression Procedures, for more information.

CLM

  • displays the 100(1 ˆ’ ± )% upper- and lower-confidence limits for the expected value of the dependent variable (mean) for each observation. By default, the 95% limits are computed; the ALPHA= in the PROC REG or MODEL statement can be used to change the ± -level. This is not a prediction interval (see the CLI option) because it takes into account only the variation in the parameter estimates, not the variation in the error term. See the section Predicted and Residual Values on page 3879 and Chapter 2 for more information.

COLLIN

  • requests a detailed analysis of collinearity among the regressors. This includes eigenvalues, condition indices, and decomposition of the variances of the estimates with respect to each eigenvalue . See the Collinearity Diagnostics section on page 3895.

COLLINOINT

  • requests the same analysis as the COLLIN option with the intercept variable adjusted out rather than included in the diagnostics. See the Collinearity Diagnostics section on page 3895.

CORRB

  • displays the correlation matrix of the estimates. This is the ( X ² X ) ˆ’ 1 matrix scaled to unit diagonals.

COVB

  • displays the estimated covariance matrix of the estimates. This matrix is ( X ² X ) ˆ’ 1 s 2 , where s 2 is the estimated mean squared error.

CP

  • outputs Mallows C p statistic for each model selected (Mallows 1973; Hocking 1976). See the Criteria Used in Model-Selection Methods section on page 3876 for a discussion of the use of C p . to the OUTEST= data set. If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the CP statistic is also added to the SubsetSelSummary table.

DETAILS

DETAILS= name

  • specifies the level of detail produced when the BACKWARD, FORWARD or STEPWISE methods are used, where name can be ALL, STEPS or SUMMARY. The DETAILS or DETAILS=ALL option produces entry and removal statistics for each variable in the model building process, ANOVA and parameter estimates at each step, and a selection summary table. The option DETAILS=STEPS provides the step information and summary table. The option DETAILS=SUMMARY produces only the summary table. The default if the DETAILS option is omitted is DETAILS=STEPS.

DW

  • calculates a Durbin-Watson statistic to test whether or not the errors have first-order autocorrelation. (This test is appropriate only for time series data.) The sample autocorrelation of the residuals is also produced. See the section Autocorrelation in Time Series Data on page 3915.

DWPROB

  • calculates a Durbin-Watson statistic and a p-value to test whether or not the errors have first-order autocorrelation. Note that it is not necessary to specify the DW option if the DWPROB option is specified. (This test is appropriate only for time series data.) The sample autocorrelation of the residuals is also produced. See the section Autocorrelation in Time Series Data on page 3915.

EDF

  • outputs the number of regressors in the model excluding and including the intercept, the error degrees of freedom, and the model R 2 to the OUTEST= data set.

GMSEP

  • outputs the estimated mean square error of prediction assuming that both independent and dependent variables are multivariate normal (Stein 1960; Darlington 1968). Note that Hocking s formula (1976, eq. 4.20) contains a misprint: n ˆ’ 1 should read n ˆ’ 2. ) to the OUTEST= data set. If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the GMSEP statistic is also added to the SubsetSelSummary table.

GROUPNAMES= name1 name2

  • provides names for variable groups. This option is available only in the BACKWARD, FORWARD, and STEPWISE methods. The group name can be up to 32 characters. Subsets of independent variables listed in the MODEL statement can be designated as variable groups. This is done by enclosing the appropriate variables in braces. Variables in the same group are entered into or removed from the regression model at the same time. However, if the tolerance of any variable (see the TOL option on page 3832) in a group is less than the setting of the SINGULAR= option, then the variable is not entered into the model with the rest of its group. If the GROUPNAMES= option is not used, then the names GROUP1, GROUP2, , GROUP n are assigned to groups encountered in the MODEL statement. Variables not enclosed by braces are used as groups of a single variable.

  • For example,

      model y={x1 x2} x3 / selection=stepwise   groupnames='x1 x2' 'x3';  
  • As another example,

      model y={ht wgt age} bodyfat / selection=forward   groupnames='htwgtage' 'bodyfat';  

I

  • displays the ( X ² X ) ˆ’ 1 matrix. The inverse of the crossproducts matrix is bordered by the parameter estimates and SSE matrices.

INCLUDE= n

  • forces the first n independent variables listed in the MODEL statement to be included in all models. The selection methods are performed on the other variables in the MODEL statement. The INCLUDE= option is not available with SELECTION=NONE.

INFLUENCE

  • requests a detailed analysis of the influence of each observation on the estimates and the predicted values. See the Influence Diagnostics section on page 3898 for details.

JP

  • outputs J p , the estimated mean square error of prediction for each model selected assuming that the values of the regressors are fixed and that the model is correct to the OUTEST= data set. The J p statistic is also called the final prediction error (FPE) by Akaike (Nicholson 1948; Lord 1950; Mallows 1967; Darlington 1968; Rothman 1968; Akaike 1969; Hocking 1976; Judge et al. 1980). If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the J p statistic is also added to the SubsetSelSummary table.

MSE

  • computes the mean square error for each model selected (Darlington 1968).

MAXSTEP= n

  • specifies the maximum number of steps that are done when SELECTION=FORWARD, SELECTION=BACKWARD or SELECTION=STEPWISE is used. The default value is the number of independent variables in the model for the forward and backward methods and three times this number for the stepwise method.

NOINT

  • suppresses the intercept term that is otherwise included in the model.

NOPRINT

OUTSEB

  • outputs the standard errors of the parameter estimates to the OUTEST= data set. The value SEB for the variable _TYPE_ identifies the standard errors. If the RIDGE= or PCOMIT= option is specified, additional observations are included and identified by the values RIDGESEB and IPCSEB, respectively, for the variable _TYPE_ . The standard errors for ridge regression estimates and incomplete principal components (IPC) estimates are limited in their usefulness because these estimates are biased. This option is available for all model-selection methods except RSQUARE, ADJRSQ, and CP.

OUTSTB

  • outputs the standardized parameter estimates as well as the usual estimates to the OUTEST= data set when the RIDGE= or PCOMIT= option is specified. The values RIDGESTB and IPCSTB for the variable _TYPE_ identify ridge regression estimates and IPC estimates, respectively.

OUTVIF

  • outputs the variance inflation factors (VIF) to the OUTEST= data set when the RIDGE= or PCOMIT= option is specified. The factors are the diagonal elements of the inverse of the correlation matrix of regressors as adjusted by ridge regression or IPC analysis. These observations are identified in the output data set by the values RIDGEVIF and IPCVIF for the variable _TYPE_ .

P

  • calculates predicted values from the input data and the estimated model. The display includes the observation number, the ID variable (if one is specified), the actual and predicted values, and the residual. If the CLI, CLM, or R option is specified, the P option is unnecessary. See the section Predicted and Residual Values on page 3879 for more information.

PARTIAL

  • requests partial regression leverage plots for each regressor. If ODS Graphics are in effect (see the ODS Graphics section on page 3922), then these partial plots are produced in panels with up to six plots per panel. See the Influence Diagnostics section on page 3898 for more information.

PARTIALR2 < ( < TESTS >< SEQTESTS > ) >

  • See the SCORR1 option.

PC

  • outputs Amemiya s prediction criterion for each model selected (Amemiya 1976; Judge et al. 1980) to the OUTEST= data set. If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the PC statistic is also added to the SubsetSelSummary table.

PCOMIT= list

  • requests an IPC analysis for each value m in the list. The procedure computes parameter estimates using all but the last m principal components. Each value of m produces a set of IPC estimates, which is output to the OUTEST= data set. The values of m are saved by the variable _PCOMIT_ , and the value of the variable _TYPE_ is set to IPC to identify the estimates. Only nonnegative integers can be specified with the PCOMIT= option.

  • If you specify the PCOMIT= option, RESTRICT statements are ignored. The PCOMIT= option is ignored if you use the SELECTION= option in the MODEL statement.

PCORR1

  • displays the squared partial correlation coefficients using Type I Sum of Squares (SS). This is calculated as SS/(SS+SSE), where SSE is the error Sum of Squares.

PCORR2

  • displays the squared partial correlation coefficients using Type II sums of squares. These are calculated the same way as with the PCORR1 option, except that Type II SS are used instead of Type I SS.

PRESS

  • outputs the PRESS statistic to the OUTEST= data set. The values of this statistic are saved in the variable _PRESS_ . This option is available for all model-selection methods except RSQUARE, ADJRSQ, and CP.

R

  • requests an analysis of the residuals. The results include everything requested by the P option plus the standard errors of the mean predicted and residual values, the studentized residual, and Cook s D statistic to measure the influence of each observation on the parameter estimates. See the section Predicted and Residual Values on page 3879 for more information.

RIDGE= list

  • requests a ridge regression analysis and specifies the values of the ridge constant k (see the Computations for Ridge Regression and IPC Analysis section on page 3916). Each value of k produces a set of ridge regression estimates that are placed in the OUTEST= data set. The values of k are saved by the variable _RIDGE_ , and the value of the variable _TYPE_ is set to RIDGE to identify the estimates.

  • Only nonnegative numbers can be specified with the RIDGE= option. Example 61.10 on page 3956 illustrates this option.

  • If you specify the RIDGE= option, RESTRICT statements are ignored. The RIDGE= option is ignored if you use the SELECTION= option in the MODEL statement.

RMSE

  • displays the root mean square error for each model selected.

RSQUARE

  • has the same effect as the EDF option.

SBC

  • outputs the SBC statistic for each model selected (Schwarz 1978; Judge et al. 1980) to the OUTEST= data set. If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the SBC statistic is also added to the SubsetSelSummary table.

SCORR1 < ( < TESTS >< SEQTESTS > ) >

  • displays the squared semi-partial correlation coefficients using Type I sums of squares. This is calculated as SS/SST, where SST is the corrected total SS. If the NOINT option is used, the uncorrected total SS is used in the denominator. The optional arguments TESTS and SEQTESTS request F-tests, p-values , and cumulative R-Square values as variables are sequentially added to a model. The F-test values are computed as the Type I sum of squares for the variable in question divided by a mean square error. If you specify the TESTS option, the denominator MSE is the residual mean square for the full model specified in the MODEL statement. If you specify the SEQTESTS option, the denominator MSE is the residual mean square for the model containing all the independent variables that have been added to the model up to and including the variable in question. The TESTS and SEQTESTS options are not supported if you specify model selection methods, or the RIDGE or PCOMIT options. Note that the PARTIALR2 option is a synonym for the SCORR1 option.

SCORR2 < ( TESTS ) >

  • displays the squared semi-partial correlation coefficients using Type II sums of squares. These are calculated the same way as with the SCORR1 option, except that Type II SS are used instead of Type I SS. The optional TEST argument requests F-tests and p-values as variables are sequentially added to a model. The F-test values are computed as the Type II sum of squares for the variable in question divided by the residual mean square for the full model specified in the MODEL statement. The TESTS option is not supported if you specify model selection methods, or the RIDGE or PCOMIT options.

SELECTION= name

  • specifies the method used to select the model, where name can be FORWARD (or F), BACKWARD (or B), STEPWISE, MAXR, MINR, RSQUARE, ADJRSQ, CP, or NONE (use the full model). The default method is NONE. See the Model-Selection Methods section on page 3873 for a description of each method.

SEQB

  • produces a sequence of parameter estimates as each variable is entered into the model. This is displayed as a matrix where each row is a set of parameter estimates.

SIGMA= n

  • specifies the true standard deviation of the error term to be used in computing the CP and BIC statistics. If the SIGMA= option is not specified, an estimate from the full model is used. This option is available in the RSQUARE, ADJRSQ, and CP model-selection methods only.

SINGULAR= n

  • tunes the mechanism used to check for singularities. Specifying this option in the MODEL statement takes precedence over the SINGULAR= option in the PROC REG statement. The default value is machine dependent but is approximately 1E “ 7on most machines. This option is rarely needed. Singularity checking is described in the Computational Methods section on page 3917.

SLENTRY= value

SLE= value

  • specifies the significance level for entry into the model used in the FORWARD and STEPWISE methods. The defaults are 0.50 for FORWARD and 0.15 for STEPWISE.

SLSTAY= value

SLS= value

  • specifies the significance level for staying in the model for the BACKWARD and STEPWISE methods. The defaults are 0.10 for BACKWARD and 0.15 for STEPWISE.

SP

  • outputs the S p statistic for each model selected (Hocking 1976) to the OUTEST= data set. If SELECTION=ADJRSQ, SELECTION=RSQUARE, or SELECTION=CP is specified, then the SP statistic is also added to the SubsetSelSummary table.

SPEC

  • performs a test that the first and second moments of the model are correctly specified. See the section Testing for Heteroscedasticity on page 3910 for more information.

SS1

SS2

  • displays the partial sums of squares (Type II SS) along with the parameter estimates for each term in the model. See the SS1 option also.

SSE

  • computes the error sum of squares for each model selected.

START= s

  • is used to begin the comparing-and-switching process in the MAXR, MINR, and STEPWISE methods for a model containing the first s independent variables in the MODEL statement, where s is the START value. For these methods, the default is START=0.

  • For the RSQUARE, ADJRSQ, and CP methods, START= s specifies the smallest number of regressors to be reported in a subset model. For these methods, the default is START=1.

  • The START= option cannot be used with model-selection methods other than the six described here.

STB

  • produces standardized regression coefficients. A standardized regression coefficient is computed by dividing a parameter estimate by the ratio of the sample standard deviation of the dependent variable to the sample standard deviation of the regressor.

STOP= s

  • causes PROC REG to stop when it has found the best s -variable model, where s is the STOP value. For the RSQUARE, ADJRSQ, and CP methods, STOP= s specifies the largest number of regressors to be reported in a subset model. For the MAXR and MINR methods, STOP= s specifies the largest number of regressors to be included in the model.

  • The default setting for the STOP= option is the number of variables in the MODEL statement. This option can be used only with the MAXR, MINR, RSQUARE, ADJRSQ and CP methods.

TOL

  • produces tolerance values for the estimates. Tolerance for a variable is defined as 1 ˆ’ R 2 , where R 2 is obtained from the regression of the variable on all other regressors in the model. See the section Collinearity Diagnostics on page 3895 for more detail.

VIF

  • produces variance inflation factors with the parameter estimates. Variance inflation is the reciprocal of tolerance. See the section Collinearity Diagnostics on page 3895 for more detail.

XPX

  • displays the X ² X crossproducts matrix for the model. The crossproducts matrix is bordered by the X ² Y and Y ² Y matrices.

MTEST Statement

  • < label: > MTEST < equation < , ... , equation >>< / options > ;

where each equation is a linear function composed of coefficients and variable names. The label is optional.

The MTEST statement is used to test hypotheses in multivariate regression models where there are several dependent variables fit to the same regressors. If no equations or options are specified, the MTEST statement tests the hypothesis that all estimated parameters except the intercept are zero.

The hypotheses that can be tested with the MTEST statement are of the form

where L is a linear function on the regressor side, ² is a matrix of parameters, c is a column vector of constants, j is a row vector of ones, and M is a linear function on the dependent side. The special case where the constants are zero is

See the section Multivariate Tests on page 3910 for more details.

Each linear function extends across either the regressor variables or the dependent variables. If the equation is across the dependent variables, then the constant term, if specified, must be zero. The equations for the regressor variables form the L matrix and c vector in the preceding formula; the equations for dependent variables form the M matrix. If no equations for the dependent variables are given, PROC REG uses an identity matrix for M , testing the same hypothesis across all dependent variables. If no equations for the regressor variables are given, PROC REG forms a linear function corresponding to a test that all the nonintercept parameters are zero.

As an example, consider the following statements:

  model y1 y2 y3=x1 x2 x3;   mtest x1,x2;   mtest y1-y2, y2 -y3, x1;   mtest y1-y2;  

The first MTEST statement tests the hypothesis that the X 1 and X 2 parameters are zero for Y 1, Y 2 and Y 3. In addition, the second MTEST statement tests the hypothesis that the X 1 parameter is the same for all three dependent variables. For the same model, the third MTEST statement tests the hypothesis that all parameters except the intercept are the same for dependent variables Y 1 and Y 2.

You can specify the following options in the MTEST statement.

CANPRINT

  • displays the canonical correlations for the hypothesis combinations and the dependent variable combinations. If you specify

      mtest / canprint;  
  • the canonical correlations between the regressors and the dependent variables are displayed.

DETAILS

  • displays the M matrix and various intermediate calculations.

PRINT

  • displays the H and E matrices.

OUTPUT Statement

  • OUTPUT < OUT= SAS-data-set > keyword=names <... keyword=names > ;

The OUTPUT statement creates a new SAS data set that saves diagnostic measures calculated after fitting the model. The OUTPUT statement refers to the most recent MODEL statement. At least one keyword=names specification is required.

All the variables in the original data set are included in the new data set, along with variables created in the OUTPUT statement. These new variables contain the values of a variety of statistics and diagnostic measures that are calculated for each observation in the data set. If you want to create a permanent SAS data set, you must specify a two-level name (for example, libref.data-set-name ). For more information on permanent SAS data sets, refer to the section SAS Files in SAS Language Reference: Concepts .

The OUTPUT statement cannot be used when a TYPE=CORR, TYPE=COV, or TYPE=SSCP data set is used as the input data set for PROC REG. See the Input Data Sets section on page 3860 for more details.

The statistics created in the OUTPUT statement are described in this section. More details are contained in the Predicted and Residual Values section on page 3879 and the Influence Diagnostics section on page 3898. Also see Chapter 2, Introduction to Regression Procedures, for definitions of the statistics available from the REG procedure.

You can specify the following options in the OUTPUT statement.

OUT= SAS data set

  • gives the name of the new data set. By default, the procedure uses the DATA n convention to name the new data set.

keyword=names

  • specifies the statistics to include in the output data set and names the new variables that contain the statistics. Specify a keyword for each desired statistic (see the following list of keywords), an equal sign, and the variable or variables to contain the statistic.

  • In the output data set, the first variable listed after a keyword in the OUTPUT statement contains that statistic for the first dependent variable listed in the MODEL statement; the second variable contains the statistic for the second dependent variable in the MODEL statement, and so on. The list of variables following the equal sign can be shorter than the list of dependent variables in the MODEL statement. In this case, the procedure creates the new names in order of the dependent variables in the MODEL statement.

  • For example, the SAS statements

      proc reg data=a;   model y z=x1 x2;   output out=b   p=yhat zhat   r=yresid zresid;   run;  
  • create an output data set named b . In addition to the variables in the input data set, b contains the following variables:

    • yhat , with values that are predicted values of the dependent variable y

    • zhat , with values that are predicted values of the dependent variable z

    • yresid , with values that are the residual values of y

    • zresid , with values that are the residual values of z

  • You can specify the following keywords in the OUTPUT statement. See the Model Fit and Diagnostic Statistics section on page 3896 for computational formulas.

Table 61.3: Keywords for OUTPUT Statement

Keyword

Description

COOKD= names

Cook s D influence statistic

COVRATIO= names

standard influence of observation on covariance of betas, as discussed in the Influence Diagnostics section on page 3898

DFFITS= names

standard influence of observation on predicted value

H= names

leverage,

LCL= names

lower bound of a 100(1 ˆ’ ± )% confidence interval for an individual prediction. This includes the variance of the error, as well as the variance of the parameter estimates.

LCLM= names

lower bound of a 100(1 ˆ’ ± )% confidence interval for the expected value (mean) of the dependent variable

PREDICTED P= names

predicted values

PRESS= names

i th residual divided by (1 ˆ’ h ), where h is the leverage, and where the model has been refit without the i th observation

RESIDUAL R= names

residuals, calculated as ACTUAL minus PREDICTED

RSTUDENT= names

a studentized residual with the current observation deleted

STDI= names

standard error of the individual predicted value

STDP= names

standard error of the mean predicted value

STDR= names

standard error of the residual

STUDENT= names

studentized residuals, which are the residuals divided by their standard errors

UCL= names

upper bound of a 100(1 ˆ’ ± )% confidence interval for an individual prediction

UCLM= names

upper bound of a 100(1 ˆ’ ± )% confidence interval for the expected value (mean) of the dependent variable

PAINT Statement

  • PAINT < condition ALLOBS >< / options > ;

  • PAINT < STATUS UNDO > ;

The PAINT statement selects observations to be painted or highlighted in a scatter plot on line printer output; the PAINT statement is ignored if the LINEPRINTER option is not specified in the PROC REG statement.

All observations that satisfy condition are painted using some specific symbol. The PAINT statement does not generate a scatter plot and must be followed by a PLOT statement, which does generate a scatter plot. Several PAINT statements can be used before a PLOT statement, and all prior PAINT statement requests are applied to all later PLOT statements.

The PAINT statement lists the observation numbers of the observations selected, the total number of observations selected, and the plotting symbol used to paint the points.

On a plot, paint symbols take precedence over all other symbols. If any position contains more than one painted point, the paint symbol for the observation plotted last is used.

The PAINT statement cannot be used when a TYPE=CORR, TYPE=COV, or TYPE=SSCP data set is used as the input data set for PROC REG. Also, the PAINT statement cannot be used for models with more than one dependent variable. Note that the syntax for the PAINT statement is the same as the syntax for the REWEIGHT statement.

For detailed examples of painting scatter plots, see the section Painting Scatter Plots on page 3889.

Specifying Condition

Condition is used to select observations to be painted. The syntax of condition is

  • variable compare value

or

  • variable compare value logical variable compare value

where

variable

is one of the following:

 
  • a variable name in the input data set

  • OBS . , which is the observation number

  • keyword . , where keyword is a keyword for a statistic requested in the OUTPUT statement

compare

is an operator that compares variable to value . Compare can be any one of the following: <, <=, >, >=, =, ^ =. The operators LT, LE, GT, GE, EQ, and NE can be used instead of the preceding symbols. Refer to the Expressions section in SAS Language Reference: Concepts for more information on comparison operators.

value

gives an unformatted value of variable . Observations are selected to be painted if they satisfy the condition created by variable compare value . Value can be a number or a character string. If value is a character string, it must be eight characters or less and must be enclosed in quotes. In addition, value is case-sensitive. In other words, the statements

 
  paint name='henry';  
 

and

 
  paint name='henry';  
 

are not the same.

logical

is one of two logical operators. Either AND or OR can be used. To specify AND, use AND or the symbol &. To specify OR, use OR or the symbol .

Examples of the variable compare value form are

  paint name='Henry';   paint residual.>=20;   paint obs.=99;  

Examples of the variable compare value logical variable compare value form are

  paint name='Henry'name='Mary';   paint residual.>=20 or residual.<=10;   paint obs.>=11 and residual.<=20;  

Using ALLOBS

Instead of specifying condition , the ALLOBS option can be used to select all observations. This is most useful when you want to unpaint all observations. For example,

  paint allobs / reset;  

resets the symbols for all observations.

Options in the PAINT Statement

The following options can be used when either a condition is specified, the ALLOBS option is specified, or when nothing is specified before the slash. If only an option is listed, the option applies to the observations selected in the previous PAINT statement, not to the observations selected by reapplying the condition from the previous PAINT statement. For example, in the statements

  paint r.>0 / symbol='a';   reweight r.>0;   refit;   paint / symbol='b';  

the second PAINT statement paints only those observations selected in the first PAINT statement. No additional observations are painted even if, after refitting the model, there are new observations that meet the condition in the first PAINT statement.

Note: Options are not available when either the UNDO or STATUS option is used.

You can specify the following options after a slash (/).

NOLIST

  • suppresses the display of the selected observation numbers. If the NOLIST option is not specified, a list of observations selected is written to the log. The list includes the observation numbers and painting symbol used to paint the points. The total number of observations selected to be painted is also shown.

RESET

  • changes the painting symbol to the current default symbol, effectively unpainting the observations selected. If you set the default symbol by using the SYMBOL= option in the PLOT statement, the RESET option in the PAINT statement changes the painting symbol to the symbol you specified. Otherwise, the default symbol of 1 is used.

SYMBOL = character

  • specifies a painting symbol. If the SYMBOL= option is omitted, the painting symbol is either the one used in the most recent PAINT statement or, if there are no previous PAINT statements, the symbol @ . For example,

      paint / symbol='#';  
  • changes the painting symbol for the observations selected by the most recent PAINT statement to # . As another example,

      paint temp lt 22 / symbol='c';  
  • changes the painting symbol to c for all observations with TEMP < 22. In general, the numbers 1, 2, ... , 9 and the asterisk are not recommended as painting symbols. These symbols are used as default symbols in the PLOT statement, where they represent the number of replicates at a point. If SYMBOL= is used, no painting is done in the current plot. If SYMBOL= is used, observations are painted with a blank and are no longer seen on the plot.

STATUS and UNDO

Instead of specifying condition or the ALLOBS option, you can use the STATUS or UNDO option as follows:

STATUS

  • lists (on the log) the observation number and plotting symbol of all currently painted observations.

UNDO

  • undoes changes made by the most recent PAINT statement. Observations may be, but are not necessarily, unpainted. For example,

      paint obs. <=10 / symbol='a';    ...other interactive statements    paint obs.=1 / symbol='b';    ...other interactive statements    paint undo;  
  • The last PAINT statement changes the plotting symbol used for observation 1 back to a . If the statement

      paint / reset;  
  • is used instead, observation 1 is unpainted.

PLOT Statement

  • PLOT < yvariable * xvariable >< =symbol > <... yvariable * xvariable >< =symbol >< / options > ;

The PLOT statement in PROC REG displays scatter plots with yvariable on the vertical axis and xvariable on the horizontal axis. Line printer plots are generated if the LINEPRINTER option is specified in the PROC REG statement; otherwise, the traditional high-resolution graphics plots are created. Points in line printer plots can be marked with symbols , while global graphics statements such as GOPTIONS and SYMBOL are used to enhance the high-resolution graphics plots. Note that the plots you request using the PLOT statement are independent of the experimental ODS graphics (see the ODS Graphics section on page 3922) that are now available in PROC REG.

As with most other interactive statements, the PLOT statement implicitly refits the model. For example, if a PLOT statement is preceded by a REWEIGHT statement, the model is recomputed, and the plot reflects the new model.

If there are multiple MODEL statements preceding a PLOT statement, then the PLOT statement refers to the latest MODEL statement.

The PLOT statement cannot be used when TYPE=CORR, TYPE=COV, or TYPE=SSCP data sets are used as input to PROC REG.

You can specify several PLOT statements for each MODEL statement, and you can specify more than one plot in each PLOT statement. For detailed examples of using the PLOT statement and its options, see the section Producing Scatter Plots on page 3882.

Specifying Yvariables, Xvariables, and Symbol

More than one yvariable * xvariable pair can be specified to request multiple plots. The yvariables and xvariables can be

  • any variables specified in the VAR or MODEL statement before the first RUN statement

  • keyword . , where keyword is a regression diagnostic statistic available in the OUTPUT statement (see Table 61.4 on page 3842). For example,

      plot predicted.*residual.;  
    generates one plot of the predicted values by the residuals for each dependent variable in the MODEL statement. These statistics can also be plotted against any of the variables in the VAR or MODEL statements.
    Table 61.4: Keywords for PLOT Statement xvariables and yvariables

    Keyword

    Description

    Diagnostic Statistics

    COOKD.

    Cook s D influence statistics

    COVRATIO.

    standard influence of observation on covariance of betas

    DFFITS.

    standard influence of observation on predicted value

    H.

    leverage

    LCL.

    lower bound of 100(1 ˆ’ ± )% confidence interval for individual prediction

    LCLM.

    lower bound of 100(1 ˆ’ ± )% confidence interval for the mean of the dependent variable

    PREDICTED. PRED. P.

    predicted values

    PRESS.

    residuals from refitting the model with current observation deleted

    RESIDUAL. R.

    residuals

    RSTUDENT.

    studentized residuals with the current observation deleted

    STDI.

    standard error of the individual predicted value

    STDP.

    standard error of the mean predicted value

    STDR.

    standard error of the residual

    STUDENT.

    residuals divided by their standard errors

    UCL.

    upper bound of 100(1 ˆ’ ± )% confidence interval for individual prediction

    UCLM.

    upper bound of 100(1 ˆ’ ± )% confidence interval for the mean of the dependent variables

    Other Keywords Used with Diagnostic Statistics

    NPP.

    normal probability-probability plot

    NQQ.

    normal quantile-quantile plot

    OBS.

    observation number (cannot plot against OUTEST= statistics)

    Model Fit Summary Statistics

    ADJRSQ.

    adjusted R-square

    AIC.

    Akaike s information criterion

    BIC.

    Sawa s Bayesian information criterion

    CP.

    Mallows C p statistic

    EDF.

    error degrees of freedom

    GMSEP.

    estimated MSE of prediction, assuming multivariate normality

    IN.

    number of regressors in the model not including the intercept

    JP.

    final prediction error

    MSE.

    mean squared error

    NP.

    number of parameters in the model (including the intercept)

    PC.

    Amemiya s prediction criterion

    RMSE.

    root MSE

    RSQ.

    R-square

    SBC.

    SBC statistic

    SP.

    SP statistic

    SSE.

    error sum of squares

  • the keyword OBS. (the observation number), which can be plotted against any of the preceding variables

  • the keyword NPP. or NQQ., which can be used with any of the preceding variables to construct normal P-P or Q-Q plots, respectively (see the section Construction of Q-Q and P-P Plots on page 3917 and Example 61.8 on page 3953 for more information)

  • keywords for model fit summary statistics available in the OUTEST= data set with _TYPE_ = PARMS (see Table 61.4 on page 3842). A SELECTION= method (other than NONE) must be requested in the MODEL statement for these variables to be plotted. If one member of a yvariable * xvariable pair is from the OUTEST= data set, the other member must also be from the OUTEST= data set.

The OUTPUT statement and the OUTEST= option are not required when their keywords are specified in the PLOT statement.

The yvariable and xvariable specifications can be replaced by a set of variables and statistics enclosed in parentheses. When this occurs, all possible combinations of yvariable and xvariable are generated. For example, the following two statements are equivalent.

  plot (y1 y2)*(x1 x2);   plot y1*x1 y1*x2 y2*x1 y2*x2;  

The statement

  plot;  

is equivalent to respecifying the most recent PLOT statement without any options. However, the line printer options COLLECT, HPLOTS=, SYMBOL=, and VPLOTS=, described in the Line Printer Plots section on page 3848, apply across PLOT statements and remain in effect if they have been previously specified.

Options used for the traditional high-resolution graphics plots are described in the following section; see for more information.

Traditional High-Resolution Graphics Plots

The display of high-resolution graphics plots is described in the following paragraphs, the options are summarized in Table 61.4 and described in the section Dictionary of PLOT Statement Options on page 3844, and the Examples section on page 3924 contains several examples of the graphics output.

Several line printer statements and options are not supported for high-resolution graphics. In particular the PAINT statement is disabled, as are the PLOT statement options CLEAR, COLLECT, HPLOTS=, NOCOLLECT, SYMBOL=, and VPLOTS=. To display more than one plot per page or to collect plots from multiple PLOT statements, use the PROC GREPLAY statement (refer to SAS/GRAPH Software: Reference ). Also note that high-resolution graphics options are not recognized for line printer plots.

The fitted model equation and a label are displayed in the top margin of the plot; this display can be suppressed with the NOMODEL option. If the label is requested but cannot fit on one line, it is not displayed. The equation and label are displayed on one line when possible; if more lines are required, the label is displayed in the first line with the model equation in successive lines. If displaying the entire equation causes the plot to be unacceptably small, the equation is truncated. Table 61.5 on page 3843 lists options to control the display of the equation. The Examples section on page 3924 illustrates the display of the model equation.

Table 61.5: High-Resolution Graphics Options

Option

Description

General Graphics Options

ANNOTATE= SAS-data-set

specifies the annotate data set

CHOCKING= color

requests a reference line for C p model selection criteria

CMALLOWS= color

requests a reference line for the C p model selection criterion

CONF

requests plots of 100(1 ˆ’ ± )% confidence intervals for the mean

DESCRIPTION= string

specifies a description for graphics catalog member

NAME= string

names the plot in graphics catalog

OVERLAY

overlays plots from the same model

PRED

requests plots of 100(1 ˆ’ ± )% prediction intervals for individual responses

RIDGEPLOT

requests the ridge trace for ridge regression

Axis and Legend Options

LEGEND= LEGENDn

specifies LEGEND statement to be used

HAXIS= values

specifies tick mark values for horizontal axis

VAXIS= values

specifies tick mark values for vertical axis

Reference Line Options

HREF= values

specifies reference lines perpendicular to horizontal axis

LHREF= linetype

specifies line style for HREF= lines

LLINE= linetype

specifies line style for lines displayed by default

LVREF= linetype

specifies line style for VREF= lines

NOLINE

suppresses display of any default reference line

VREF= values

specifies reference lines perpendicular to vertical axis

Color Options

CAXIS= color

specifies color for axis line and tick marks

CFRAME= color

specifies color for frame

CHREF= color

specifies color for HREF= lines

CLINE= color

specifies color for lines displayed by default

CTEXT= color

specifies color for text

CVREF= color

specifies color for VREF= lines

Options for Displaying the Fitted Model Equation

MODELFONT= font

specifies font of model equation and model label

MODELHT= value

specifies text height of model equation and model label

MODELLAB= label

specifies model label

NOMODEL

suppresses display of the fitted model and the label

Options for Displaying Statistics in the Plot Margin

AIC

displays Akaike s information criterion

BIC

displays Sawa s Bayesian information criterion

CP

displays Mallows C p statistic

EDF

displays the error degrees of freedom

GMSEP

displays the estimated MSE of prediction assuming multivariate normality

IN

displays the number of regressors in the model not including the intercept

JP

displays the J p statistic

MSE

displays the mean squared error

NOSTAT

suppresses display of the default statistics: the number of observations, R-square, adjusted R-square, and the root mean square error

NP

displays the number of parameters in the model including the intercept, if any

PC

displays the PC statistic

SBC

displays the SBC statistic

SP

displays the S(p) statistic

SSE

displays the error sum of squares

STATFONT= font

specifies font of text displayed in the margin

STATHT= value

specifies height of text displayed in the margin

Four statistics are displayed by default in the right margin: the number of observations, R 2 , the adjusted R 2 , and the root mean square error. (See Output 61.4.1 on page 3949.) The display of these statistics can be suppressed with the NOSTAT option. You can specify other options to request the display of various statistics in the right margin; see Table 61.5 on page 3843.

A default reference line at zero is displayed if residuals are plotted; see Output 61.7.1 on page 3952. If the dependent variable is plotted against the independent variable in a simple linear regression model, the fitted regression line is displayed by default. (See Output 61.4.1 on page 3949.) Default reference lines can be suppressed with the NOLINE option; the lines are not displayed if the OVERLAY option is specified.

Specialized plots are requested with special options. For each coefficient, the RIDGEPLOT option plots the ridge estimates against the ridge values k ; see the description of the RIDGEPLOT option in the section Dictionary of PLOT Statement Options beginning on page 3844 and Example 61.10 on page 3956 for more details. The CONF option plots 100(1 ˆ’ ± )% confidence intervals for the mean while the PRED option plots 100(1 ˆ’ ± )% prediction intervals; see the description of these options in the section Dictionary of PLOT Statement Options beginning on page 3844 and in Example 61.9 on page 3955 for more details.

If a SELECTION= method is requested, the fitted model equation and the statistics displayed in the margin correspond to the selected model. For the ADJRSQ and CP methods, the selected model is treated as a submodel of the full model. If a CP.*NP. plot is requested, the CHOCKING= and CMALLOWS= options display model selection reference lines; see the descriptions of these options in the section Dictionary of PLOT Statement Options beginning on page 3844 and Example 61.5 on page 3949 for more details.

PLOT Statement variable Keywords

The following table lists the keywords available as PLOT statement xvariables and yvariables . All keywords have a trailing dot; for example, COOKD . requests Cook s D statistic. Neither the OUTPUT statement nor the OUTEST= option needs to be specified.

Summary of PLOT Statement Graphics Options

The following table lists the PLOT statement options by function. These options are available unless the LINEPRINTER option is specified in the PROC REG statement. For complete descriptions, see the section Dictionary of PLOT Statement Options beginning on page 3844.

Dictionary of PLOT Statement Options

The following entries describe the PLOT statement options in detail. Note that these options are available unless you specify the LINEPRINTER option in the PROC REG statement.

AIC

  • displays Akaike s information criterion in the plot margin.

ANNOTATE= SAS-data-set

ANNO= SAS-data-set

  • specifies an input data set that contains appropriate variables for annotation. This applies only to displays created with the current PLOT statement. Refer to SAS/GRAPH Software: Reference for more information.

BIC

  • displays Sawa s Bayesian information criterion in the plot margin.

CAXIS= color

CAXES= color

CA= color

  • specifies the color for the axes, frame, and tick marks.

CFRAME= color

CFR= color

  • specifies the color for filling the area enclosed by the axes and the frame.

CHOCKING= color

  • requests reference lines corresponding to the equations C p = p and C p = 2 p ˆ’ p full , where p full is the number of parameters in the full model (excluding the intercept) and p is the number of parameters in the subset model (including the intercept). The color must be specified; the C p = p line is solid and the C p = 2 p ˆ’ p full line is dashed. Only PLOT statements of the form PLOT CP.*NP. produce these lines.

  • For the purpose of parameter estimation, Hocking (1976) suggests selecting a model where C p 2 p ˆ’ p full . For the purpose of prediction, Hocking suggests the criterion C p p . You can request the single reference line C p = p with the CMALLOWS= option. If, for example, you specify both CHOCKING=RED and CMALLOWS=BLUE, then the C p = 2 p ˆ’ p full line is red and the C p = p line is blue (see Example 61.5 on page 3949).

CHREF= color

CH= color

  • specifies the color for lines requested with the HREF= option.

CLINE= color

CL= color

  • specifies the color for lines displayed by default. See the NOLINE option later in this section for details.

CMALLOWS= color

  • requests a C p = p reference line, where p is the number of parameters (including the intercept) in the subset model. The color must be specified; the line is solid. Only PLOT statements of the form PLOT CP.*NP. produce this line.

  • Mallows (1973) suggests that all subset models with C p small and near p be considered for further study. See the CHOCKING= option for related model selection criteria.

CONF

  • is a keyword used as a shorthand option to request plots that include (100 ˆ’ ± )% confidence intervals for the mean response (see Example 61.9 on page 3955). The ALPHA= option in the PROC REG or MODEL statement selects the significance level ± , which is 0.05 by default. The CONF option is valid for simple regression models only, and is ignored for plots where confidence intervals are inappropriate. The CONF option replaces the CONF95 option; however, the CONF95 option is still supported when the ALPHA= option is not specified. The OVERLAY option is ignored when the CONF option is specified.

CP

  • displays Mallows C p statistic in the plot margin.

CTEXT= color

CT= color

  • specifies the color for text including tick mark labels, axis labels, the fitted model label and equation, the statistics displayed in the margin, and legends. (See Example 61.6 on page 3950.)

CVREF= color

CV= color

  • specifies the color for lines requested with the VREF= option.

DESCRIPTION= string

DESC= string

  • specifies a descriptive string, up to 40 characters, that appears in the description field of the PROC GREPLAY master menu.

EDF

  • displays the error degrees of freedom in the plot margin.

GMSEP

  • displays the estimated mean square error of prediction in the plot margin. Note that the estimate is calculated under the assumption that both independent and dependent variables have a multivariate normal distribution.

HAXIS= values

HA= values

  • specifies tick mark values for the horizontal axis.

HREF= values

  • specifies where reference lines perpendicular to the horizontal axis are to appear.

IN

  • displays the number of regressors in the model (not including the intercept) in the plot margin.

JP

  • displays the J p statistic in the plot margin.

LEGEND=LEGEND n

  • specifies the LEGEND n statement to be used. The LEGEND n statement is a global graphics statement; refer to SAS/GRAPH Software: Reference for more information.

LHREF= linetype

LH= linetype

  • specifies the line style for lines requested with the HREF= option. The default linetype is 2. Note that LHREF=1 requests a solid line. Refer to SAS/GRAPH Software: Reference for a table of available line types.

LLINE= linetype

LL= linetype

  • specifies the line style for reference lines displayed by default; see the NOLINE option for details. The default linetype is 2. Note that LLINE=1 requests a solid line.

LVREF= linetype

LV= linetype

  • specifies the line style for lines requested with the VREF= option. The default linetype is 2. Note that LVREF=1 requests a solid line.

MODELFONT= font

  • specifies the font used for displaying the fitted model label and the fitted model equa-tion. Refer to SAS/GRAPH Software: Reference for tables of software fonts.

MODELHT= height

  • specifies the text height for the fitted model label and the fitted model equation.

MODELLAB= label

  • specifies the label to be displayed with the fitted model equation. By default, no label is displayed. If the label does not fit on one line, it is not displayed. See the explanation in the section Traditional High-Resolution Graphics Plots beginning on page 3840 for more information.

MSE

  • displays the mean squared error in the plot margin.

NAME= string

  • specifies a descriptive string, up to eight characters, that appears in the name field of the PROC GREPLAY master menu. The default string is REG.

NOLINE

  • suppresses the display of default reference lines. A default reference line at zero is displayed if residuals are plotted. If the dependent variable is plotted against the independent variable in a simple regression model, then the fitted regression line is displayed by default. Default reference lines are not displayed if the OVERLAY option is specified.

NOMODEL

  • suppresses the display of the fitted model equation.

NOSTAT

  • suppresses the display of statistics in the plot margin. By default, the number of observations, R-square, adjusted R-square, and the root MSE are displayed.

NP

  • displays the number of regressors in the model including the intercept, if any, in the plot margin.

OVERLAY

  • overlays all plots specified in the PLOT statement from the same model on one set of axes. The variables for the first plot label the axes. The procedure automatically scales the axes to fit all of the variables unless the HAXIS= or VAXIS= option is used. Default reference lines are not displayed. A default legend is produced; the LEGEND= option can be used to customize the legend. See Example 61.11 on page 3958.

PC

  • displays the PC statistic in the plot margin.

PRED

  • is a keyword used as a shorthand option to request plots that include (100 ˆ’ ± )% prediction intervals for individual responses (see Example 61.9 on page 3955). The ALPHA= option in the PROC REG or MODEL statement selects the significance level ± , which is 0.05 by default. The PRED option is valid for simple regression models only, and is ignored for plots where prediction intervals are inappropriate. The PRED option replaces the PRED95 option; however, the PRED95 option is still supported when the ALPHA= option is not specified. The OVERLAY option is ignored when the PRED option is specified.

RIDGEPLOT

  • creates overlaid plots of ridge estimates against ridge values for each coefficient. The points corresponding to the estimates of each coefficient in the plot are connected by lines. For ridge estimates to be computed and plotted, the OUTEST= option must be specified in the PROC REG statement, and the RIDGE= list must be specified in either the PROC REG or the MODEL statement. See Example 61.10 on page 3956.

SBC

  • displays the SBC statistic in the plot margin.

SP

  • displays the S p statistic in the plot margin.

SSE

  • displays the error sum of squares in the plot margin.

STATFONT= font

  • specifies the font used for displaying the statistics that appear in the plot margin. Refer to SAS/GRAPH Software: Reference for tables of software fonts.

STATHT= height

  • specifies the text height of the statistics that appear in the plot margin.

USEALL

  • specifies that predicted values at data points with missing dependent variable(s) are included on appropriate plots. By default, only points used in constructing the SSCP matrix appear on plots.

VAXIS= values

VA= values

  • specifies tick mark values for the vertical axis.

VREF= values

  • specifies where reference lines perpendicular to the vertical axis are to appear.

Line Printer Plots

  • Line printer plots are requested with the LINEPRINTER option in the PROC REG statement. Points in line printer plots can be marked with symbols , which can be specified as a single character enclosed in quotes or the name of any variable in the input data set.

  • If a character variable is used for the symbol, the first (left-most) nonblank character in the formatted value of the variable is used as the plotting symbol. If a character in quotes is specified, that character becomes the plotting symbol. If a character is used as the plotting symbol, and if there are different plotting symbols needed at the same point, the symbol ? is used at that point.

  • If an unformatted numeric variable is used for the symbol, the symbols 1 , 2 , ... , 9 are used for variable values 1, 2, ... , 9. For noninteger values, only the integer portion is used as the plotting symbol. For values of 10 or greater, the symbol * is used. For negative values, a ? is used. If a numeric variable is used, and if there is more than one plotting symbol needed at the same point, the sum of the variable values is used at that point. If the sum exceeds 9, the symbol * is used.

  • If a symbol is not specified, the number of replicates at the point is displayed. The symbol * is used if there are ten or more replicates.

  • If the LINEPRINTER option is used, you can specify the following options in the PLOT statement after a slash (/):

CLEAR

  • clears any collected scatter plots before plotting begins but does not turn off the COLLECT option. Use this option when you want to begin a new collection with the plots in the current PLOT statement. For more information on collecting plots, see the COLLECT and NOCOLLECT options in this section.

COLLECT

  • specifies that plots begin to be collected from one PLOT statement to the next and that subsequent plots show an overlay of all collected plots. This option enables you to overlay plots before and after changes to the model or to the data used to fit the model. Plots collected before changes are unaffected by the changes and can be overlaid on later plots. You can request more than one plot with this option, and you do not need to request the same number of plots in subsequent PLOT statements. If you specify an unequal number of plots, plots in corresponding positions are overlaid. For example, the statements

      plot residual.*predicted. y*x / collect;   run;  
  • produce two plots. If these statements are then followed by

      plot residual.*x;   run;  
  • two plots are again produced. The first plot shows residual against X values overlaid on residual against predicted values. The second plot is the same as that produced by the first PLOT statement.

  • Axes are scaled for the first plot or plots collected. The axes are not rescaled as more plots are collected.

  • Once specified, the COLLECT option remains in effect until the NOCOLLECT option is specified.

HPLOTS= number

  • sets the number of scatter plots that can be displayed across the page. The procedure begins with one plot per page. The value of the HPLOTS= option remains in effect until you change it in a later PLOT statement. See the VPLOTS= option for an example.

NOCOLLECT

  • specifies that the collection of scatter plots ends after adding the plots in the current PLOT statement. PROC REG starts with the NOCOLLECT option in effect. After you specify the NOCOLLECT option, any following PLOT statement produces a new plot that contains only the plots requested by that PLOT statement.

  • For more information, see the COLLECT option.

OVERLAY

  • allows requested scatter plots to be superimposed. The axes are scaled so that points on all plots are shown. If the HPLOTS= or VPLOTS= option is set to more than one, the overlaid plot occupies the first position on the page. The OVERLAY option is similar to the COLLECT option in that both options produce superimposed plots. However, OVERLAY superimposes only the plots in the associated PLOT statement; COLLECT superimposes plots across PLOT statements. The OVERLAY option can be used when the COLLECT option is in effect.

SYMBOL= character

  • changes the default plotting symbol used for all scatter plots produced in the current and in subsequent PLOT statements. Both SYMBOL= and SYMBOL= are allowed.

  • If the SYMBOL= option has not been specified, the default symbol is 1 for positions with one observation, 2 for positions with two observations, and so on. For positions with more than 9 observations, * is used. The SYMBOL= option (or a plotting symbol) is needed to avoid any confusion caused by this default convention. Specifying a particular symbol is especially important when either the OVERLAY or COLLECT option is being used.

  • If you specify the SYMBOL= option and use a number for character , that number is used for all points in the plot. For example, the statement

      plot y*x / symbol='1';  
  • produces a plot with the symbol 1 used for all points.

  • If you specify a plotting symbol and the SYMBOL= option, the plotting symbol overrides the SYMBOL= option. For example, in the statements

      plot y*x y*v='.' / symbol='*';  
  • the symbol used for the plot of Y against X is * , and a . is used for the plot of Y against V.

  • If a paint symbol is defined with a PAINT statement, the paint symbol takes precedence over both the SYMBOL= option and the default plotting symbol for the PLOT statement.

VPLOTS= number

  • sets the number of scatter plots that can be displayed down the page. The procedure begins with one plot per page. The value of the VPLOTS= option remains in effect until you change it in a later PLOT statement.

  • For example, to specify a total of six plots per page, with two rows of three plots, use the HPLOTS= and VPLOTS= options as follows:

      plot y1*x1 y1*x2 y1*x3 y2*x1 y2*x2 y2*x3 /   hplots=3 vplots=2;   run;  

PRINT Statement

  • PRINT < options >< ANOVA >< MODELDATA > ;

The PRINT statement enables you to interactively display the results of MODEL statement options, produce an ANOVA table, display the data for variables used in the current model, or redisplay the options specified in a MODEL or a previous PRINT statement. In addition, like most other interactive statements in PROC REG, the PRINT statement implicitly refits the model; thus, effects of REWEIGHT statements are seen in the resulting tables. If the experimental ODS graphics are in effect (see the ODS Graphics section on page 3922), the PRINT statement also requests the display of the ODS graphics associated with the current model.

The following specifications can appear in the PRINT statement:

options

interactively displays the results of MODEL statement options, where options is one or more of the following: ACOV, ALL, CLI, CLM, COLLIN, COLLINOINT, CORRB, COVB, DW, I, INFLUENCE, P, PARTIAL, PCORR1, PCORR2, R, SCORR1, SCORR2, SEQB, SPEC, SS1, SS2, STB, TOL, VIF, or XPX. See the MODEL Statement section on page 3821 for a description of these options.

ANOVA

produces the ANOVA table associated with the current model. This is either the model specified in the last MODEL statement or the model that incorporates changes made by ADD, DELETE or REWEIGHT statements after the last MODEL statement.

MODELDATA

displays the data for variables used in the current model.

Use the statement

  print;  

to reprint options in the most recently specified PRINT or MODEL statement.

Options that require original data values, such as R or INFLUENCE, cannot be used when a TYPE=CORR, TYPE=COV, or TYPE=SSCP data set is used as the input data set to PROC REG. See the Input Data Sets section on page 3860 for more detail.

REFIT Statement

  • REFIT;

The REFIT statement causes the current model and corresponding statistics to be recomputed immediately. No output is generated by this statement. The REFIT statement is needed after one or more REWEIGHT statements to cause them to take effect before subsequent PAINT or REWEIGHT statements. This is sometimes necessary when you are using statistical conditions in REWEIGHT statements. For example, with these statements

  paint student.>2;   plot student.*p.;   reweight student.>2;   refit;   paint student.>2;   plot student.*p.;  

the second PAINT statement paints any additional observations that meet the condition after deleting observations and refitting the model. The REFIT statement is used because the REWEIGHT statement does not cause the model to be recomputed. In this particular example, the same effect could be achieved by replacing the REFIT statement with a PLOT statement.

Most interactive statements can be used to implicitly refit the model; any plots or statistics produced by these statements reflect changes made to the model and changes made to the data used to compute the model. The two exceptions are the PAINT and REWEIGHT statements, which do not cause the model to be recomputed.

RESTRICT Statement

  • RESTRICT equation < , ... , equation > ;

A RESTRICT statement is used to place restrictions on the parameter estimates in the MODEL preceding it. More than one RESTRICT statement can follow each MODEL statement. Each RESTRICT statement replaces any previous RESTRICT statement. To lift all restrictions on a model, submit a new MODEL statement. If there are several restrictions, separate them with commas. The statement

  restrict equation1=equation2=equation3;  

is equivalent to imposing the two restrictions

  restrict equation1=equation2;   restrict equation2=equation3;  

Each restriction is written as a linear equation and can be written as

  • equation

or

  • equation = equation

The form of each equation is

click to expand

where the c j s are constants and the variable j s are any regressor variables.

When no equal sign appears, the linear combination is set equal to zero. Each variable name mentioned must be a variable in the MODEL statement to which the RESTRICT statement refers. The keyword INTERCEPT can also be used as a variable name, and it refers to the intercept parameter in the regression model.

Note that the parameters associated with the variables are restricted, not the variables themselves . Restrictions should be consistent and not redundant.

Examples of valid RESTRICT statements include the following:

  restrict x1;   restrict a+b=l;   restrict a=b=c;   restrict a=b, b=c;   restrict 2*f=g+h, intercept+f=0;   restrict f=g=h=intercept;  

The third and fourth statements in this list produce identical restrictions. You cannot specify

  restrict f-g=0,   f-intercept=0,   g-intercept=1;  

because the three restrictions are not consistent. If these restrictions are included in a RESTRICT statement, one of the restrict parameters is set to zero and has zero degrees of freedom, indicating that PROC REG is unable to apply a restriction.

The restrictions usually operate even if the model is not of full rank. Check to ensure that DF= ˆ’ 1 for each restriction. In addition, the Model DF should decrease by 1 for each restriction.

The parameter estimates are those that minimize the quadratic criterion (SSE) subject to the restrictions. If a restriction cannot be applied, its parameter value and degrees of freedom are listed as zero.

The method used for restricting the parameter estimates is to introduce a Lagrangian parameter for each restriction (Pringle and Raynor 1971). The estimates of these parameters are displayed with test statistics. Note that the t statistic reported for the Lagrangian parameters does not follow a Student s t distribution, but its square follows a beta distribution (LaMotte 1994). The p -value for these parameters is computed using the beta distribution.

The Lagrangian parameter ³ measures the sensitivity of the SSE to the restriction constant. If the restriction constant is changed by a small amount ˆˆ , the SSE is changed by 2 ³ ˆˆ . The t ratio tests the significance of the restrictions. If ³ is zero, the restricted estimates are the same as the unrestricted estimates, and a change in the restriction constant in either direction increases the SSE.

RESTRICT statements are ignored if the PCOMIT= or RIDGE= option is specified in the PROC REG statement.

REWEIGHT Statement

  • REWEIGHT < condition ALLOBS >< / options > ;

  • REWEIGHT < STATUS UNDO > ;

The REWEIGHT statement interactively changes the weights of observations that are used in computing the regression equation. The REWEIGHT statement can change observation weights, or set them to zero, which causes selected observations to be excluded from the analysis. When a REWEIGHT statement sets observation weights to zero, the observations are not deleted from the data set. More than one REWEIGHT statement can be used. The requests from all REWEIGHT statements are applied to the subsequent statements. Each use of the REWEIGHT statement modifies the MODEL label.

The model and corresponding statistics are not recomputed after a REWEIGHT statement. For example, with the following statements

  reweight r.>0;   reweight r.>0;  

the second REWEIGHT statement does not exclude any additional observations since the model is not recomputed after the first REWEIGHT statement. Use either a REFIT statement to explicitly refit the model, or implicitly refit the model by following the REWEIGHT statement with any other interactive statement except a PAINT statement or another REWEIGHT statement.

The REWEIGHT statement cannot be used if a TYPE=CORR, TYPE=COV, or TYPE=SSCP data set is used as an input data set to PROC REG. Note that the syntax used in the REWEIGHT statement is the same as the syntax in the PAINT statement.

The syntax of the REWEIGHT statement is described in the following sections. For detailed examples of using this statement see the section Reweighting Observations in an Analysis on page 3903.

Specifying Condition

Condition is used to find observations to be reweighted. The syntax of condition is

  • variable compare value

or

  • variable compare value logical variable compare value

where

variable

is one of the following:

  • a variable name in the input data set

  • OBS . which is the observation number

  • keyword . , where keyword is a keyword for a statistic requested in the OUTPUT statement. The keyword specification is applied to all dependent variables in the model.

compare

is an operator that compares variable to value . Compare can be any one of the following: <, <=, >, >=, =, ^ =. The operators LT, LE, GT, GE, EQ, and NE can be used instead of the preceding symbols. Refer to the Expressions chapter in SAS Language Reference: Concepts for more information on comparison operators.

value

gives an unformatted value of variable . Observations are selected to be reweighted if they satisfy the condition created by variable compare value . Value can be a number or a character string. If value is a character string, it must be eight characters or less and must be enclosed in quotes. In addition, value is case-sensitive. In other words, the following two statements are not the same:

 
  reweight name='steve';   reweight name='Steve';  

logical

is one of two logical operators. Either AND or OR can be used. To specify AND, use AND or the symbol &. To specify OR, use OR or the symbol .

Examples of the variable compare value form are

  reweight obs. le 10;   reweight temp=55;   reweight type='new';  

Examples of the variable compare value logical variable compare value form are

  reweight obs.<=10 and residual.<2;   reweight student.<-2 or student.>2;   reweight name='Mary'  name='Susan';  

Using ALLOBS

Instead of specifying condition , you can use the ALLOBS option to select all observations. This is most useful when you want to restore the original weights of all observations. For example,

  reweight allobs / reset;  

resets weights for all observations and uses all observations in the subsequent analysis. Note that

  reweight allobs;  

specifies that all observations be excluded from analysis. Consequently, using ALLOBS is useful only if you also use one of the options discussed in the following section.

Options in the REWEIGHT Statement

The following options can be used when either a condition, ALLOBS, or nothing is specified before the slash. If only an option is listed, the option applies to the observations selected in the previous REWEIGHT statement, not to the observations selected by reapplying the condition from the previous REWEIGHT statement. For example, with the statements

  reweight r.>0 / weight=0.1;   refit;   reweight;  

the second REWEIGHT statement excludes from the analysis only those observations selected in the first REWEIGHT statement. No additional observations are excluded even if there are new observations that meet the condition in the first REWEIGHT statement.

Note: Options are not available when either the UNDO or STATUS option is used.

NOLIST

  • suppresses the display of the selected observation numbers. If you omit the NOLIST option, a list of observations selected is written to the log.

RESET

  • resets the observation weights to their original values as defined by the WEIGHT statement or to WEIGHT=1 if no WEIGHT statement is specified. For example,

      reweight / reset;  
  • resets observation weights to the original weights in the data set. If previous REWEIGHT statements have been submitted, this REWEIGHT statement applies only to the observations selected by the previous REWEIGHT statement. Note that, although the RESET option does reset observation weights to their original values, it does not cause the model and corresponding statistics to be recomputed.

WEIGHT= value

  • changes observation weights to the specified nonnegative real number. If you omit the WEIGHT= option, the observation weights are set to zero, and observations are excluded from the analysis. For example,

      reweight name='Alan';    ...other interactive statements    reweight / weight=0.5;  
  • The first REWEIGHT statement changes weights to zero for all observations with name = Alan , effectively deleting these observations. The subsequent analysis does not include these observations. The second REWEIGHT statement applies only to those observations selected by the previous REWEIGHT statement, and it changes the weights to 0.5 for all the observations with NAME= Alan . Thus, the next analysis includes all original observations; however, those observations with NAME= Alan have their weights set to 0.5.

STATUS and UNDO

If you omit condition and the ALLOBS options, you can specify one of the following options.

STATUS

  • writes to the log the observation s number and the weight of all reweighted observations. If an observation s weight has been set to zero, it is reported as deleted. However, the observation is not deleted from the data set, only from the analysis.

UNDO

  • undoes the changes made by the most recent REWEIGHT statement. Weights may be, but are not necessarily, reset. For example, in these statements

      reweight student.>2 / weight=0.1;   reweight;   reweight undo;  
  • the first REWEIGHT statement sets the weights of observations that satisfy the condition to 0.1. The second REWEIGHT statement sets the weights of the same observations to zero. The third REWEIGHT statement undoes the second, changing the weights back to 0.1.

TEST Statement

  • < label: > TEST equation < , ... , equation > < / options > ;

The TEST statement tests hypotheses about the parameters estimated in the preceding MODEL statement. It has the same syntax as the RESTRICT statement except that it allows an option. Each equation specifies a linear hypothesis to be tested. The rows of the hypothesis are separated by commas.

Variable names must correspond to regressors, and each variable name represents the coefficient of the corresponding variable in the model. An optional label is useful to identify each test with a name. The keyword INTERCEPT can be used instead of a variable name to refer to the model s intercept.

The REG procedure performs an F test for the joint hypotheses specified in a single TEST statement. More than one TEST statement can accompany a MODEL statement. The numerator is the usual quadratic form of the estimates; the denominator is the mean squared error. If hypotheses can be represented by

then the numerator of the F test is

click to expand

divided by degrees of freedom, where b is the estimate of ² . For example,

  model y=a1 a2 b1 b2;   aplus: test a1+a2=1;   b1:    test b1=0, b2=0;   b2:    test b1, b2;  

The last two statements are equivalent; since no constant is specified, zero is assumed.

Note that, when the ACOV option is specified in the MODEL statement, tests are recomputed using the heteroscedasticity consistent covariance matrix (see the section Testing for Heteroscedasticity on page 3910).

One option can be specified in the TEST statement after a slash (/):

PRINT

  • displays intermediate calculations. This includes L ( X ² X ) ˆ’ L ² bordered by Lb ˆ’ c , and ( L ( X ² X ) ˆ’ L ² ) ˆ’ 1 bordered by ( L ( X ² X ) ˆ’ L ² ) ˆ’ 1 ( Lb ˆ’ c ).

VAR Statement

  • VAR variables ;

The VAR statement is used to include numeric variables in the crossproducts matrix that are not specified in the first MODEL statement.

Variables not listed in MODEL statements before the first RUN statement must be listed in the VAR statement if you want the ability to add them interactively to the model with an ADD statement, to include them in a new MODEL statement, or to plot them in a scatter plot with the PLOT statement.

In addition, if you want to use options in the PROC REG statement and do not want to fit a model to the data (with a MODEL statement), you must use a VAR statement.

WEIGHT Statement

  • WEIGHT variable ;

A WEIGHT statement names a variable in the input data set with values that are relative weights for a weighted least-squares fit. If the weight value is proportional to the reciprocal of the variance for each observation, then the weighted estimates are the best linear unbiased estimates (BLUE).

Values of the weight variable must be nonnegative. If an observation s weight is zero, the observation is deleted from the analysis. If a weight is negative or missing, it is set to zero, and the observation is excluded from the analysis. A more complete description of the WEIGHT statement can be found in Chapter 32, The GLM Procedure.

Observation weights can be changed interactively with the REWEIGHT statement; see the section REWEIGHT Statement beginning on page 3854.




SAS.STAT 9.1 Users Guide (Vol. 6)
SAS.STAT 9.1 Users Guide (Vol. 6)
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 127

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net