Chapter 9 - STATISTICS FOR BUSINESS & ECONOMICS by Paul Newbold
```*****************************************************************************
* CHAPTER 9 - STATISTICS FOR BUSINESS & ECONOMICS, 4th Ed., by Paul Newbold *
*****************************************************************************
*
* Example 9.1, page 331
*
* A random sample of ball bearings is N, their mean weights is MEAN, and the
* standard deviation is SIGMA, and the Null Hypothesis is H0.
*
GEN1 N=16
GEN1 MEAN=5.038
GEN1 SIGMA=0.1
GEN1 H0=5
*
* The Null Hypothesis is that the population mean weight is equal to 5 ounces
* and the Alternative Hypothesis is that it is bigger than 5 ounces.
*
* First, test the Null Hypothesis at the 5% level.  From Table 3 in the
* Appendix, z.05=1.645
*
GEN1 Z05=1.645
*
* The GEN1 command is used to calculate the Decision Rule formula on page 331
* at the 5% level.
*
GEN1 DECISION=(MEAN-H0)/(SIGMA/SQRT(N))
PRINT DECISION
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.2, page 336
*
* The random sample of drilled hole measurements is N, the mean diameter is
* MEAN, standard deviation is SIGMA and the Null Hypothesis is H0.
*
GEN1 N=9
GEN1 MEAN=1.95
GEN1 SIGMA=0.06
GEN1 H0=2
*
* The Null Hypothesis, H0, is that the population mean is 2 inches and the
* Alternative Hypothesis that it is not.  At the 5% level of significance
* z0.025=1.96.
*
GEN1 DECISION=(MEAN-H0)/(SIGMA/SQRT(N))
PRINT DECISION
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.3, page 337
*
* The random sample of consumer responses is N, sample mean response is MEAN,
* the sample standard deviation is S, and the Null Hypothesis is H0.
*
GEN1 N=541
GEN1 MEAN=3.68
GEN1 S=1.21
GEN1 H0=3.75
*
* The Null Hypothesis, H0, is that the population mean is at least 3.75 and
* the Alternative is that it is less than 3.75.
*
GEN1 STAT=(MEAN-H0)/(S/SQRT(N))
PRINT STAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.4, page 340
*
* 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 sales figures for the random sample of six stores is assigned
* to the variable called SALES.  The LIST option on the READ command lists
*
SAMPLE 1 6
19.2
18.4
19.8
20.2
20.4
19.0
*
* The GENR command is used to generate a vector of SALES-squared.
*
GENR SALES2=SALES**2
*
* Print the Table on page 341 of X and X-squared.
*
PRINT SALES SALES2
*
* The STAT command is used to print the descriptive statistic about the
* variables SALES and SALES2.  The MEAN= option stores the means as a vector
* in the variable called MEAN.  The SUMS= option stores the sum of each
* variable as a vector in the variable called SUMS.
*
STAT SALES / MEAN=MEAN SUMS=SUM
STAT SALES2 / MEAN=MEAN2 SUMS=SUM2
*
* The sample mean is printed with the PRINT command.
*
PRINT MEAN
*
* The sample variance, S2, and sample standard deviation, S, is calculated
* with the GEN1 command.
*
GEN1 N=6
GEN1 S2=(SUM2-N*(MEAN**2))/(N-1)
GEN1 S=SQRT(S2)
PRINT S2 S
*
* The Null Hypothesis, H0, that the true mean percentage sales increase is
* 20, against the two-sided alternative at the 10% significance level is
* calculated with the GEN1 command.
*
GEN1 H0=20
GEN1 STAT=(MEAN-H0)/(S/SQRT(N))
PRINT STAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.5, page 346
*
* A random sample of consignments is N, the sample variance in impurity level
* percentage is S2, the Null Hypothesis, H0, that the population variance of
* impurity concentrations, SIGMA2, is no more than 4.
*
GEN1 N=20
GEN1 S2=5.62
GEN1 SIGMA2=4
*
* The test of significance at the 10% level is calculated with the GEN1
* command.
*
GEN1 STAT=((N-1)*S2)/SIGMA2
PRINT STAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.6, page 349
*
* A random sample of supermarket shoppers is N and the percentage of these
* shoppers that were able to state the correct price of an item immediately
* after putting it into the shopping cart is PX.  The Null Hypothesis, P0, is
* that at least one-half of all shoppers are able to state the correct price.
* The Alternative Hypothesis is that less than one-half is able to state the
* correct price.
*
GEN1 N=802
GEN1 PX=378/N
GEN1 P0=0.50
*
* The Null Hypothesis is tested at the 10% level of significance with the
* GEN1 command.
*
GEN1 STAT=(PX-P0)/SQRT((P0*(1-P0))/N)
PRINT STAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.7, page 356
*
* The survey of male accountants is NX, their mean responses is MEANX, and
* the sample standard deviation is SX.  An independent random sample of
* female accountants is NY, their mean responses is MEANY, and the sample
* standard deviation is SY.
*
GEN1 NX=186
GEN1 MEANX=4.059
GEN1 SX=0.839
GEN1 NY=172
GEN1 MEANY=3.680
GEN1 SY=0.966
*
* The Null Hypothesis is that the two population means are equal against
* the Alternative Hypothesis that the true mean is higher for male
* accountants.
*
GEN1 STAT=(MEANX-MEANY)/(SQRT((SX**2/NX)+(SY**2/NY)))
PRINT STAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.8, page 358
*
* A random sample of four groups with a moderator is NX, the sample mean is
* MEANX and the sample standard deviation is SX.  An independent random
* sample of four groups without a moderator is NY, this sample mean is MEANY
* and the sample standard deviatiion is SY.
*
GEN1 NX=4
GEN1 MEANX=78.0
GEN1 SX=24.4
GEN1 NY=4
GEN1 MEANY=63.5
GEN1 SY=20.2
*
* The common population variance, S2, is estimated using the GEN1 command and
* the common standard deviation, S, is the square root of the common
* population variance.
*
GEN1 S2=(((NX-1)*SX**2)+((NY-1)*SY**2))/(NX+NY-2)
GEN1 S=SQRT(S2)
*
* The Null Hypothesis is that the population means are equal against the
* alternative that the true mean is higher for groups with a moderator.
* The test statistic is calculated using the GEN1 command.
*
GEN1 STAT=(MEANX-MEANY)/(S*(SQRT((NX+NY)/(NX*NY))))
PRINT S2 S STAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.9, page 361
*
* ratio of these magazines that are humourous is PXHAT.  An independent
* these magazines that are humourous is PYHAT.
*
GEN1 NX=203
GEN1 PXHAT=52/NX
GEN1 NY=270
GEN1 PYHAT=56/NY
*
* The Null Hypothesis is that the proportion of all British and American
*
* First, the estimate of the common proportion under the Null Hypothesis,
* P0HAT, must be calculated with the GEN1 command.
*
GEN1 P0HAT=((NX*PXHAT)+(NY*PYHAT))/(NX+NY)
*
* Then P0HAT is used in the test statistic calculation.
*
GEN1 STAT=(PXHAT-PYHAT)/(SQRT(P0HAT*(1-P0HAT)*((NX+NY)/(NX*NY))))
PRINT P0HAT STAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 9.10, page 367
*
* A random sample of newly issued AAA-rated industrial bonds is NX and the
* variance of maturities is SX2.  An independent random sample of newly
* issued CCC-rated industrial bonds is NY and its variance of maturity is
* SY2.
*
GEN1 NX=17
GEN1 SX2=123.35
GEN1 NY=11
GEN1 SY2=8.02
*
* The Null Hypothesis tests that the population variances are equal.
*
GEN1 FSTAT=SX2/SY2
PRINT FSTAT
*
DELETE / ALL
*
*----------------------------------------------------------------------------
*
STOP
```