SUR Instruction |
SUR( options ) equations start end
# equation resids coeffs(one per equation)
SUR( options ) equations start end EQUATE list
# equation resids coeffs(one per equation)
SUR computes estimates of a system of linear equations using the technique of joint GLS, or three-stage least squares (for instrumental variables). SUR (Seemingly Unrelated Regressions) is a bit of a misnomer because this instruction includes options for cross-equation restrictions.
The instruction NLSYSTEM can be used for estimating systems of non-linear equations. Anything you can do with SUR, you can also do with NLSYSTEM, but if SUR is capable of handling the problem, it is usually easier to set up and quite a bit faster.
Parameters
equations |
Number of equations in the system you are estimating. This is ignored if you use the MODEL option—you can use * in its place if you need any of the remaining parameters. |
start, end |
Estimation range. If you have not set a SMPL, this defaults to the common defined range of all variables involved in the complete regression. |
list of coefficient positions |
(with EQUATE form only) list of coefficients (by position) restricted to be equal across equations |
Supplementary Cards
Use supplementary cards to list the equations you want to estimate. You can also provide series names to save the residuals and or coefficients for that equation. Omit the supplementary card if using the MODEL option. If you use supplementary cards to input the model, you can still use the RESIDS and COEFFS options to save the residuals or coefficients, rather than the resids and coeffs fields on the supplementary cards.
equation |
equation to estimate |
resids |
(optional) series to hold the estimated residuals |
coeffs |
(optional) series to hold the estimated coefficients |
Options
Standard Regression Options
Standard Robust Errors Options
MODEL=MODEL containing equations to estimate [unused]
You can use MODEL to estimate an existing MODEL of equations (defined by SYSTEM or GROUP). The MODEL cannot contain any formulas (FRMLs)—only linear equations. Omit the supplementary cards if you use this option.
RESIDS=VECTOR[SERIES] for the residuals [unused]
COEFFS=RECTANGULAR array of the coefficients [unused]
These allow you to save the estimated residuals and coefficients. Residuals are saved into a VECTOR of SERIES, with element i of the array
containing the residuals for equation i. Coefficients are saved into a RECTANGULAR array, with the coefficients for equation i stored in column i.
ITERATIONS=maximum number of iterations [0]
CVCRIT=convergence criterion value [0.0001]
TRACE/[NOTRACE]
If you give ITERATIONS a non-zero value, RATS will iterate on the estimation process until either it reaches the iteration limit or until the largest change in any coefficient value is less than the Convergence criterion. TRACE prints the intermediate results.
[SIGMA]/NOSIGMA
With SIGMA, the final estimate of the residual covariance/correlation matrix is displayed.
CV=Input Sigma matrix
CVOUT=Output Sigma matrix
CV allows you to feed in an initial covariance matrix (\(\Sigma\)) and CVOUT allows you to save the final estimate of the covariance matrix. For CVOUT, you don’t need to DECLARE or DIMENSION the array. The final \(\Sigma\) matrix is also stored automatically in the reserved variable %SIGMA.
When you use CV, the standard errors and covariance matrix of coefficients will be correct only if the CV matrix incorporates the residual variances. For instance, you can obtain two-stage least squares estimates of the coefficients of a system of equations using SUR(INST) with an CV of the identity matrix, but the covariance matrix will be incorrect.
Note: OUTSIGMA is an older synonym for CVOUT and ISIGMA is the older name for CV.
SPREAD=standard SPREAD option [unused]
WEIGHT=standard WEIGHT option[unused]
SHUFFLE=SERIES[INTEGER] with entry remapping[unused]
CMOM/[NOCMOM]
This pulls cross products out of the cross product matrix computed previously with a CMOMENT instruction. This can improve calculation time if the SUR is being executed many times with different CV matrices.
CREATE/[NOCREATE]
SETUP/[NOSETUP]
Use CREATE to print the output from the system if you recompute the coefficients and/or covariance matrix using an instruction other than SUR. This is the systems analogue of the CREATE option for LINREG. SETUP does no estimation: it sets up the %BETA and %XX arrays (described below) so that you can compute the coefficients and covariance matrix using matrix instructions. You can then use SUR(CREATE...) to get the output.
Print output with user-supplied coefficients (for example, after applying restrictions with RESTRICT(REPLACE)).
Instrumental Variables/3SLS Options
Standard Instrumental variables options
Variables Defined
Because SUR estimates a whole set of equations, most of the single equation fit statistics aren’t defined. The %BETA and similar matrices are defined for the "stacked" system.
%BETA |
VECTOR of coefficients (across equations) |
%XX |
covariance matrix of coefficients (SYMMETRIC) |
%TSTATS |
VECTOR containing the t-stats for the coefficients |
%STDERRS |
VECTOR of coefficient standard errors |
%NOBS |
number of observations (INTEGER) |
%NREG |
number of regressors (INTEGER) |
%NFREE |
number of free parameters, including covariance matrix (INTEGER) |
%LOGDET |
log determinant of the estimate of sigma (REAL) |
%LOGL |
log likelihood (if not INSTRUMENTS) (REAL) |
%SIGMA |
final estimate of the Sigma matrix (SYMMETRIC) |
%NVAR |
number of variables (INTEGER) |
Examples
equation geeq ige
# constant fge cge
equation westeq iwest
# constant fwest cwest
*
group grunfeld geeq westeq
sur(model=grunfeld)
This estimates a system of two equations by seemingly unrelated regressions. This is part of the SUR.RPF example.
instruments constant cons{1} ydiff{1} gnp{1} invest{1} $
govt mdiff rsum{1} rate{4}
equation consleq cons
# constant gnp cons{1}
equation investleq invest
# constant invest{1} ydiff{1} gnp rate{4}
equation rateleq rate
# constant gnp ydiff mdiff rsum{1}
*
group prmodel consleq investleq rateleq
sur(inst,model=prmodel,iterations=100) * 1950:1 1985:4
This estimates a system of three equations by three-stage-least-squares. The instrument list is on the first instruction. The INST option on SUR is used to indicate the use of instrumental variables. This is part of the SIMULEST.RPF example.
Sample Output
This is the output from the first example. This has the overall header, separate output for each of the equations, and the estimated covariance matrix of the residuals. (There are no R-squared measures because the equations aren't being estimated by least squares).
Linear Systems - Estimation by Seemingly Unrelated Regressions
Iterations Taken 2
Annual Data From 1935:01 To 1954:01
Usable Observations 20
Log Likelihood -158.3196
Dependent Variable IGE
Mean of Dependent Variable 102.29000000
Std Error of Dependent Variable 48.58449937
Standard Error of Estimate 26.25678563
Sum of Squared Residuals 13788.375833
Durbin-Watson Statistic 0.9856
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant -27.71931712 27.03282800 -1.02539 0.30517701
2. FGE 0.03831021 0.01329011 2.88261 0.00394396
3. CGE 0.13903627 0.02303559 6.03572 0.00000000
Dependent Variable IWEST
Mean of Dependent Variable 42.891500000
Std Error of Dependent Variable 19.110188596
Standard Error of Estimate 9.490260477
Sum of Squared Residuals 1801.3008785
Durbin-Watson Statistic 1.3647
Variable Coeff Std Error T-Stat Signif
************************************************************************************
4. Constant -1.251988228 6.956346688 -0.17998 0.85716997
5. FWEST 0.057629796 0.013411012 4.29720 0.00001730
6. CWEST 0.063978067 0.048900998 1.30832 0.19076540
Covariance\Correlation Matrix of Residuals
IGE IWEST
IGE 689.41879166 0.76504294
IWEST 190.63625609 90.06504392
This is the output from the second example. The header is different, showing the overidentification test if applicable. (The model has 27 total instruments, 9 for each of 3 equations, with 13 coefficients).
Linear Systems - Estimation by GMM-Factored Weight Matrix (3SLS)
Iterations Taken 22
Quarterly Data From 1950:01 To 1985:04
Usable Observations 144
J-Specification(14) 93.9316
Significance Level of J 0.0000000
Dependent Variable CONS
Mean of Dependent Variable 1411.1625000
Std Error of Dependent Variable 486.7321052
Standard Error of Estimate 11.3061876
Sum of Squared Residuals 18407.502479
Durbin-Watson Statistic 1.6369
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant -1.310491860 4.844085627 -0.27053 0.78674915
2. GNP 0.016637976 0.017537130 0.94873 0.34275867
3. CONS{1} 0.981868287 0.026195594 37.48219 0.00000000
Dependent Variable INVEST
Mean of Dependent Variable 383.83541667
Std Error of Dependent Variable 131.09401018
Standard Error of Estimate 16.69511094
Sum of Squared Residuals 40136.649012
Durbin-Watson Statistic 1.7262
Variable Coeff Std Error T-Stat Signif
************************************************************************************
4. Constant -26.77413347 6.03182828 -4.43881 0.00000905
5. INVEST{1} 0.62900972 0.04069816 15.45548 0.00000000
6. YDIFF{1} 0.10089273 0.04471907 2.25615 0.02406151
7. GNP 0.08441125 0.00937220 9.00655 0.00000000
8. RATE{4} -5.07290798 0.84845595 -5.97899 0.00000000
Dependent Variable RATE
Mean of Dependent Variable 5.1534027778
Std Error of Dependent Variable 3.2689143326
Standard Error of Estimate 1.0702067915
Sum of Squared Residuals 164.92933101
Durbin-Watson Statistic 1.2639
Variable Coeff Std Error T-Stat Signif
************************************************************************************
9. Constant -0.713970979 0.369638938 -1.93154 0.05341678
10. GNP 0.000999767 0.000289942 3.44817 0.00056440
11. YDIFF -0.013923727 0.005972398 -2.33135 0.01973513
12. MDIFF -0.061750286 0.015646163 -3.94667 0.00007924
13. RSUM{1} 0.379550592 0.031360902 12.10267 0.00000000
Covariance\Correlation Matrix of Residuals
CONS INVEST RATE
CONS 127.82987833 0.05492486 0.30609482
INVEST 10.36750929 278.72672925 0.62238985
RATE 3.70373467 11.12037713 1.14534258
Restriction Across Equations: SUR with EQUATE
Applicability
You should only use EQUATE on a system of equations with similar form:
•each equation should have the same number of explanatory variables.
•corresponding variables should be in the same positions in each equation.
For each position in list, SUR forces the coefficients in all equations at that position to be equal. For example, you would put a 2 in list to equate the 2nd coefficients in all equations.
Example
equation geeq ige
# constant fge cge
equation westeq iwest
# constant fwest cwest
group grunfeld geeq westeq
sur(model=grunfeld)
sur 2 / equate 2 3
# geeq
# westeq
This restricts the coefficient in position 2 of the first equation (the FGE coefficient) to be equal to the coefficient in position 2 of the second equation (the FWEST coefficient). It also restricts to be equal the coefficients in position 3: CGE and CWEST.
Output
The output for SUR with EQUATE is the same as for standard SUR with one exception: the covariance matrix of coefficients does not include duplicates of the equated coefficients. The equated coefficients are listed first, followed by the coefficients which are estimated separately. For the example above:
Covariance\Correlation Matrix of Coefficients
FWEST CWEST Constant Constant
FWEST 0.000065342 -0.0160284252 -0.8202103255 -0.8753618770
CWEST -0.000002975 0.000527399 -0.4716036803 -0.3051918796
Constant -0.125659410 -0.205267560 359.208892358 0.9500871042
Constant -0.043583788 -0.043170161 110.911878782 37.938678405
Restricted coefficients will take their labels from the last equation. The first CONSTANT is the intercept from equation 1, the second is from equation 2.
The variables %XX, %BETA, %STDERRS, %TSTATS and %NREG are all set up in this order as well. For instance, %NREG will just be four (the number of free coefficients) and %BETA will have four entries.
Copyright © 2025 Thomas A. Doan