HINTS ON COMPUTING EXERCISES USING SESSION COMMANDS

Commands, in these hints, have been typed in upper case to make them stand out. When using MINITAB, upper or lower case may be used for the command words and the arguments. Subcommands have been inset. Comments are preceded by the sign ‘#’.

Chapter 1

1.(a) # Label column W

SET W

72 58 …

… 96 52

END

HISTOGRAM W

STEM-AND-LEAF W

(c) CHART X

(d) # Although number of words is discrete, a histogram gives a better impression than a bar chart.

2. # Label columns M and F

READ M F

72 68

58 63

61 54

END

HISTOGRAM M F;

OVERLAY.

3. # Label column ‘Length’

# Produce a histogram with class-interval 0.1.

HISTOGRAM ‘Length’;

CUTPOINTS 19.45:25.45/0.1;

TITLE “Interval 0.1”.

# Repeat using class-intervals 0.3, 0.5, 0.7, 0.9.

# Choose EditorLayout Tool to put histograms side-by-side.

4. # To produce a histogram with K intervals, use the subcommand

NINTERVAL K

# Choose a number of values of K including the square root of n.

Chapter 2

1. # Label columns AX, AY, AZ, BX, BY, BZ. Enter data.

LET ‘AZ’ = ‘AY’ – ‘AX’

LET ‘BZ’ = ‘BY’ – ‘BX’

DESCRIBE ‘AX’ ‘BX’

DOTPLOTS ‘AX’ ‘BX’;

OVERLAY.

# Repeat for Y and Z.

#Alternatively, the data may be entered stacked.

# Label columns ‘X’, ‘Y’, ‘Z’,’Test’. Enter data using labels A or B under Test.

DESCRIBE X;

BY ‘Test’.

DOTPLOT X*’Test’

2.(a) # Label column W.

DESCRIBE W

HISTOGRAM W

3. # Similar to Ex. 1 above.

Chapter 3

1.# Label columns ‘Rep’ and ‘Ran’.

DESCRIBE ‘Rep’ ‘Ran’

HISTOGRAM ‘Rep’ ‘Ran’;

AREA;

OVERLAY.

2.

RANDOM 100 C1;

INTEGER 0 9.

CHART C1

3.

RANDOM 100 C1;

UNIFORM 0 1.

HISTOGRAM C1

4.# Label columns X S1 S2 S3 S4 M. Enter data in X.

SAMPLE 100 X S1;

REPLACE.

# Repeat to generate S2, S3, S4.

RMEAN S1 S2 S3 S4 M

Chapter 4

1. # Similar to Chapter 3 (1).

2. # Label columns ‘Sex’ and ‘Salary’.

DESCRIBE ‘Salary’;

BY ‘Sex’.

HISTOGRAM ‘Salary’;

AREA;

SEPARATE ‘Sex’.

3. # Label C12, X and C13, M.

SAMPLE 100 X C1;

REPLACE.

# Repeat putting further samples into C2-C10.

RMEANS C1-C10 M

# The repetition is tedious. Better to use a macro. Use the word processor and type:

GMACRO

PICKSAMPLE

DO K1=1:10

SAMPLE 100 X CK1;

REPLACE.

ENDDO

ENDMACRO

# Name file, say, PICKSAMPLE.TXT. Save in text-only form in the Macro folder within the main Minitab directory. The session command which calls the macro

%PICKSAMPLE

will generate the samples.

Chapter 6

1. # Label columns C51, ‘No H’; C52, ‘Total H’; C53, ‘No of trials’; C54, ‘Prop H’.

# Generate no of heads in 50 trials.

RANDOM 100 C1-C50;

BERNOULLI 0.5.

RSUM C1-C50 ‘No H’

# Cumulate no of heads in 50, 100, 150, …trials.

PARSUM ‘No H’ ‘Total H’

# Enter no of trials.

SET

50:5000/50

END

# Calculate proportion of heads.

LET ‘Prop H’ = ‘Total H’/’No of trials’

#Plot results.

TSPLOT ‘Prop H’;

SYMBOL;

CONNECT.

2. # Generate no of wins over 3 games as in previous exercise. Store in C4, label X.

TALLY X

Chapter 7

1.# Label columns ‘X’, ‘Total X’, ‘List of X categories’, ‘Frequency’

RANDOM 500 X;

BERNOULLI 0.16667.

PARSUMS X ‘Total X’

TALLY ‘TotalX’;

STORE ‘List of X categories’ ‘Frequency’.

