Sections 2.1-2.3.

We can use the computer to generate random observations MTB > random 50 c1 generates 50 numbers according to the bell curve MTB > dotplot c1 . . . : . : . . ..: . ::..:: :. .::. .::... :. . .. . . ---+---------+---------+---------+---------+---------+---C1 -1.60 -0.80 0.00 0.80 1.60 2.40 MTB > gstd MTB > histo c1 Histogram of C1 N = 50 Midpoint Count -2.0 1 * -1.5 3 *** -1.0 6 ****** -0.5 10 ********** 0.0 11 *********** 0.5 10 ********** 1.0 4 **** 1.5 3 *** 2.0 1 * 2.5 1 * ***************************************************************** MTB > random 60 c2; SUBC> bernoulli .5. generates a sequence of 50 numbers from {0,1} It is like to throw a coin 60 times MTB > print c2 C2 0 1 0 1 1 1 1 1 0 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 1 0 1 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 ***************************************************************** MTB > random 80 c3; SUBC> integer 1 6. generates a sequence of 80 numbers from {1,2,3,4,5,6} It is like to throw a die 80 times MTB > print c3 C3 4 3 4 1 5 2 5 1 6 6 1 2 2 5 5 1 3 1 4 2 5 5 6 6 4 6 6 4 6 6 6 4 5 4 6 4 3 5 1 1 1 3 3 5 6 2 1 1 3 6 2 3 3 4 4 3 6 1 5 6 1 5 4 3 6 1 3 4 5 2 1 2 5 1 3 6 3 6 4 4 ***************************************************************** Next, we generate a random sequence consisting of values which have two components: a fixed component and a random component MTB > set c4 DATA > 1:50 DATA > end MTB > let c5=8+(c4/2) MTB > random 50 c6; SUBC> uniform -2 2. MTB > let c7=c5+c6 MTB >plot c7*c4 ******************************************************************* First, we enter some data in c8 MTB > set c8 DATA > 2(9) 3(8) 3(7) 4(6) 2(5) 2(4) 3(3) 2(2) 4(1) 5(0) DATA > end MTB > sample 10 c8 c9; SUBC> replace. generates 10 values with replacement from c8 MTB > print c9 C9 8 0 9 6 1 2 6 6 0 9 MTB >sample 20 c8 c10 generates 20 values with replacement from c8 MTB > print c10 C10 8 6 6 1 7 7 3 7 9 0 1 4 1 9 3 0 0 2 0 0 ********************************************* Next, we choose two random columns. Assuming that the two sequences should have mean zero, c12 is more accurate, but c11 is more precise. Note that the mean the c12 is -0.023 and the mean of c11 is 0.860. Looking to the graphs we also see that c12 is varying around 0, but c11 is varying around something else. The standard deviation of the c12 is 1.710 and that of c11 is 1.167. Looking to the graphs also notice that c12 is varying more. MTB > random 60 c11; SUBC> unif -1 3. MTB > random 60 c12; SUBC> unif -3 3. MTB > gstd MTB > desc c11 c12 N MEAN MEDIAN TRMEAN STDEV SEMEAN C11 60 0.860 0.884 0.853 1.167 0.151 C12 60 -0.023 -0.022 -0.035 1.710 0.221 MIN MAX Q1 Q3 C11 -0.931 2.746 -0.315 1.772 C12 -2.751 2.931 -1.431 1.494 MTB > histo c11 c12; SUBC> same. Histogram of C11 N = 60 Midpoint Count -3.0 0 -2.5 0 -2.0 0 -1.5 0 -1.0 6 ****** -0.5 10 ********** 0.0 5 ***** 0.5 8 ******** 1.0 6 ****** 1.5 9 ********* 2.0 4 **** 2.5 12 ************ 3.0 0 Histogram of C12 N = 60 Midpoint Count -3.0 1 * -2.5 7 ******* -2.0 3 *** -1.5 7 ******* -1.0 5 ***** -0.5 5 ***** 0.0 5 ***** 0.5 5 ***** 1.0 6 ****** 1.5 4 **** 2.0 6 ****** 2.5 2 ** 3.0 4 **** MTB > dotplot c11 c12; SUBC> same. : ..... . :. : .::::: :..:.::... :::::: .:::.: -------+---------+---------+---------+---------+---------C11 . . . :: .:.. .:.:.:... :....:..:..::: . .: ::.. ::: -------+---------+---------+---------+---------+---------C12 -2.4 -1.2 0.0 1.2 2.4 3.6 ******************************************************************* The following program assigns randomly grades to the class: ****** read c1; tab. Students CATALIOTTI, JOSEPH CHA, YE-JIN DIPIETRO, LAURA DUVALL, LEE EDWARDS, HUGH GREENHUT, MICHAEL HSIEH, MON-RU KARAMITSOS, IVANA KARAS, CHRISTOPHER KLARFELD, GUY KLEIN, AARON LEHMANN, CHRISTOPHER LING, TIFFANY LUI, GALE MACLENNAN, ERIC PARDES, DANIEL POLAK, GEORGE ROSENBERG, BRAD ROYT, SERGEY SCHECTER, HOWARD SHIN, DONG SIEFFERT, MICHAEL SINOVCIC, ROKO SNITKIN, EVAN SOLOMON, JOSH VAIS, PERRY VALITES, MATTHEW C WALDRON, JEFFREY J WONG, JEFFREY WU, RONGBO end name c2 'grades' set c11 2(9) 3(8) 3(7) 4(6) 2(5) 2(4) 3(3) 2(2) 4(1) 5(0) end NOTE In total NOTE 2 A, 3 A-, 3 B+, 4 B, 2 B-, 2 C+, 3 C, 2 C-, 4 D, 5 F NOTE are assigned randomly to the 30 students in the class. NOTE sample 30 c11 c12 set c81 9 8 7 6 5 4 3 2 1 0 end read c82; tab. X A A- B+ B B- C+ C C- D F end CONVERT table in C81 C82, convert c12 to c2 print c1-c2 end ******************************************************************* You should create a file with the previous commands, then run this file MTB > run 'file'

Comments to: Miguel A. Arcones