*=====================================================================. *HOME COMPUTER Syntax for Lab 2 of Quantitative Methods 1. *10 Oct 05, v8. *=====================================================================. *NB: it is assumed in this file that you are using your own PC (as opposed to a lab PC ) . *It is also assumed that you have placed the main data files (available from the Teaching page of www.gwilympryce.co.uk) . *in a folder called C:\STATISTICS, . *and that you have placed the one.sav data file (also available from the Teaching page of www.gwilympryce.co.uk) *needed for the macros in a folder called C:\QUANTS. *If the files have been placed in an alternative folder, you will need to change the syntax below accordingly. ********************************************* NOTE *******************************************************. *** The macro programs needed for the commands used in this lab are pasted at the end of this file ****. ********************************************* NOTE *******************************************************. *=====================================================================. 2.2.1 Examples 3.2.1a, b, c, d Calculate the Probability that z is less than zi (Pryce, p. 3-3) *=====================================================================. *In each of the exercises below, first draw a diagram to help you understand the problem. *=====================================================================. *Example 3.2.1(a) Calculate the probability that z is less than –3.4 *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *1. first draw the diagram. *2. open a new, blank dataset. *3. type the number one in the first cell of that data sheet and hit return * (we do this only because SPSS won't allow you to run any commands without having a dataset open). *4. Now make use of the CDFNORM function in SPSS which computes the probability that z is less than the value you put in brackets. COMPUTE probz = CDFNORM(-3.4) . EXECUTE . * Run this syntax, then go to the data window where you will see that you have calculated a new variable called "probz" . *You can increase the number of decimal places using the FORMATS command. *This sets the overall width of a variable as it appears in the data sheet window. *It also sets the number of decimal places. *The format is determined by the code entered in brackets, such as "(F5.4)". *F denotes the format type (numeric), "5" represents the variable width, and "4" represents the number of decimal places. *If we want our variable X to have width = 6, and 2 decimal places, we enter FORMATS X (F6.2). *Suppose in this case, we want "probz" to have width 5, and 4 decimal places. We use F5.4 is entered in the brackets. *Assuming you have at least one cell of data in your Data View window, the following syntax should achieve the desired result. COMPUTE probz = CDFNORM(–3.4). FORMATS probz (F5.4). EXECUTE. *So we can say Pr(z < –3.4) = 0.0003, which is a very small probability indeed (there is less than a tenth of 1 percent chance that z will be less than –3.4). *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. *Make sure the macros are installed (the lab tutors will show you how to do this on the lab computers). *Then type the following command: pz_lt_zi (-3.4) . *which should result in the following output: *Prob(z < zi) for a given zi . * zi Prob . * -3.40000 .00034 . *=====================================================================. *Example 3.2.1(b) Calculate the probability that z is less than –1.23. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *1. first draw the diagram. *2. open a new, blank dataset. *3. type the number one in the first cell of that data sheet and hit return * (we do this only because SPSS won't allow you to run any commands without having a dataset open). *4. Now make use of the CDFNORM function in SPSS which computes the probability that z is less than the value you put in brackets. COMPUTE probz = CDFNORM(-1.23) . FORMATS probz (F5.4). EXECUTE . *So we can say Pr(z < –1.23) = 0.1093. *-----------------------------------------------------. *Answer (using macro commands): *-----------------------------------------------------. *Type the following command:. pz_lt_zi (-1.23) . *which should result in the following output:. *Prob(z < zi) for a given zi . * zi Prob . * -1.23000 .10935 . *=====================================================================. *Example 3.2.1(c) Calculate the probability that z is greater than 2.34. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *Pr(z > 2.34) = 1 - Pr(z<2.34), so we need to compute "1- CDFNORM(2.34) " COMPUTE probz = 1 - CDFNORM(2.34) . FORMATS probz (F5.4). EXECUTE . *So we can say Pr(z > 2.34) = 1 - Pr(z<2.34) = .0096. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. *Type the following command: pz_gt_zi (2.34) . *which should result in the following output: *Prob(z > zi) for a given zi . * zi Prob . * 2.34000 .00964 . *=====================================================================. *Example 3.2.1(d) Calculate the probability that z lies between –1.96 and 1.96. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = 1-(2*CDFNORM(-1.96)) . FORMATS probz (F5.4). EXECUTE . *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(-1.96) ziu=(1.96). * Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * -1.96000 1.96000 .95000 . *=====================================================================. 2.2.2 Example 3.2.2 Find Pr(z<-0.95) using CDFNORM (Pryce, p. 3-4). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = CDFNORM(-0.95). FORMATS probz (F5.4). EXECUTE . *The values of your probz variable should now all equal 0.1711. In other words, the probability that z is less than –0.95 equals 0.1711, or 17.11%. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_lt_zi (-0.95). * Prob(z < zi) for a given zi . * zi Prob . * -.95000 .17106 . *=====================================================================. *=====================================================================. 2.2.3 Exercise 3.2 Calculate the probabilities associated with z-scores (Pryce, p.3-6) *=====================================================================. *=====================================================================. *Find the proportion of z-scores that are less than 1.8. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = CDFNORM(1.8). FORMATS probz (F5.4). EXECUTE . *Pr(z < 1.8) = 0.9641. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_lt_zi (1.8). * Prob(z < zi) for a given zi . * zi Prob . * 1.80000 .96407 . *=====================================================================. *Find the proportion of z-scores that are less than 3. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = CDFNORM(3). FORMATS probz (F5.4). EXECUTE . *Pr(z < 3) = .9987 *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_lt_zi (3). * Prob(z < zi) for a given zi . * zi Prob . * 3.00000 .99865 . *=====================================================================. *Find the probability that z is less than 2. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = CDFNORM(2). FORMATS probz (F5.4). EXECUTE . *Pr(z < 2) = .97725 *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_lt_zi (2). * Prob(z < zi) for a given zi . * zi Prob . * 2.00000 .97725 . *=====================================================================. *=====================================================================. *Find the following probabilities using the standard normal table:. *=====================================================================. *NB for each question you should draw the z-curve diagram associated with the problem before proceeding. *=====================================================================. *Prob(0 < z < 1.87) i.e. the probability that z lies between 0 and 1.87. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = 0.5-(CDFNORM(-1.87)). FORMATS probz (F5.4). EXECUTE . *Prob(0 < z < 1.87) = .4693. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(0) ziu=(1.87). * Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * .00000 1.87000 .46926 . *=====================================================================. *Prob(–1.11 < z < 0) i.e. the probability that z lies between –1.11 and 0. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = 0.5-(CDFNORM(-1.11)). FORMATS probz (F5.4). EXECUTE . *Prob(–1.11 < z < 0) = .3665. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(-1.11) ziu=(0). * Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * -1.11000 .00000 .36650 . *=====================================================================. *Prob(–1.18 < z < 0) *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = 0.5-(CDFNORM(-1.18)). FORMATS probz (F5.4). EXECUTE . *Prob(–1.18 < z < 0) = .3810. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(-1.18) ziu=(0). *Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * -1.18000 .00000 .38100 . *=====================================================================. *Prob(–1.26 <= z < 2.11) *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *Because z is a continuous variable, Pr(z=-1.26) = 0. Therefore, Pr(–1.26 <= z < 2.11) = Pr(–1.26 = z < 2.11). COMPUTE probz = (0.5-(CDFNORM(-1.26))) + (0.5-(CDFNORM(-2.11))) . FORMATS probz (F5.4). EXECUTE . *Pr(–1.26 <= z < 2.11) = Pr(–1.26 = z < 2.11) = .8787. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(-1.26) ziu=(2.11). *Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * -1.26000 2.11000 .87874 . *=====================================================================. *Prob(–2.06 < z <= 0.63). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *Because z is a continuous variable, Pr(z=0.63) = 0. Therefore, Prob(–2.06 < z <= 0.63) = Prob(–2.06 < z < 0.63). COMPUTE probz = (0.5-(CDFNORM(-2.06))) + (0.5-(CDFNORM(-0.63))) . FORMATS probz (F5.4). EXECUTE . *Prob(–2.06 < z <= 0.63) = Prob(–2.06 < z < 0.63) = .7160. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(-2.06) ziu=(0.63). * Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * -2.06000 .63000 .71595 . *=====================================================================. *Prob(z >= 1.47). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *Because z is a continuous variable, Pr(z=1.47) = 0. Therefore, Prob(z >= 1.47) = Prob(z > 1.47). *And we already know that Prob(z > 1.47) = Prob(z < -1.47) . COMPUTE probz = CDFNORM(-1.47) . FORMATS probz (F5.4). EXECUTE . *Prob(z >= 1.47) = Prob(z > 1.47) = Prob(z < -1.47) = .0708. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gt_zi (1.47). * Prob(z > zi) for a given zi . * zi Prob . * 1.47000 .07078 . *=====================================================================. *Prob(z < 2.05). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = CDFNORM(2.05) . FORMATS probz (F5.4). EXECUTE . *Prob(z < 2.05) = .9798. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_lt_zi (2.05). * Prob(z < zi) for a given zi . * zi Prob . * 2.05000 .97982 . *=====================================================================. *Prob(z < –0.99). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = CDFNORM(-.99) . FORMATS probz (F5.4). EXECUTE . *Prob(z < -.99) = .1611. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_lt_zi (-0.99). * Prob(z < zi) for a given zi . * zi Prob . * -.99000 .16109 . *=====================================================================. *Prob(z > –1.05). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = 1 - CDFNORM(-1.05) . FORMATS probz (F5.4). EXECUTE . *Prob(z < -1.05) = .8531. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gt_zi (-1.05). * Prob(z > zi) for a given zi . * zi Prob . * -1.05000 .85314 . *=====================================================================. *Prob(0.86 <= z <= 1.72). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *Because z is a continuous variable, Prob(0.86 <= z <= 1.72) = Prob(0.86 < z < 1.72). *If you sketch the z-distribution & the required shaded area you will see that Prob(0.86 < z < 1.72) = Prob(z < 1.72) - Prob(z<0.86) . COMPUTE probz = (CDFNORM(1.72)) - (CDFNORM(0.86)) . FORMATS probz (F5.4). EXECUTE . *Prob(0.86 < z < 1.72) = Prob(z < 1.72) - Prob(z<0.86) = .1522. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(.86) ziu=(1.72). * Prob(ziL < z < ziU) for a given zi * ziL ziU Prob * .86000 1.72000 .15218 *=====================================================================. *Prob(z < 1.58). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = CDFNORM(1.58) . FORMATS probz (F5.4). EXECUTE . *Prob(z < 1.58) = .9429. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_lt_zi (1.58). * Prob(z < zi) for a given zi . * zi Prob . * 1.58000 .94295 . *=====================================================================. *Prob(–1.96 < z < –1.28). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *If you sketch the z-distribution & the required shaded area you will see that Prob(–1.96 < z < –1.28) = Prob(z < -1.28) - Prob(z<-1.96) . COMPUTE probz = (CDFNORM(-1.28)) - (CDFNORM(-1.96)) . FORMATS probz (F5.4). EXECUTE . *Prob(–1.96 < z < –1.28) = Prob(z < -1.28) - Prob(z<-1.96) = .0753. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(-1.96) ziu=(-1.28). * Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * -1.96000 -1.28000 .07527 . *=====================================================================. *Prob(0 < z < 1.83). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE probz = (CDFNORM(1.83)) - 0.5. FORMATS probz (F5.4). EXECUTE . *Prob(0 < z < 1.83) = .4664. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(0) ziu=(1.83). * Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * .00000 1.83000 .46638 . *=====================================================================. *Prob(–2.08 < z < 0.63). *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *If you sketch the z-distribution & the required shaded area you will see that Prob(–2.08 < z < 0.63) = Prob(z < 0.63) - Prob(z < -2.08) . COMPUTE probz = (CDFNORM(.63)) - (CDFNORM(-2.08)) . FORMATS probz (F5.4). EXECUTE . *Prob(–2.08 < z < 0.63) = Prob(z < 0.63) - Prob(z < -2.08) = .7169. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. pz_gl_zi zil=(-2.08) ziu=(0.63). * Prob(ziL < z < ziU) for a given zi . * ziL ziU Prob . * -2.08000 .63000 .71689 . *=====================================================================. *=====================================================================. *2.2.4 Exercise 3.2.5 Find the values of z associated with given probabilities (Pryce, p. 3-13). *=====================================================================. *=====================================================================. *a. Find a value zi such that: Prob(z >= zi) = 0.06 i.e. the probability that z is greater or equal to zi is 0.06. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *Because z is a continuous variable, Prob(z = zi) = 0, and so Prob(z >= zi) = 0.06 = Prob(z > zi) = 0.06 . *The PROBIT(?) function returns the value of zi associated with the lower tail probability entered in the brackets. COMPUTE zi_from_prob = PROBIT(.06) . EXECUTE . *Prob(z >= zi) = Prob(z< -zi) = 0.06 = Prob(z < -1.55) . *So zi = 1.55. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. zi_gt_zp p=(0.06). * Value of zi such that Prob(z > zi) = PROB when PROB is given . * zi PROB . * 1.55477 .06000 . *=====================================================================. *b. Find a value zi such that: Prob(z > zi) = 0.95. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *If Prob(z > zi) = 0.95, then Prob(z < zi) = 0.05. COMPUTE zi_from_prob = PROBIT(.05) . EXECUTE . *zi = -1.64. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. zi_gt_zp p=(0.95). * Value of zi such that Prob(z > zi) = PROB when PROB is given . * zi PROB . * -1.64485 .95000 . *=====================================================================. *c. Find a value zi such that: Prob(z < zi) = 0.80. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. COMPUTE zi_from_prob = PROBIT(.8) . EXECUTE . *zi = .84. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. zi_lt_zp p=(0.8). * Value of zi such that Prob(z < zi) = PROB when PROB is given . * zi PROB . * .84162 .80000 . *=====================================================================. *Find zi such that 95% of z-scores are above zi. That is, Prob(z > zi) = 95%. *=====================================================================. *% are just another way of writing probabilities, so this question is the same as b. above. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *If Prob(z > zi) = 0.95, then Prob(z < zi) = 0.05. COMPUTE zi_from_prob = PROBIT(.05) . EXECUTE . *zi = -1.64. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. zi_gt_zp p=(0.95). * Value of zi such that Prob(z > zi) = PROB when PROB is given . * zi PROB . * -1.64485 .95000 . *=====================================================================. *Find zi such that Prob(–zi < z < zi) = 95%. *=====================================================================. *-----------------------------------------------------. *Answer (using SPSS rather than the tables):. *-----------------------------------------------------. *Because of the symmetry of hte distribution, if Prob(–zi < z < zi) = 95% then Prob(z < -zi) = 2.5%. *So we need to find the zi value associated with the lower tail area of 0.025. COMPUTE zi_from_prob = PROBIT(.025) . EXECUTE . *zi = -1.96. *-----------------------------------------------------. *Answer (using macro commands):. *-----------------------------------------------------. zi_gl_zp p=(0.95) . * Value of zi such that Prob(-zi < z < zi) = PROB, when PROB is given . * ziL ziU Prob . * -1.95996 1.95996 .95000 . *=====================================================================. *End of exercises. *=====================================================================. *#############################################################################. *#############################################################################. *#############################################################################. *#############################################################################. *#############################################################################. *#############################################################################. *=====================================================================. *Macro Programs. *=====================================================================. *If these macros have not already been installed on the lab machines, simply highlight all the programs below. *Then run them as one command by pressing CTRL+R. *You will then be able to use macro commands . *---- Highlight from the start of this line... -------------------------------------------. DEFINE pz_lt_zi (!POSITIONAL !ENCLOSE('(',')')). GET FILE='C:\QUANTS\one.sav'. compute Zi_Var = !1 . COMPUTE PROB = CDFNORM(Zi_Var). execute. MATRIX. GET PROB_VAR /VARIABLES = PROB. GET Zi_Var /VARIABLES = Zi_Var. COMPUTE Prob = PROB_VAR(1). COMPUTE zi = Zi_Var(1). COMPUTE ANSWER = {zi, PROB}. PRINT ANSWER / FORMAT "F10.5" /Title = " Prob(z < zi) for a given zi " / CLABELS = zi, Prob. END MATRIX. !ENDDEFINE. DEFINE pz_gt_zi (!POSITIONAL !ENCLOSE('(',')')). GET FILE='C:\QUANTS\one.sav'. compute Zi_Var = !1 . COMPUTE PROB = 1 - CDFNORM(Zi_Var). execute. MATRIX. GET PROB_VAR /VARIABLES = PROB. GET Zi_Var /VARIABLES = Zi_Var. COMPUTE Prob = PROB_VAR(1). COMPUTE zi = Zi_Var(1). COMPUTE ANSWER = {zi, PROB}. PRINT ANSWER / FORMAT "F10.5" /Title = " Prob(z > zi) for a given zi " / CLABELS = zi, Prob. END MATRIX. !ENDDEFINE. DEFINE pz_lg_zi (zil = !ENCLOSE('(',')') / ziu = !ENCLOSE('(',')')). GET FILE='C:\QUANTS\one.sav'. compute ZiL_Var = !zil . compute ZiU_Var = !ziu . execute. COMPUTE PROBL = CDFNORM(ZiL_Var). COMPUTE PROBU = 1 - CDFNORM(ZiU_Var). COMPUTE PROBLG = PROBL + PROBU. execute. MATRIX. GET PROB_VAR /VARIABLES = PROBLG. GET ZiL_Var /VARIABLES = ZiL_Var. GET ZiU_Var /VARIABLES = ZiU_Var. COMPUTE Prob = PROB_VAR(1). COMPUTE ziL = ZiL_Var(1). COMPUTE ziU = ZiU_Var(1). COMPUTE ANSWER = {ziL, ziU, PROB}. PRINT ANSWER / FORMAT "F10.5" /Title = " Prob((z < ziL) OR (z > ziU)) for a given zi " / CLABELS = ziL, ziU, Prob. END MATRIX. !ENDDEFINE. DEFINE pz_gl_zi (zil = !ENCLOSE ('(',')') / ziu = !ENCLOSE('(',')')). GET FILE='C:\QUANTS\one.sav'. compute ZiL_Var = !zil . compute ZiU_Var = !ziu . execute. COMPUTE PROBL = CDFNORM(ZiL_Var). COMPUTE PROBU = 1 - CDFNORM(ZiU_Var). COMPUTE PROBLG = 1 - (PROBL + PROBU). execute. MATRIX. GET PROB_VAR /VARIABLES = PROBLG. GET ZiL_Var /VARIABLES = ZiL_Var. GET ZiU_Var /VARIABLES = ZiU_Var. COMPUTE Prob = PROB_VAR(1). COMPUTE ziL = ZiL_Var(1). COMPUTE ziU = ZiU_Var(1). COMPUTE ANSWER = {ziL, ziU, PROB}. PRINT ANSWER / FORMAT "F10.5" /Title = " Prob(ziL < z < ziU) for a given zi " / CLABELS = ziL, ziU, Prob. END MATRIX. !ENDDEFINE. DEFINE zi_lt_zp (p = !ENCLOSE('(',')')). GET FILE='C:\QUANTS\one.sav'. COMPUTE Zi = PROBIT(!p). EXECUTE. MATRIX. GET Zi_VAR /VARIABLES = Zi. COMPUTE Zi = Zi_VAR(1). COMPUTE PROB= {!p}. /*Enter the given probability into the curly brackets*/ COMPUTE ANSWER = {Zi, PROB}. PRINT ANSWER / FORMAT "F10.5" /Title = " Value of zi such that Prob(z < zi) = PROB when PROB is given" / CLABELS = zi, PROB. END MATRIX. !END DEFINE. DEFINE zi_gt_zp (p = !ENCLOSE('(',')')). GET FILE='C:\QUANTS\one.sav'. COMPUTE Zi = PROBIT(1-!p). EXECUTE. MATRIX. GET Zi_VAR /VARIABLES = Zi. COMPUTE Zi = Zi_VAR(1). COMPUTE PROB= {!p}. /*Enter the given probability into the curly brackets*/ COMPUTE ANSWER = {Zi, PROB}. PRINT ANSWER / FORMAT "F10.5" /Title = " Value of zi such that Prob(z > zi) = PROB when PROB is given" / CLABELS = zi, PROB. END MATRIX. !END DEFINE. DEFINE zi_gl_zp (p = !ENCLOSE('(',')')). GET FILE='C:\QUANTS\one.sav'. COMPUTE PROB = !p. COMPUTE PROBLG = 1 - !p. COMPUTE PROBL = PROBLG / 2. COMPUTE ZiL_Var = PROBIT(PROBL). COMPUTE ZiU_Var = -1 * ZiL_Var . execute. MATRIX. GET PROB_VAR /VARIABLES = PROB. GET ZiL_Var /VARIABLES = ZiL_Var. GET ZiU_Var /VARIABLES = ZiU_Var. COMPUTE Prob = PROB_VAR(1). COMPUTE ziL = ZiL_Var(1). COMPUTE ziU = ZiU_Var(1). COMPUTE ANSWER = {ziL, ziU, PROB}. PRINT ANSWER / FORMAT "F10.5" /Title = " Value of zi such that Prob(-zi < z < zi) = PROB, when PROB is given " / CLABELS = ziL, ziU, Prob. END MATRIX. !ENDDEFINE. *---- ... to the end of this line -------------------------------------------------------.