# Delete the first and last entries in the Frequency column because of end effects.

# The entries in the Frequency column form a random sample from the required distribution.

2. # Label C1, ‘Card No’.

RANDOM 200 ‘Card No’;

INTEGER 1 10.

# Replace by zero any of the distinct values that occur, leaving other values unchanged. In a particular case this was done by the following command.

CODE (1 2 5 6 7 8) 0 ‘Card No’ C2

# Looking at the result suggested the command:

CODE (3 4 10) 0 C2 C3

#In C3 the only non-zero digit was 9 which first occurred at Observation 41. Hence 41 was a random sample from the required distribution.

Chapter 8

1. # Label columns C1, R and C2, P(R)

SET R

0:8

END

PDF R P(R);

BINOMIAL 30 0.1.

LET C2(10) = 1 – SUM(C2)

2. # Label columns R, for binomial variable; N, for no of beads; F, for frequency; %F, for percentage frequency.

RANDOM 100 R;

BINOMIAL 30 0.1.

TALLY R;

COUNTS;

PERCENTS;

STORE N F ‘ %F’.

3. # Proceed as recommended above in hint for Chapter 7(1). Having obtained values of ‘number of throws to a six’, add successive pairs of values, to give values from the required distribution.

Chapter 9

1. # Label columns R, for outcome of die; W, for Bill’s winnings.

RANDOM 500 R;

INTEGER 1 6.

CODE (2:5) –2 R W

TALLY W

MEAN W

2. The game may be summarised by a table:

No of throws , x / 1 / 2 / 3 / 4 / 5 and H / 5 and T
Probability / 0.5 / 0.25 / 0.125 / 0.0625 / 0.03125 / 0.03125
Ann’s gain / 1 / 2 / 3 / 2 / -5 / -62

For example, if x=3 then Ann’s gain is –2-4+9 = 3.

The required distribution of gain is as above with the two probabilities for ‘2’ added.

# Label columns ‘Gain’ ‘P’ ‘Win’ ‘Total win’ ‘Balance’.Enter 1, 2, 3, -5, -62, in ‘Gain’ with corresponding probabilities in P.

RANDOM 100 ‘Win’;

DISCRETE ‘Gain’ P.

PARSUMS ‘Win’ ‘Total win’

Let ‘Balance’ = ‘Total win’ + 600

TSPLOT ‘Balance’;

SYMBOL;

CONNECT.

Chapter 10

1. # Label columns ‘X’, ‘Y’ and ‘Z’.

RANDOM 500 ‘X’;

BINOMIAL 4 0.6.

RANDOM 500 ‘Y’;

BINOMIAL 4 0.4.

LET ‘Z’ = ‘X’ + ‘Y’

DESCRIBE ‘X’ ‘Y’ ‘Z’;

MEAN;

VARIANCE.

#Open new worksheet. Label columns ‘X’ ‘Y1’ ‘Y2’ ‘Y’ ‘Z’

RANDOM 500 ‘X’;

BINOMIAL 4 0.6.

CODE (0 1 2) 1 (3 4) 0 ‘X’ ‘Y1’

RANDOM 500 ‘Y2’;

BINOMIAL 3 0.4.

LET ‘Y’ = ‘Y1’ + ‘Y2’

LET ‘Z’ = ‘X’ + ‘Y’

2. # Label columns ‘Toss’, ‘Factor’, ‘Score’ and ‘Gain’.

RANDOM 500 ‘Toss’;

BERNOULLI 0.5.

CODE (1) 2 (0) –1 ‘Toss’ ‘Factor’

RANDOM 500 ‘Score’;

INTEGER 1 6.

LET ‘Gain’ = ‘Factor’ * ‘Score’

# Draw histograms and find descriptive statistics. Label new column ‘Fortune’.

PARSUMS ‘Gain’ ‘Fortune’

TSPLOT ‘Fortune’

Chapter 11

1. # Use a separate worksheet for each sample size. Sample size 9 is done as an example.

RANDOM 500 C1-C9;

INTEGER 0 9.

NAME C10 ‘M9’

RMEAN C1-C9 ‘M9’

HISTOGRAM ‘M9’;

TITLE “M9”.

DESCRIBE ‘M9’;

MEAN;

STDEVIATION.

2. # Label columns ‘R’ and ‘P’.

RANDOM 500 ‘R’;

BINOMIAL 20 0.1.

LET ‘P’ = ‘R’/20

Chapter 13

1(i) # Put data in column labelled ‘Income’.

STEST 50 ‘Income’

