Chapter 8 - STATISTICS FOR BUSINESS & ECONOMICS by Paul Newbold
*****************************************************************************
* CHAPTER 8 - STATISTICS FOR BUSINESS & ECONOMICS, 4th Ed., by Paul Newbold *
*****************************************************************************
*
* Example 8.1, page 274
*
* A random sample observation is defined as N, the standard deviation as
* SIGMA and the mean as MEAN.  The GEN1 command is used to generate these
* constants.
*
GEN1 MEAN=25
GEN1 SIGMA=6
GEN1 N=16
*
* The 90% Confidence Interval for the population mean is calculated with the
* GEN1 command.  The Lower Bound is defined as LOWER and the Upper Bound is
* defined as UPPER.
*
* Note:  From Table 3 of the Appendix, Fz(1.645)=0.95.
*
GEN1 LOWER=MEAN-((1.645*SIGMA)/SQRT(N))
GEN1 UPPER=MEAN+((1.645*SIGMA)/SQRT(N))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.2, page 278
*
* The random sample of bags of refined sugar is N, the mean is MEAN, and
* the standard deviaton is SIGMA.
*
GEN1 MEAN=19.8
GEN1 N=25
GEN1 SIGMA=1.2
*
* The 95% Confidence Interval for the true mean weight for all bags of sugar
* produced by the process is calculated with the GEN1 command.  The
* Lower Bound is defined as LOWER and the Upper Bound is defined as
* UPPER.
*
* Note:  From Table 3 of the Appendix, Fz(1.96)=0.975.
*
GEN1 LOWER=MEAN-((1.96*SIGMA)/SQRT(N))
GEN1 UPPER=MEAN+((1.96*SIGMA)/SQRT(N))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.3, page 281
*
* The random sample of accounting students is N, the mean is MEAN, and the
* standard devation is SIGMA.
*
GEN1 N=172
GEN1 MEAN=4.38
GEN1 SIGMA=0.70
*
* The 99% Confidence Interval for the population mean is calculated with
* the GEN1 command.  The Lower Bound is defined as LOWER and the Upper
* Bound is defined as UPPER.
*
* Note:  From Table 3 of the Appendix, Fz(2.575)=0.9950
*
GEN1 LOWER=MEAN-((2.575*SIGMA)/SQRT(N))
GEN1 UPPER=MEAN+((2.575*SIGMA)/SQRT(N))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.4, page 286
*
* The SAMPLE command is used to specify the sample range of data to be read.
* The READ command inputs the data and assigns variable names.  In this case,
* the observation is assigned the variable I and the car fuel consumption
* figures in miles per gallon is X.  The LIST option on the READ command
* lists all data read.
*
SAMPLE 1 6
READ I X / LIST
1  18.6
2  18.4
3  19.2
4  20.8
5  19.4
6  20.5
*
* To replicate the Table at the top of page 287, the GENR command is used
* to generate the X-squared.
*
GENR X2=X**2
PRINT I X X2
*
* The sample mean, variance and standard deviation of X is automatically
* calculated with the STAT command.  The MEAN=, VAR= and STDEV= options
* will store the mean, variance and standard deviation as a constant which
* can then be used in constructing the 90% Confidence Interval.
*
STAT X / MEAN=MEAN VAR=S2 STDEV=S
PRINT MEAN S2 S
*
* The 90% Confidence Interval for the population mean fuel consumption
* assuming the population distribution is normal is calculated with the
* GEN1 command.  The Lower Bound is defined as LOWER and the Upper Bound
* is defined as UPPER.
*
* From Table 6 of the Appendix, t=2.015 when n-1=5 and SIGMA/2=0.05.
*
GEN1 N=6
GEN1 LOWER=MEAN-((2.015*S)/SQRT(N))
GEN1 UPPER=MEAN+((2.015*S)/SQRT(N))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.5, page 288
*
* The random sample of merged carriers is N, the mean is MEAN and the
* standard deviation is S.
*
GEN1 N=17
GEN1 MEAN=0.105
GEN1 S=0.440
*
* The 95% Confidence Interval for the population mean with a normal population
* distribution is calculated with the GEN1 command.  The Lower Bound is
* defined as LOWER and the Upper Bound is defined as UPPER.
*
* From Table 6 of the Appendix, t=2.120 when n-1=16 and SIGMA/2=0.025.
*
GEN1 LOWER=MEAN-((2.120*S)/SQRT(N))
GEN1 UPPER=MEAN+((2.120*S)/SQRT(N))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.6, page 293
*
* The random sample of industrial buyers is N and the policy for each
* buyer to make his/her own decision or there was no policy on accepting
* gifts is defined as PHAT.
*
GEN1 N=344
GEN1 PHAT=83/N
*
* The 90% Confidence Interval for the population of all buyers who make
* their own decision on accepting gifts from suppliers is calculated with
* the GEN1 command.  The Lower Bound is defined as LOWER and the Upper
* Bound is defined as UPPER.
*
* From Table 3 of the Appendix, z(0.05)=1.645.
*
GEN1 LOWER=PHAT-1.645*(SQRT((PHAT*(1-PHAT))/N))
GEN1 UPPER=PHAT+1.645*(SQRT((PHAT*(1-PHAT))/N))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.7, page 294
*
* The random sample of company recruiters on college campuses is N and the
* grade consideration of a candidate that is "critical", "extremely
* important" or "very important" is defined as PHAT.
*
GEN1 N=142
GEN1 PHAT=87/N
*
* The 95% Confidence Interval for the proportion of company recruiters with
* this view is calculated with the GEN1 command.  The Lower Bound is defined
* as LOWER and the Upper Bound is defined as UPPER.
*
* From Table 3 of the Appendix, z(0.025)=1.96.
*
GEN1 LOWER=PHAT-1.96*(SQRT((PHAT*(1-PHAT))/N))
GEN1 UPPER=PHAT+1.96*(SQRT((PHAT*(1-PHAT))/N))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.8, page 298
*
* A random sample of pills for headaches relief is N and the standard
* deviation is S.  The variance (S2) is the standard deviation squared.
*
GEN1 N=15
GEN1 S=0.8
GEN1 S2=S**2
*
* The 90% Confidence Interval for the population variance for the headache
* pills is calculated with the GEN1 command.  The Lower Bound is defined
* as LOWER and the Upper Bound is defined as UPPER.
*
* From Table 5 of the Appendix, Chi-squared (14,0.05)=23.68 and
* Chi-squared (14, 0.95)=6.57.
*
GEN1 LOWER=((N-1)*S2/23.68)
GEN1 UPPER=((N-1)*S2/6.57)
PRINT LOWER UPPER
*
* Square-root of the LOWER and UPPER bounds must be calculated to determine
* the 90% Confidence Interval for the population standard deviation in the
* percentage concentration of the active ingredient in the pills.
*
GEN1 NEWLOW=SQRT(LOWER)
GEN1 NEWUP=SQRT(UPPER)
PRINT NEWLOW NEWUP
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.9, page 304
*
* The random sample of employees who are smokers is defined as SMOKE, the 
* mean amount of short-term absenteeism per month from work is SMEAN, and the
* standard deviation per month is SSTD.
*
GEN1 SMOKE=96
GEN1 SMEAN=2.15
GEN1 SSTD=2.09
*
* The independent random sample of employees who never smoked is NSMOKE, the
* mean amount of absenteeism per month from work is NSMEAN, and the standard
* deviation per month is NSSTD.
*
GEN1 NSMOKE=206
GEN1 NSMEAN=1.69
GEN1 NSSTD=1.91
*
* The 99% Confidence Interval for the differenc between the two population
* means is calculated with the GEN1 command.  The Lower Bound is defined
* as LOWER and the Upper Bound is defined as UPPER.
*
GEN1 LOWER=(SMEAN-NSMEAN)-2.575*(SQRT(((SSTD**2)/SMOKE)+((NSSTD**2)/NSMOKE)))
GEN1 UPPER=(SMEAN-NSMEAN)+2.575*(SQRT(((SSTD**2)/SMOKE)+((NSSTD**2)/NSMOKE)))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.10, page 305
*
* The random sample of professors is PROF, the mean rating is PMEAN, and
* the standard deviation is PSTD.
*
GEN1 PROF=321
GEN1 PMEAN=3.01
GEN1 PSTD=1.09
*
* The independent random sample of chief executive officers is CEO, the
* mean rating is CMEAN, and the standard deviation per month is CSTD.
*
GEN1 CEO=94
GEN1 CMEAN=2.88
GEN1 CSTD=1.01
*
* The 95% Confidence Interval for the difference between the two population
* means is calculated with the GEN1 command.  The Lower Bound is defined as
* LOWER and the Upper Bound is defined as UPPER.
*
GEN1 LOWER=(PMEAN-CMEAN)-1.96*(SQRT(((PSTD**2)/PROF)+((CSTD**2)/CEO)))
GEN1 UPPER=(PMEAN-CMEAN)+1.96*(SQRT(((PSTD**2)/PROF)+((CSTD**2)/CEO)))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.11, page 308
*
* The random sample of Partial Formal Planners is PFP, the mean annual
* percentage increase in net income is PFPMEAN, and the standard deviation
* is PFPSTD.
*
GEN1 PFP=6
GEN1 PFPMEAN=9.972
GEN1 PFPSTD=7.470
*
* The independent random sample of banks with no formal planning system is
* NFP, the mean annual percentage increase in net income is NFPMEAN, and
* the standard deviation is NFPSTD.
*
GEN1 NFP=9
GEN1 NFPMEAN=2.098
GEN1 NFPSTD=10.834
*
* The common population variance (S2) is calculated using the GEN1 command.
*
GEN1 S2=(((PFP-1)*PFPSTD**2)+((NFP-1)*NFPSTD**2))/(PFP+NFP-2)
*
* The standard deviation (S) of the common population is the square-root
* of the variance.
*
GEN1 S=SQRT(S2)
PRINT S2 S
*
* The 90% Confidence Interval for the difference between the population mean
* percentage increases in net income is calculated with the GEN1 command.
* The Lower Bound is defined as LOWER and the Upper Bound is defined as
* UPPER.
*
* From Table 6 of the Appendix, t(13,0.05)=1.771.
*
GEN1 LOWER=(PFPMEAN-NFPMEAN)-((1.771*S)*(SQRT((PFP+NFP)/(PFP*NFP))))
GEN1 UPPER=(PFPMEAN-NFPMEAN)+((1.771*S)*(SQRT((PFP+NFP)/(PFP*NFP))))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.12, page 310
*
* The survey of client-sponsored projects (CSPs) users in schools accrediated
* by the American Assembly of Collegiate Schools of Business is ACCRED and
* the number of response in these schools who agreed that "CSPs are too
* time-consuming for faculty" is ACCAGR.  An independent sample of CSP users
* in nonaccredited schools is NONACCR and the number that agreed with the
* response is NONACCAG.
*
GEN1 ACCRED=92
GEN1 ACCAGR=49
GEN1 PHATACC=ACCAGR/ACCRED
PRINT ACCRED ACCAGR PHATACC
GEN1 NONACCR=86
GEN1 NONACCAG=36
GEN1 PHATNON=NONACCAG/NONACCR
PRINT NONACCR NONACCAG PHATNON
*
* The 90% Confidence Interval for the difference between population
* proportions is calculated with the GEN1 command.  The "&" command is to
* continue the GEN1 command onto the following line.  The Lower Bound is
* called LOWER and the Upper Bound is called UPPER.
*
GEN1 LOWER=(PHATACC-PHATNON)-1.645*SQRT(((PHATACC*(1-PHATACC))/ACCRED)+&
((PHATNON*(1-PHATNON))/NONACCR))
GEN1 UPPER=(PHATACC-PHATNON)+1.645*SQRT(((PHATACC*(1-PHATACC))/ACCRED)+&
((PHATNON*(1-PHATNON))/NONACCR))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.13, page 311
*
* The random sample of male senior accounting students is MALE and the number
* of these men expected to be working full time ten years later is MALEFT.
* The independent random sample of female senior account students is FEMALE
* and the number of these women expected to be working full time ten years
* later is FEMALEFT.
*
GEN1 MALE=120
GEN1 MALEFT=107
GEN1 PHATMEN=MALEFT/MALE
PRINT MALE MALEFT PHATMEN
GEN1 FEMALE=141
GEN1 FEMALEFT=73
GEN1 PHATWOM=FEMALEFT/FEMALE
PRINT FEMALE FEMALEFT PHATWOM
*
* The 95% Confidence Interval for the difference between population
* proportions is calculated with the GEN1 command.  The "&" command
* is to continue the GEN1 command onto the following line.  The Lower Bound
* is called LOWER and the Upper Bound is called UPPER.
*
GEN1 LOWER=(PHATMEN-PHATWOM)-1.96*SQRT(((PHATMEN*(1-PHATMEN))/MALE)+&
((PHATWOM*(1-PHATWOM))/FEMALE))
GEN1 UPPER=(PHATMEN-PHATWOM)+1.96*SQRT(((PHATMEN*(1-PHATMEN))/MALE)+&
((PHATWOM*(1-PHATWOM))/FEMALE))
PRINT LOWER UPPER
*
DELETE / ALL
*
*----------------------------------------------------------------------------
* Example 8.14, page 315
*
* The sample size required to achieve a 99% Confidence Interval extending no
* further than 0.50 mm on each side of the sample mean is defined as N using
* the GEN1 command.
*
GEN1 L=0.50
GEN1 SIGMA=1.8
GEN1 Z005=2.575
GEN1 N=((Z005**2)*(SIGMA**2))/(L**2)
PRINT N
*
*----------------------------------------------------------------------------
* Example 8.15, page 317
*
* The sample size required to achieve a 95% Confidence Interval for the
* proportion of company recruiters who viewed grades as very important in
* the consideration of a candiate extends no further than 0.06 on each side
* of the sample proportion is defined as N using the GEN1 command.
*
GEN1 L=0.06
GEN1 Z025=1.96
GEN1 N=(0.25*Z025**2)/L**2
PRINT N
*
DELETE / ALL
*
*----------------------------------------------------------------------------
STOP