3/29/05 251grass2-051

(Open this document in 'Page Layout' view!) Graded Assignment 2 Name:

Class days and time:

Student number:

Modify the data below as follows: Add the last digit of your student number to 7 in problem 1; Add the second to last number to the 9 in problem 2.

1) For the following joint probability table (i) check for independence, (ii) Compute and , (iii) Compute or and or, (iv) Compute and from the results in (ii) and (iii), (iv) Compute and using the formulas in section K4 of 251v2out or section C1 of 251var2. Note that .

2) For the following sample (i) Compute the sample mean and variance of , (ii) Compute or and or , (iii) Compute the sample mean and variance of from the results in (i) and (ii). (iv) Compute and using the formulas in section K4 of 251v2out or section C1 of 251var2. Note that .

9 / 2
4 / 4
6 / 2
2 / 5
1 / 7
1 / 6
3 / 5
10 / -3

————— 4/11/2005 6:37:46 PM ————————————————————

Welcome to Minitab, press F1 for help.

MTB > WOpen "C:\Documents and Settings\rbove\My Documents\Minitab\2gr2-051.MTW".

Retrieving worksheet from file: 'C:\Documents and Settings\rbove\My

Documents\Minitab\2gr2-051.MTW'

Worksheet was saved on Tue Feb 08 2005

Results for: 2gr2-051.MTW

MTB > WOpen "C:\Documents and Settings\rbove\My Documents\Minitab\1gr1-051ab.MTW".

Retrieving worksheet from file: 'C:\Documents and Settings\rbove\My

Documents\Minitab\1gr1-051ab.MTW'

Worksheet was saved on Wed Feb 02 2005

Population Correlation Problem

Results for: 1gr2-051ab.MTW

MTB > WSave "C:\Documents and Settings\rbove\My Documents\Minitab\1gr2-051ab.MTW";

SUBC> Replace.

Saving file as: 'C:\Documents and Settings\rbove\My

Documents\Minitab\1gr2-051ab.MTW'

MTB > echo

MTB > Execute "C:\Documents and Settings\rbove\My Documents\Minitab\251popcorr.mtb" 1.

Executing from file: C:\Documents and Settings\rbove\My Documents\Minitab\251popcorr.mtb

MTB > #251popcorr

MTB > # Computes population covariance and correlation

MTB > # Put x in C15, y in c17

MTB > # Put a joint probability table in c10 - c14

MTB > # Fill table with zeros to make it 5 by 5.

MTB > name k10 'varx'

MTB > name k11 'vary'

MTB > name k12 'Exy'

MTB > name k13 'covxy'

MTB > name k14 'corr'

MTB > name k15 'sdx'

MTB > name k16 'sumpx'

MTB > name k17 'sdy'

MTB > name k18 'sumpy'

MTB > name k25 'Ex'

MTB > name k26 'Ex2'

MTB > name k27 'Ey'

MTB > name k28 'Ey2'

MTB > execute 'marg973'

Executing from file: marg973.MTB

MTB > #marg973.mtb #part of 251popcorr Computes marginal probs

MTB > let c18=c10+c11+c12+c13+c14

MTB > let c16(1)=sum(c10)

MTB > let c16(2)=sum(c11)

MTB > let c16(3)=sum(c12)

MTB > let c16(4)=sum(c13)

MTB > let c16(5)=sum(c14)

MTB > let k16=sum(c16) #These are sums of x and y

MTB > let k18=sum(c18) #probabilities and should be 1.

MTB > print c10-c18

Data Display

Row C10 C11 C12 C13 C14 C15 C16 C17 C18

1 0.11 0.08 0.16 0 0 3 0.33 1 0.35

2 0.10 0.14 0.10 0 0 5 0.30 3 0.34

3 0.12 0.08 0.11 0 0 7 0.37 9 0.31

4 0.00 0.00 0.00 0 0 0 0.00 0 0.00

5 0.00 0.00 0.00 0 0 0 0.00 0 0.00

MTB > end

MTB > execute 'meany973'

Executing from file: meany973.MTB

MTB > #meany.973.mtb part of 251popcorr

MTB > print k16,k18

Data Display

sumpx 1.00000

sumpy 1.00000

MTB > let c20=c10*c17

MTB > let c20=c20*c15(1)

MTB > let c21=c11*c17

MTB > let c21=c21*c15(2)

MTB > let c22=c12*c17

MTB > let c22=c22*c15(3)

MTB > let c23=c13*c17

MTB > let c23=c23*c15(4)