# Gives p-value of 0.1516. To check p-value, find probability of ‘observed result and of equivalent and more extreme values’ i.e. probability of 0 to 8 and 16 to 24.

CDF 8;

BINOMIAL 24 0.5.

# Double this value, i.e. 2 X 0.0757948 = 0.151590.

(ii) # Calculate differences and put in column labelled ‘d’. Do one tail test.

STEST 0 ‘d’;

ALTERNATIVE 1.

2. # Set data in columns labelled A and B.

DOTPLOT ‘A’ ‘B’;

OVERLAY.

MANN-WHITNEY ‘A’ ‘B’

3. # Set differences in column labelled ‘d’.

DOTPLOT ‘d’

WTEST 0 ‘d’

Chapter14

1. Label columns ‘IAT’, inter-arrival time; ‘AT’, arrival time; ‘ATX’, AT-0.5; ‘AI’, arrival interval; ‘AIL’, list of arrival intervals; ‘N’, no. in arrival interval.

RANDOM 500 ‘IAT’;

EXPONENTIAL 0.5.

PARSUMS ‘IAT’ ‘AT’

LET ‘ATX’ = ‘AT’ – 0.5

ROUND (‘ATX’, ‘AI’)

TALLY ‘AI’;

STORE ‘AIL’ ‘N’.

# The values of N opposite 5, 10, 15,…are observations from the required distribution. Ingenuity or hard labour is needed to pull them out. Do not overlook zero counts. If an arrival interval, e.g. 35, includes no cars, it does not enter the list.

2. # Label columns X, Y, Z.

RANDOM 500 ‘X’;

UNIFORM 0 1.

RANDOM 500 ‘Y’;

UNIFORM 0 2.

LET ‘Z’ = ‘X’ + ‘Y’

Chapter 15

1. # Label columns x, F(x), DF(x), freq

SET ‘x’

-1000.5 89.5:189.5/20 1000.5

END

CDF ‘x’ ‘F(x)’;

NORMAL 131.5 20.

DIFFERENCES ‘F(x)’ ‘DF(x)’

LET ‘freq’ = ‘DF(x)’*100

2. # (i) Find expected relative frequencies for normal distribution, with mean 4.5 and s.d. 9.08, using class boundaries 10.5, 20.5, …, 90.5, as in previous question.

#Name C11, ‘sum’; C12, ‘interval’; C13, ‘interval list’; C14, ‘observed freq’.

RANDOM 500 C1-C10;

INTEGER 0 9.

RSUM C1-C10 ‘sum’

# (ii) Code values falling in chosen interval by centre of interval. All intervals must be listed.

CODE (0.5:10.5) 5.5 (10.5:20.5) 15.5 …(80.5:90.5) 85.5 ‘sum’ ‘interval’

TALLY ‘interval’;

STORE ‘interval list’ ‘observed freq’

3. # Label columns N, U, E.

RANDOM 160 ‘N’;

NORMAL 5 1.

RANDOM 160 ‘U’;

UNIFORM 2 8.

RANDOM 160 ‘E’;

EXPONENTIAL 5.

HISTOGRAM ‘N’;

TITLE “N160”.

HISTOGRAM ‘U’;

TITLE “U160”.

HISTOGRAM ‘E’;

TITLE “E160”.

# Use Editor>Layout Tool to compare the graphs.

DELETE 81:160 ‘N’ ‘U’ ‘E’

# and repeat.

Chapter 16

1. # Label columns C61, ‘M1’; C62, ‘Z1’; C63, ‘M12’, C64, ‘Z12’, etc.

RANDOM 500 C1-C61;

UNIFORM 0 12.

LET ‘Z1’ = (‘M1’ – 6)/SQRT(12)

RMEAN C1-C12 ‘M12’

LET ‘Z12’ = (‘M12’ –6)

# etc. for M48 and Z48.

# Compare graphs as in previous question.

# For part (iii) look at hint in second part of Chapter 15(2) above.

2.# Label columns X, Z.

RANDOM 500 ‘X’;

BINOMIAL 9 0.1.

LET ‘Z’ = (‘X’ – 0.9)/0.9

Chapter 17

1. # Label columns ‘Rep’ and ‘Ran’.

ONET ‘Rep’;

TEST 37.659.

# Repeat for ‘Ran’.

TWOSAMPLE ‘Rep’ ‘Ran’

# No need to pool estimates of variance with such large samples and there might be a difference in variability. In fact the variances are similar and pooling or not has little effect on the test.

2. (i) # Label columns ‘X’, ‘Z’, ‘Region’.

