Chapter 13 - STATISTICS FOR BUSINESS & ECONOMICS by Paul Newbold
```*****************************************************************************
* CHAPTER 13 - STATISTICS FOR BUSINESS & ECONOMICS, 4th Ed., by Paul Newbold*
*****************************************************************************
*
* Estimate the least squares regression on page 478.
*
* The SAMPLE command is used to specify the sample range of the data to be
* read.  The READ command inputs the data and assigns variable names.  In
* this case, the variables are Percentage Net Revenues per Deposit Dollar
* X1, Number of Offices, X2, and the Percentage Profit Margin for Savings
* and Loan Associations, Y.  The LIST option on the READ command lists all
*
SAMPLE 1 25
READ YEAR X1 X2 Y / LIST
1     3.92    7298    0.75
2     3.61    6855    0.71
3     3.32    6636    0.66
4     3.07    6506    0.61
5     3.06    6450    0.70
6     3.11    6402    0.72
7     3.21    6368    0.77
8     3.26    6340    0.74
9     3.42    6349    0.90
10     3.42    6352    0.82
11     3.45    6361    0.75
12     3.58    6369    0.77
13     3.66    6546    0.78
14     3.78    6672    0.84
15     3.82    6890    0.79
16     3.97    7115    0.70
17     4.07    7327    0.68
18     4.25    7546    0.72
19     4.41    7931    0.55
20     4.49    8097    0.63
21     4.70    8468    0.56
22     4.58    8717    0.41
23     4.69    8991    0.51
24     4.71    9179    0.47
25     4.78    9318    0.32
OLS Y X1 X2
*
*-----------------------------------------------------------------------------
* Table 13.2, page 490 is replicated with the OLS command.  The output from
* this regression is suppressed with the "?" command since this same
* regression was previous estimated in the above example.  The PREDICT= option
* on the OLS command saves the predicted values of the dependent variable and
* the RESID= option saves the residuals from the regression in a variable.
*
?OLS Y X1 X2 / PREDICT=YHAT RESID=E
*
* The sample mean of the dependent variable, Y, is saved with the MEAN=
* option on the STAT command.
*
STAT Y / MEAN=MEANY
*
* The GENR commands are used to generate Columns 4 and 5 in Table 13.2 on
* page 490.  The PRINT command replicates Table 13.2.
*
GENR YYBAR=Y-MEANY
GENR YHATYBAR=YHAT-MEANY
PRINT Y YHAT E YYBAR YHATYBAR
*
*-----------------------------------------------------------------------------
* Sum of Squares Decomposition and the Coefficient of Determination on page
* 491.
*
* The Coefficient of Determination, R-squared, is automatically printed in
* SHAZAM in the OLS command output.  When the ANOVA option is specified on
* the OLS command, the Total Sum of Squares (SST), Regression Sum of Squares
* (SSR), and Error Sum of Squares (SSE) are printed.  The ANOVA option prints
* the Analysis of Variance tables and the F-statistic for the test that all
* the coefficients are zero.
*
OLS Y X1 X2 / ANOVA
*
*-----------------------------------------------------------------------------
* Confidence Intervals on page 499.
*
* SHAZAM automatically calculates the 95% and 90% Confidence Intervals with
* CONFID command.  The 99% Confidence Interval for the coefficients is
* calculated by saving the regression coefficients with the COEF= option and
* the coefficient standard errors with the STDERR= option on the OLS command.
* SHAZAM output for a specific command can be suppressed by placing the "?"
* before the command.
*
?OLS Y X1 X2 / COEF=COEF STDERR=S
*
* The GENR command is then used to calculate the lower bound, LOWER and upper
* bound, UPPER for the 99% Confidence Interval.
*
GEN1 LOWER=COEF-2.819*S
GEN1 UPPER=COEF+2.819*S
*
* Three lower and upper bounds will be printed.  The first value is the bounds
* for X1, the second value is for X2 and the third is for the constant.
*
PRINT LOWER UPPER
*
*-----------------------------------------------------------------------------
* Hypothesis Testing on page 500 and 501.
*
* The Null Hypothesis is Net Revenues do not contribute to Profit Margins.
* The TEST command is used in SHAZAM to test this hypothesis immediately
* following the OLS command.
*
?OLS Y X1 X2
TEST X1=0
*
* The second Null Hypothesis is that an increase in the number of offices
* will lead on average to a decrease in profit margins of savings and loan
* associations.
*
TEST X2=0
*
*-----------------------------------------------------------------------------
* Example 13.1, page 501
*
* The GEN1 command is used to generate the constants for this example since
* the data used for the regression is not provided.  The confidence interval
* for the expected increase in the Effective Property Tax Rate when Government
* Revenue Share increases by 1 percentage point while the Number of Housing
* Units per Square Mile (X1) and Median per Capita Personal Income (X3) remain
* constant.
*
GEN1 B2=0.0183
GEN1 SB2=0.0082
*
* The 95% Confidence Interval is calculated with the GEN1 command.
*
GEN1 LOWER=B2-2.120*SB2
GEN1 UPPER=B2+2.120*SB2
PRINT LOWER UPPER
*
*-----------------------------------------------------------------------------
* Example 13.2, page 503
*
* The GEN1 command is used to generate the constants for this example since
* the data used for the regression is not provided.
*
GEN1 B3=-0.72
GEN1 SB3=0.353
GEN1 B4=0.023
GEN1 SB4=0.0185
*
* The Null Hypothesis is that the Relative Monthly Change in the Dow-Jones
* Industrial Average contributes nothing further towards explaining the
*
GEN1 T1=(B3-0)/SB3
PRINT T1
*
* The Null Hypothesis is that the Inclusion of the Volume of Shares Traded
* contributes nothing towards explaining variability in Tender Premiums.
*
GEN1 T2=(B4-0)/SB4
PRINT T2
*
*-----------------------------------------------------------------------------
* A Test On All The Parameters Of A Regression Model, page 506 and 507.
*
* The Null Hypothesis is that Net Revenue and the Number of Offices are equal
* to 0.  The F-statistic for the test that all coefficients are zero is
* printed when the ANOVA option is specified on the OLS command.
* Alternatively, the TEST command can be used following an OLS command to
* print the F-statistic.  In this example, more than one linear combination
* of coefficients is being tested so the TEST and END commands are used to
* indicate the beginning and end of the coefficients to be tested.
*
OLS Y X1 X2 / ANOVA
TEST
TEST X1=0
TEST X2=0
END
*
*-----------------------------------------------------------------------------
* Example 13.3, page 508
*
* The GEN1 command is used to generate the constants for this example since
* the data used for the regression is not provided.
*
GEN1 N=31
GEN1 K=4
GEN1 R2=0.72
*
* The Null Hypothesis is that Soliciting Fee per Share, Percentage of Shares
* Sought, Relative Monthly Change in the Dow-Jones Industrial Average, and
* the Volume of Shares Traded as a Percentage of Those Outstanding do not
* linearly affect the Tender Premiums.
*
* The GEN1 command is used to calculate the test statistic.
*
GEN1 T133=((N-K-1)/K)*(R2/(1-R2))
PRINT T133
*
*-----------------------------------------------------------------------------
* Example 13.4, page 510
*
* The GEN1 command is used to generate the constants for this example since
* the data used for the regression is not provided.
*
GEN1 N=20
GEN1 K1=2
GEN1 K=3
GEN1 SSESTAR=78.21
GEN1 SSE=66.73
*
* The Null Hypothesis is that the Percentage Change in Unemployment and
* Percentage Change in Number of Outlets contribute nothing further to
* explaining the variability in the Percentage Increase in Sales when
* the Percentage Change in Promotional Expenditures is used.
*
GEN1 T134=((SSESTAR-SSE)/K1)/(SSE/(N-K-1))
PRINT T134
*
*-----------------------------------------------------------------------------
* Prediction on page 511.
*
* The output from the OLS regression is suppressed with the "?" command.  The
* regression coefficients are saved in a vector called C with the COEF= option
* on the OLS command.  The coefficient for X1 is stored in Row 1, X2 is stored
* in Row 2 and the Constant is stored in Row 3 of vector C.  The corresponding
* SHAZAM command for these coefficients is C:1, C:2, and C:3.  The point
* predictor of profit margins can now be calculated with the GEN1 command.
*
?OLS Y X1 X2 / COEF=C
PRINT C:1 C:2 C:3
GEN1 NYHAT=C:3+(C:1*4.50)+(C:2*9000)
PRINT NYHAT
*
*-----------------------------------------------------------------------------
* Computer Packages For Regression Calculations on page 517.
*
* The MAX option on the OLS command prints Analysis of Variance Tables,
* Variance-covariance matrix, Correlation matrix, Residuals, Residual
* Statistics and Goodness of Fit, Test for Normality.  This is a sample of
* the standard statistics SHAZAM prints out when the option is specified.
*
OLS Y X1 X2 / MAX
*
DELETE / ALL
*
*-----------------------------------------------------------------------------
*
STOP
```