MTB > let c24=c14*c17

MTB > let c24=c24*c15(5)

MTB > let c25=c15*c16 # xP(x)

MTB > let k25=sum(c25) # E(x)

MTB > let c27=c17*c17

MTB > let k27=sum(c27) # E(y)?

MTB > end

MTB > execute 'meanz973'

Executing from file: meanz973.MTB

MTB > #meanz973.mtb part of 251popcorr

MTB > let c27=c17*c18

MTB > let k27=sum(c27) #E(y)

MTB > end

MTB > execute 'exysq973'

Executing from file: exysq973.MTB

MTB > #exysq973.mtb part of 251popcorr

MTB > let c26=c15*c25 # xsqP(x)

MTB > let c28=c17*c27 # ysqP(y)

MTB > let k26=sum(c26) # E(xsq)

MTB > let k28=sum(c28) # E(ysq)

MTB > print c20-c28

Data Display

Row C20 C21 C22 C23 C24 C25 C26 C27 C28

1 0.33 0.4 1.12 0 0 0.99 2.97 0.35 0.35

2 0.90 2.1 2.10 0 0 1.50 7.50 1.02 3.06

3 3.24 3.6 6.93 0 0 2.59 18.13 2.79 25.11

4 0.00 0.0 0.00 0 0 0.00 0.00 0.00 0.00

5 0.00 0.0 0.00 0 0 0.00 0.00 0.00 0.00

MTB > print k25-k28

Data Display

Ex 5.08000

Ex2 28.6000

Ey 4.16000

Ey2 28.5200

MTB > end

MTB > execute 'xyvar973'

Executing from file: xyvar973.MTB

MTB > #xyvar973.mtb part of popcorr

MTB > let k10=k26-k25*k25 #variance of x

MTB > let k11=k28-k27*k27 #variance of y

MTB > print k10 k11

Data Display

varx 2.79360

vary 11.2144

MTB > let k20=sum(c20)

MTB > let k21=sum(c21)

MTB > let k22=sum(c22)

MTB > let k23=sum(c23)

MTB > let k24=sum(c24)

MTB > let k12 = k20+k21+k22+k23+k24 # E(xy)

MTB > print k20-k24, k12

Data Display

K20 4.47000

K21 6.10000

K22 10.1500

K23 0

K24 0

Exy 20.7200

MTB > end

MTB > execute 'cov973'

Executing from file: cov973.MTB

MTB > #cov973.mtb part of popcorr

MTB > let k13=k12-k25*k27 #Covariance

MTB > let k15=sqrt(k10) #St. dev of x

MTB > let k17=sqrt(k11) #St. dev of y

MTB > let k14=k13/k15

MTB > let k14=k14/k17 #Corr(x, y)

MTB > print k13-k18

Data Display

covxy -0.412800

corr -0.0737513

sdx 1.67141

sumpx 1.00000

sdy 3.34879

sumpy 1.00000

MTB > end

MTB > execute 'tb2973'

Executing from file: tb2973.MTB

MTB > #tb2973.mtb Part of 251popcorr

MTB > let k30=30

MTB > let k31=10

MTB > let k32=1

MTB > execute 'tb2s973' 5

Executing from file: tb2s973.MTB

MTB > #tb2s973.mtb Subroutine of tb2973

MTB > # Part of popcorr

MTB > let ck30=ck31

MTB > let ck30(6)=c16(k32)

MTB > let ck30(7)=c25(k32)

MTB > let ck30(8)=c26(k32)

MTB > let k30=k30+1

MTB > let k31=k31+1

MTB > let k32=k32+1

MTB > end

MTB > #tb2s973.mtb Subroutine of tb2973

MTB > # Part of popcorr

MTB > let ck30=ck31

MTB > let ck30(6)=c16(k32)

MTB > let ck30(7)=c25(k32)

MTB > let ck30(8)=c26(k32)

MTB > let k30=k30+1

MTB > let k31=k31+1

MTB > let k32=k32+1

MTB > end

MTB > #tb2s973.mtb Subroutine of tb2973

MTB > # Part of popcorr

MTB > let ck30=ck31

MTB > let ck30(6)=c16(k32)

MTB > let ck30(7)=c25(k32)

MTB > let ck30(8)=c26(k32)

MTB > let k30=k30+1

MTB > let k31=k31+1

MTB > let k32=k32+1

MTB > end

MTB > #tb2s973.mtb Subroutine of tb2973

MTB > # Part of popcorr

MTB > let ck30=ck31