RANDOM 1000 ‘X’;

NORMAL 12 0.8.

LET ‘Z’ = (‘X’ – 12)/0.8

CODE (-1000:-1.96) –1 (-1.96:1.96) 0 (1.96:1000) 1 ‘Z’ ‘Region’

TALLY ‘Region’

Chapter 18

1. # Label columns L and R.

CODE (1:10) 0 (11:20) 1 ‘L’ ‘R’

PONE ‘R’;

USE Z.

2. # Label columns C11, M; C12, L1; C13, L2; C14, S1; C15, S2; C16, S.

RANDOM 1000 C1-C10;

NORMAL 1000 2.5.

RMEAN C1-C10 ‘M’

LET K1 = (1.96*2.5)/3.16228

LET L1 = ‘M’-K1

LET L2 = ‘M’+K1

CODE (0:1000) 1 (1000.00001:2000) 0 ‘L1’ ‘S1’

CODE (0:999.99999) 0 (1000:2000) 1 ‘L2’ ‘S2’

LET ‘S’ = ‘S1’*’S2’

TALLY ‘S’

# In the tally table, 1 denotes that the interval contains the true mean and 0 that it does not.

3. # Label columns C16, mean; C17, median; C18, max; C19, f(max).

RANDOM 500 C1-C15;

UNIFORM 0 2.

RMEAN C1-C15 ‘mean’

RMEDIAN C1-C15 ‘median’

RMAX C1-C15 ‘max’

LET ‘f(max)’ = 8*’Max’/15

Chapter 19

1. # (i) Label columns x, F(x), DF(x), EE, E, O, Z

NAME K1 ‘X-squared’

# (ii) Calculate expected values

SET x

-1000 90:160/10 1000

END

CDF x F(x);

NORMAL 129.25 13.804.

DIFFERENCE 1 F(x) DF(x)

LET EE = 254*DF(x)

# (iii) Group cells if necessary

# Tail cells need adding together. General rule is expected values should be greater than 5 but this is not strict. Here it would be reasonable to add the two cells at each end. Too much grouping reduces the degrees of freedom.

# After grouping set values in column E. Also set in O the corresponding observed values.

SUM E # a check on the total, may differ slightly because of round-off error

# (iv) Calculate Xsquared

LET Z = (‘O’ – ‘E’)**2/’E’

LET ‘X-squared’ = SUM(Z))

# Either compare with table of chi-squared percentage points or work out p-value.

2. # Label columns ‘y’, ‘interval’, ‘interval list’, ‘observed freq’, ‘O’, ‘x’, ‘F(x)’, ‘DF(x)’, ‘EE’, ‘E’

RANDOM 500 y;

NORMAL 0 1.

# Code values of y falling in chosen interval by centre of interval. See hint, Chap 15, 2(ii).

# Find expected values and ‘Xsquared’ as in previous hint, parts (ii), (iii) and (iv).

3. # Label columns ‘Br’ ‘G’ ‘Bl’

# Enter data, 4 rows in each of 3 columns.

CHISQUARE ‘Br’ ‘G’ ‘Bl’

Chapter 20

1.

RANDOM 500 C1;

POISSON 1.

# Give title to graph.

Etc.

2. # Label columns ‘N’ for no. of calls; ‘R’ for possible values of variate; ‘O’ for observed frequencies; ‘x’ for values of Poisson variable; ‘F(x)’; ‘DF(x)’; ‘EE’ for expected frequencies; ‘E’ for expected frequencies to be used in test; ‘Z’ for components of Xsquared.

# Enter data in N

TALLY N;

STORE R O.

LET K1 = MEAN(O)

# Calculate expected frequencies and Xsquared as in hint, Chapter 19(1), parts (ii), (iii) and (iv).

3. # Label columns ‘R’ ‘Bin’ ‘Poiss’

PDF ‘R’ ‘Bin’;

BINOMIAL 10 0.1.

PDF ‘R’ ‘Poiss’;

POISSON 1.

# etc.

Chapter 21

1. # Label columns ‘WT’ ‘FAT’ ‘%FAT’ ‘SEX’

# Enter body weight and total body fat for all participants. Calculate %FAT and, labelling men 1 and women 2, complete SEX column.

CORRELATION ‘WT’ ‘%FAT’

CORRELATION ‘WT’ ‘%FAT’;

BY ‘SEX’.

PLOT ‘WT’*’%FAT’;

SYMBOL ‘SEX’.

2. # Similar commands to previous exercise.