Chapter 7 - STATISTICS FOR BUSINESS & ECONOMICS by Paul Newbold
*****************************************************************************
* CHAPTER 7 - STATISTICS FOR BUSINESS & ECONOMICS, 4th Ed., by Paul Newbold *
*****************************************************************************
*
* Example 7.1, page 258
*
* The SAMPLE command is used to specify the sample range of the data to be
* read. Teh READ command inputs the data and assigns variable names. In
* this case, the observation number is assigned I and the price-earning ratio
* of ten stocks traded on the New York Stock Exchange on a particular day
* is assigned X. The LIST option on the READ command lists all data read.
*
SAMPLE 1 10
READ I X / LIST
1 10
2 16
3 5
4 10
5 12
6 8
7 4
8 6
9 5
10 4
*
* The table on page 259 of the data on I, X and X-squared can be printed
* using the PRINT command. Before the table can be printed out the vector
* X must be squared with the GENR command.
*
GENR X2=X**2
PRINT I X X2
*
* The random sample has 10 observations so the GEN1 command is used to
* generate this constant. The constant will be used in later calculations.
*
GEN1 N=10
*
* The sum of X and X-squared is first calculated and then sum of X can be
* used in calculating the Sample Mean of X using the GEN1 command.
*
GEN1 SUMX=SUM(X,10)
GEN1 SUMX2=SUM(X2,10)
GEN1 MEANX=SUMX/N
PRINT SUMX SUMX2 MEANX
*
* The population variance is calculated using the GEN1 command.
*
GEN1 VAR=(SUMX2-(N*MEANX**2))/(N-1)
PRINT VAR
*
* The population standard deviation is the square root of the variance and
* the GEN1 command is used to calculate it.
*
GEN1 STD=SQRT(VAR)
PRINT STD
*
* Alternatively, the STAT command automatically prints out the sample mean,
* variance, and standard deviation of the variable specified. The MEAN=
* option saves the mean of X in the constant SMEAN, the VAR= option saves
* the variance and STDEV= option saves the standard deviation. The PRINT
* command is used to print out the saved values.
*
STAT X / MEAN=SMEAN VAR=SVAR STDEV=SSTD
PRINT SMEAN SVAR SSTD
*
*----------------------------------------------------------------------------
* Example 7.2, page 261 and Example 7.3, page 262
*
* Read these examples carefully. Be sure you understand the methodology.
*
*----------------------------------------------------------------------------
STOP