MTB > let ck30(6)=c16(k32)

MTB > let ck30(7)=c25(k32)

MTB > let ck30(8)=c26(k32)

MTB > let k30=k30+1

MTB > let k31=k31+1

MTB > let k32=k32+1

MTB > end

MTB > #tb2s973.mtb Subroutine of tb2973

MTB > # Part of popcorr

MTB > let ck30=ck31

MTB > let ck30(6)=c16(k32)

MTB > let ck30(7)=c25(k32)

MTB > let ck30(8)=c26(k32)

MTB > let k30=k30+1

MTB > let k31=k31+1

MTB > let k32=k32+1

MTB > end

MTB > let c35=c18

MTB > let c35(6)=k18

MTB > let c35(7)=k25

MTB > let c35(8)=k26

MTB > let c36=c27

MTB > let c36(6)=k27

MTB > let c37=c28

MTB > let c37(6)=k28

MTB > print c30-c37

Data Display

Row C30 C31 C32 C33 C34 C35 C36 C37

1 0.11 0.08 0.16 0 0 0.35 0.35 0.35

2 0.10 0.14 0.10 0 0 0.34 1.02 3.06

3 0.12 0.08 0.11 0 0 0.31 2.79 25.11

4 0.00 0.00 0.00 0 0 0.00 0.00 0.00

5 0.00 0.00 0.00 0 0 0.00 0.00 0.00

6 0.33 0.30 0.37 0 0 1.00 4.16 28.52

7 0.99 1.50 2.59 0 0 5.08

8 2.97 7.50 18.13 0 0 28.60

MTB > write c30-c37.

Data Display (WRITE)

0.11 0.08 0.16 0 0 0.35 0.35 0.35

0.10 0.14 0.10 0 0 0.34 1.02 3.06

0.12 0.08 0.11 0 0 0.31 2.79 25.11

0.00 0.00 0.00 0 0 0.00 0.00 0.00

0.00 0.00 0.00 0 0 0.00 0.00 0.00

0.33 0.30 0.37 0 0 1.00 4.16 28.52

0.99 1.50 2.59 0 0 5.08 * *

2.97 7.50 18.13 0 0 28.60 * *

* NOTE * Column lengths not equal.

MTB > end.

MTB > execute 'tb3973'

Executing from file: tb3973.MTB

MTB > #tb3973.mtb final printout for 252popcorr

MTB > write c20-c24;

SUBC> replace.

Data Display (WRITE)

0.33 0.4 1.12 0 0

0.90 2.1 2.10 0 0

3.24 3.6 6.93 0 0

0.00 0.0 0.00 0 0

0.00 0.0 0.00 0 0

MTB > end

MTB > end

MTB >


Sample Correlation Problem

MTB > Save "C:\Documents and Settings\rbove\My Documents\Minitab\1gr2-051ab.MTW";

SUBC> Replace.

Saving file as: 'C:\Documents and Settings\rbove\My

Documents\Minitab\1gr2-051ab.MTW'

Existing file replaced.

MTB > Execute "C:\Documents and Settings\rbove\My Documents\Minitab\251samcov.mtb" 1.

Executing from file: C:\Documents and Settings\rbove\My Documents\Minitab\251samcov.mtb

MTB > #samcov Computes sample variances

MTB > # and covariances using 'var973'

MTB > #Input is x column in c40, y column in c42

MTB > # Example in Covex

MTB > name c40 'x'

MTB > name c41 'xsq'

MTB > name c42 'y'

MTB > name c43 'ysq'

MTB > name c44 'xy'

MTB > name k40 'sumx'

MTB > name k41 'sumx2'

MTB > name k42 'sumy'

MTB > name k43 'sumy2'

MTB > name k44 'sumxy'

MTB > name k45 'n'

MTB > name k46 'xbar'

MTB > name k47 'ybar'

MTB > name k48 'svarx'

MTB > name k49 'svary'

MTB > name k50 'scovxy'

MTB > name k51 'sx'

MTB > name k52 'sy'

MTB > name k53 'rxy'

MTB > name k54 'rxy2'

MTB > let c1=c40

MTB > execute 'var973'

Executing from file: var973.MTB

MTB >

MTB > #var973.mtb

MTB > #computes sample variance of data in C1.

MTB >

MTB > let k1=sum(c1)

MTB > let c2=c1 * c1

MTB > let k2=sum(c2)

MTB > let k3=count(c1)

MTB > let k4=k1/k3 #mean

MTB > let k5=k3*k4*k4

MTB > let k5=k2-k5

MTB > print k5

Data Display

K5 86.0000

MTB > name k1 'sum'

MTB > name k2 'sumsq'

MTB > name k3 'count'

MTB > name k4 'smean'

MTB > name k5 'svar'

MTB > name k6 'sdev'

MTB > name k7 'DF'

MTB > name k8 'sterr'

MTB > let k7 = k3 - 1

MTB > let k5 = k5/k7

MTB > let k6 = sqrt(k5)

MTB > let k8 = k5/k3

MTB > let k8 = sqrt(k8)

MTB > describe c1

Descriptive Statistics: C1

Variable N N* Mean SE Mean StDev Minimum Q1 Median Q3 Maximum

C1 8 0 4.50 1.24 3.51 1.00 1.25 3.50 8.25 10.00

MTB > print c1-c2

Data Display

Row C1 C2

1 9 81

2 4 16

3 6 36

4 2 4

5 1 1

6 1 1

7 3 9

8 10 100

MTB > print k1-k8

Data Display

sum 36.0000

sumsq 248.000

count 8.00000

smean 4.50000

svar 12.2857

sdev 3.50510

DF 7.00000

sterr 1.23924

MTB > end

MTB > let C41=c2

MTB > let k40=k1

MTB > let k41=k2

MTB > let k46=k4

MTB > let k48=k5

MTB > let k51=k6

MTB > let c1=c42

MTB > execute 'var973'

Executing from file: var973.MTB

MTB > #var973.mtb

MTB > #computes sample variance of data in C1.

MTB > let k1=sum(c1)

MTB > let c2=c1 * c1

MTB > let k2=sum(c2)

MTB > let k3=count(c1)

MTB > let k4=k1/k3 #mean

MTB > let k5=k3*k4*k4

MTB > let k5=k2-k5

MTB > print k5

Data Display

svar 70.0000

MTB > name k1 'sum'

MTB > name k2 'sumsq'

MTB > name k3 'count'

MTB > name k4 'smean'

MTB > name k5 'svar'

MTB > name k6 'sdev'

MTB > name k7 'DF'

MTB > name k8 'sterr'

MTB > let k7 = k3 - 1

MTB > let k5 = k5/k7

MTB > let k6 = sqrt(k5)

MTB > let k8 = k5/k3

MTB > let k8 = sqrt(k8)

MTB > describe c1

Descriptive Statistics: C1

Variable N N* Mean SE Mean StDev Minimum Q1 Median Q3 Maximum

C1 8 0 3.50 1.12 3.16 -3.00 2.00 4.50 5.75 7.00

MTB > print c1-c2

Data Display

Row C1 C2

1 2 4

2 4 16

3 2 4

4 5 25

5 7 49

6 6 36

7 5 25

8 -3 9

MTB > print k1-k8

Data Display

sum 28.0000

sumsq 168.000

count 8.00000

smean 3.50000

svar 10.0000

sdev 3.16228

DF 7.00000

sterr 1.11803

MTB > end

MTB > let C43=c2

MTB > let k42=k1

MTB > let k43=k2

MTB > let k45=k3

MTB > let k47=k4

MTB > let k49=k5

MTB > let k52=k6

MTB > let c44=c40*c42

MTB > let k44=sum(c44)

MTB > let k50=k45*k46*k47

MTB > let k50=k44-k50

MTB > let k50=k50/k7

MTB > let k53=k51*k52

MTB > let k53=k50/k53

MTB > let k54=k53*k53

MTB > Print c40-c44


Data Display

Row x xsq y ysq xy

1 9 81 2 4 18

2 4 16 4 16 16

3 6 36 2 4 12

4 2 4 5 25 10

5 1 1 7 49 7

6 1 1 6 36 6

7 3 9 5 25 15

8 10 100 -3 9 -30

MTB > Print k40-k54

Data Display

sumx 36.0000

sumx2 248.000

sumy 28.0000

sumy2 168.000

sumxy 54.0000

n 8.00000

xbar 4.50000

ybar 3.50000

svarx 12.2857

svary 10.0000

scovxy -10.2857

sx 3.50510

sy 3.16228

rxy -0.927971

rxy2 0.861130

MTB > end

MTB > Save "C:\Documents and Settings\rbove\My Documents\Minitab\1gr2-051ab.MTW";

SUBC> Replace.

Saving file as: 'C:\Documents and Settings\rbove\My

Documents\Minitab\1gr2-051ab.MTW'

Existing file replaced.

MTB >