*=====================================================================. *LAB COMPUTER Syntax for Lab 3 of Quantitative Methods 1. *17 Oct 05, v4. *=====================================================================. ********************************************* NOTE *******************************************************. *** The macro programs needed for the commands used in this lab are pasted at the end of this file ****. ********************************************* NOTE *******************************************************. *=====================================================================. *3.2.1 Exercise 4.2 Large Sample Confidence Interval for One Mean (Pryce, p.4-3). *=====================================================================. *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 . *=====================================================================. *3.2.2 Exercise 4.2.1 The Three Steps of CIs (Pryce, p. 4-4). *=====================================================================. *Suppose you are interested in the disappearance of thousands of civil servants and other workers during Joseph Stalin’s Great Purge in Soviet Russia 1936-38. *One of the questions you are interested in is the average age of the workers when they disappeared. *Your thesis is that Stalin felt most threatened by older, more established ‘enemies’, and so you anticipate their average age to be over 50. *Unfortunately, you only have access to 506 records on the age of individuals when they disappeared. *You have calculated the average age in this sample to be 56.2 years, which would appear to confirm your thesis. *The standard deviation of your sample was found to be 14.7 years. *Assuming that your 506 records constitute a random sample from the population of those who disappeared (a questionable assumption?), . *calculate the 95% confidence interval for the population mean age. *Does your expected value for the population average age fall below the interval? . *Compute also the 99% confidence interval and reconsider whether your . *theorised average age still falls below the range of possible values for the population mean. *---------------------------------. *Answer:. *---------------------------------. *Step 1: Choose the appropriate formula and decide on the level of confidence. *We want to estimate the interval for a population mean given that we have a large. *sample, so the formula is: . *. *m=xbar +/- z*(s/sqrt(n)). * . *Confidence level has been specified as 95%. *. *Step 2: Find the value for z* such that Prob(–z* < z < z*) = 95%. *We find this by first identifying the middle 95% of the z-distribution:. 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 . *. *Step 3: Calculate the confidence interval. * m = xbar +/- z*(s/sqrt(n)). * = 56.2 +/- 1.96 14.7/(sqrt(506)). * = 65.2 +/- 1.281. *. *I.e. we are 95% certain that the population age of missing workers was between 54.92 years and 57.481 years. *---------------------------------. *Answer using the CI_L1M macro:. *---------------------------------. CI_L1M n = (506) x_bar = (56.2) s = (14.7) c = (0.95). *Large sample confidence interval for the population mean. * N X_BAR ZIL SE ERR LOWER UPPER. * 506.00000 56.20000 -1.95996 .65349 1.28083 54.91917 57.48083. *The figures under the LOWER and UPPER column headings are the results we are most . *interested in since they define the confidence interval for the population mean and verify . *our earlier calculation. *(ii) 99% confidence interval. CI_L1M n = (506) x_bar = (56.2) s = (14.7) c = (0.99). *we can see from the output below that the confidence interval has widened slightly. We . *can be 99% certain that the population age of missing workers was between 54.517 years . *and 57.883 years. Note that this interval for the population mean is clearly above our . *guesstimate of the population mean of 50 years. *. *Large sample confidence interval for the population mean. * N X_BAR ZIL SE ERR LOWER UPPER. * 506.00000 56.20000 -2.57583 .65349 1.68329 54.51671 57.88329. *. *=====================================================================. *3.2.3 Exercise 4.2.1 Calculating the Confidence Interval for the Mean. *=====================================================================. *In the following questions, work out the solution by hand and then run the syntax to check your results:. *=====================================================================. *1. Repossessions in the Great Depression in Scotland. *=====================================================================. *As an economic historian, you are interested in the average age of the heads of household . *who had their homes repossessed in Scotland during the Great Depression. *Records are kept at local sheriff court archives, and from an examination of a sample of 200 records from across Scotland, . *you find that the average age of head of household was 34.5 years with standard deviation of 20 years. *What is the 90% confidence interval for the mean age? . CI_L1M n = (200) x_bar = (34.5) s = (20) c = (0.90). *Large sample confidence interval for the population mean. * N X_BAR ZIL SE ERR LOWER UPPER. * 200.00000 34.50000 -1.64485 1.41421 2.32617 32.17383 36.82617. *=====================================================================. *2. Fat nurses, thin nurses. *=====================================================================. *For your dissertation, you interview 78 nurses and ask them their weight. *The average weight within your sample turns out to be 70kg with a standard deviation of 20kg. *What is the 95% confidence interval for the mean weight of all nurses?. CI_L1M n=(78) x_bar=(70) s=(20) c=(.95). *Large sample confidence interval for the population mean. * n x_bar ZiL SE err Lower Upper. * 78.00000 70.00000 -1.95996 2.26455 4.43844 65.56156 74.43844. *=====================================================================. *3. Government Advice on Sexual Health . *=====================================================================. *For your dissertation, you interview 90 teenage girls, randomly selected from across Glasgow . *about how they would rate the Government’s sexual health advice service. *You find that, on an ascending scale of zero to 100, the average rating given is 45.3 with a standard deviation of 35.2. *What is the 99% confidence interval for the mean rating of official sexual health advice by all Glaswegian teenage girls?. CI_L1M n = (90) x_bar = (45.3) s = (35.2) c = (0.99). *Large sample confidence interval for the population mean. * n x_bar ZiL SE err Lower Upper. * 90.00000 45.30000 -2.57583 3.71041 9.55737 35.74263 54.85737. *=====================================================================. *4. Amputee Recovery Time. *=====================================================================. *As an Occupational Therapist, you are interested in how long it takes amputees to recover from their operation . *and reach a reasonable level of proficiency with their prosthetic replacement. *You decide to take a sample of 150 amputees and find an average recovery time of 97.5 days, with a standard deviation of 60. *What is the 90% confidence interval for the population mean recovery time?. CI_L1M n = (150) x_bar = (97.5) s = (60) c = (0.90). *Large sample confidence interval for the population mean . * n x_bar ZiL SE err Lower Upper. * 150.00000 97.50000 -1.64485 4.89898 8.05810 89.44190 105.55810. *=====================================================================. *5. Exposure to Toxic Substances. *=====================================================================. *For your dissertation you attempt to estimate the exposure to toxic substances of workers in the chemical industry in the post war period. *You have examined a random sample of 354 records from the archives of random medical tests from a range of firms from that period. *This sample has been provided by the industry with a press release stating that the average exposure score is 194.35. *The government had previously stated that retrospective collective compensation claims from workers could only proceed . *if there was evidence that the average exposure of all workers in the industry exceeded the threshold of 200 set down in European health and safety legislation. *You examine the dataset and calculate the standard deviation of the sample scores to be 142.98. *Do you think the compensation claim has grounds to proceed?. CI_L1M n = (354) x_bar = (194.35) s = (142.98) c = (0.99). *Large sample confidence interval for the population mean . * n x_bar ZiL SE err Lower Upper. * 354.00000 194.35000 -2.57583 7.59930 19.57450 174.77550 213.92450. *=====================================================================. *=====================================================================. *3.2.4 Exercise 4.3 Computing Small Sample CIs (Pryce, p. 4-13). *=====================================================================. *=====================================================================. *1. Average Survival Time of WWI Soldiers. *=====================================================================. *As a war historian, you are interested in the average survival time of soldiers on the front line in the First World War. *There are over 1,000 records available for examination at the Ministry of Defence, . *but because of the considerable time and cost of accessing these records, . *you decide to examine a random sample of just 16 records. *Your sample reveals an average of 18.7 weeks, with a standard deviation of 2.8 weeks. *Find the 90% confidence interval estimate of the mean survival time of all soldiers on the front line. CI_S1M n = (16) x_bar = (18.7) s = (2.8) c = (0.90). *Small sample confidence interval for the population mean. * n x_bar TiL SE err Lower Upper. * 16.00000 18.70000 -1.75305 .70000 1.22714 17.47286 19.92714. *=====================================================================. *2. Prevalence of American Pronunciation. *=====================================================================. *For your PhD, you want to estimate the number of times an American phrase or pronunciation occurs . *in a typical 5 minute conversation between teenage youths in Liverpool. *Because of the time taken to build up sufficient rapport with such youths for them to speak in a relaxed and typical way, . *you only manage to observe 23 such conversations. *The average number of Americanisms in 5 minute conversations amongst your small sample is 137.71, with a standard deviation of 69.56. *What is the 95% confidence interval of the average incidence of Americanisms for all youths in Liverpool?. CI_S1M n = (23) x_bar = (137.71) s = (69.56) c = (0.95). *Small sample confidence interval for the population mean. * n x_bar TiL SE err Lower Upper. * 23.00000 137.71000 -2.07387 14.50426 30.08000 107.63000 167.79000. *=====================================================================. *3. Political Perspectives of Students. *=====================================================================. *As a political scientist you have been researching the political perspectives of students from working class backgrounds. *You have surveyed 36 students, asking them to rate on an ascending scale of 0 to 100 *their preference for the public ownership of the means of production. *The average rating in your sample is 59.75 with a standard deviation of 42.93. *What can you say from your small sample about the political perspectives of working class students as whole?. CI_S1M n = (36) x_bar = (59.75) s = (42.93) c = (0.95). *Small sample confidence interval for the population mean. * n x_bar TiL SE err Lower Upper. * 36.00000 59.75000 -2.03011 7.15500 14.52542 45.22458 74.27542. *=====================================================================. *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='Q:\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='Q:\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='Q:\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='Q:\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='Q:\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='Q:\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='Q:\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. DEFINE CI_L1M (n = !ENCLOSE('(',')') /x_bar = !ENCLOSE('(',')') /s = !ENCLOSE('(',')') /c = !ENCLOSE('(',')')). GET FILE='Q:\QUANTS\one.sav'. COMPUTE PROB = !c. COMPUTE PROBLG = 1 - !c. COMPUTE PROBL = PROBLG / 2. COMPUTE ZiL = PROBIT(PROBL). COMPUTE ZiU = -1 * ZiL . execute. MATRIX. COMPUTE n = {!n}. /* Enter the sample size here (i.e. change the number in curly brackets)*/ COMPUTE x_bar = {!x_bar}. /* Enter the sample mean here*/ COMPUTE s = {!s}. /* Enter the sample standard deviation here*/ COMPUTE SE = s/SQRT(n). GET ZiL /VARIABLES = ZiL. COMPUTE ERR = -ZiL * SE. COMPUTE LOWER = x_bar - err. COMPUTE UPPER = x_bar + err. COMPUTE ANSWER = {n, x_bar, ZiL, SE, err, Lower, Upper}. PRINT ANSWER / FORMAT "F10.5" /Title = "Large sample confidence interval for the population mean" / CLABELS = n, x_bar, ZiL, SE, err, Lower, Upper. END MATRIX. !END DEFINE. DEFINE CI_S1M (n = !ENCLOSE('(',')') /x_bar = !ENCLOSE('(',')') /s = !ENCLOSE('(',')') /c = !ENCLOSE('(',')')). GET FILE='Q:\QUANTS\one.sav'. COMPUTE df = !n - 1. COMPUTE PROB = !c. COMPUTE PROBLG = 1 - !c. COMPUTE PROBL = PROBLG / 2. COMPUTE TiL = IDF.T(PROBL, df). COMPUTE TiU = -1 * TiL . execute. MATRIX. COMPUTE n = {!n}. /* Enter the sample size here (i.e. change the number in curly brackets)*/ COMPUTE x_bar = {!x_bar}. /* Enter the sample mean here*/ COMPUTE s = {!s}. /* Enter the sample standard deviation here*/ COMPUTE SE = s/SQRT(n). GET TiL /VARIABLES = TiL. GET df /VARIABLES = df. COMPUTE ERR = -TiL * SE. COMPUTE LOWER = x_bar - err. COMPUTE UPPER = x_bar + err. COMPUTE ANSWER = {n, x_bar, TiL, SE, err, Lower, Upper}. PRINT ANSWER / FORMAT "F10.5" /Title = "Small sample confidence interval for the population mean" / CLABELS = n, x_bar, TiL, SE, err, Lower, Upper. END MATRIX. !END DEFINE. DEFINE CI_S2Mp (n1 = !ENCLOSE('(',')') /n2 = !ENCLOSE('(',')') /x_bar1 = !ENCLOSE('(',')') /x_bar2 = !ENCLOSE('(',')') /s1 = !ENCLOSE('(',')') /s2 = !ENCLOSE('(',')') /c = !ENCLOSE('(',')')). GET FILE='Q:\QUANTS\one.sav'. COMPUTE df = !n1 + !n2 - 2. COMPUTE PROB = !c. COMPUTE PROBLG = 1 - !c. COMPUTE PROBL = PROBLG / 2. COMPUTE TiL = IDF.T(PROBL, df). COMPUTE TiU = -1 * TiL . execute. MATRIX. GET df / variables = df. /* Enter the df here (i.e. change the number in curly brackets)*/ COMPUTE x_bar1 = {!x_bar1}. /* Enter the sample mean here*/ COMPUTE x_bar2 = {!x_bar2}. /* Enter the sample mean here*/ COMPUTE sp = SQRT(( (!n1 - 1)* !s1**2 + (!n2 - 1) * !s2**2 ) / (!n1 + !n2 - 2) ). COMPUTE SE = sp*(SQRT((1/!n1) + (1/!n2))). GET TiL /VARIABLES = TiL. GET df /VARIABLES = df. COMPUTE ERR = -TiL * SE. COMPUTE SAMPDIFF = x_bar1 - x_bar2. COMPUTE LOWER = SAMPDIFF - err. COMPUTE UPPER = SAMPDIFF + err. COMPUTE ANSWER = {SAMPDIFF, SP, TiL, SE, err, Lower, Upper}. PRINT ANSWER / FORMAT "F10.5" /Title = "CI for the difference between 2 population means (pooled variance)" / CLABELS = SAMPDIFF, SP, TiL, SE, err, Lower, Upper. END MATRIX. !END DEFINE. DEFINE CI_S2Md (n1 = !ENCLOSE('(',')') /n2 = !ENCLOSE('(',')') /x_bar1 = !ENCLOSE('(',')') /x_bar2 = !ENCLOSE('(',')') /s1 = !ENCLOSE('(',')') /s2 = !ENCLOSE ('(',')') /c = !ENCLOSE('(',')')). GET FILE='Q:\QUANTS\one.sav'. COMPUTE df = min((!n1 -1), (!n2 - 1)). COMPUTE PROB = !c. COMPUTE PROBLG = 1 - !c. COMPUTE PROBL = PROBLG / 2. COMPUTE TiL = IDF.T(PROBL, df). COMPUTE TiU = -1 * TiL . execute. MATRIX. GET df / variables = df. /* Enter the df here (i.e. change the number in curly brackets)*/ COMPUTE x_bar1 = {!x_bar1}. /* Enter the sample mean here*/ COMPUTE x_bar2 = {!x_bar2}. /* Enter the sample mean here*/ COMPUTE SE = SQRT((!s1**2/!n1) + (!s2**2/!n2)). GET TiL /VARIABLES = TiL. GET df /VARIABLES = df. COMPUTE ERR = -TiL * SE. COMPUTE SAMPDIFF = x_bar1 - x_bar2. COMPUTE LOWER = SAMPDIFF - err. COMPUTE UPPER = SAMPDIFF + err. COMPUTE ANSWER = {SAMPDIFF, TiL, SE, err, Lower, Upper}. PRINT ANSWER / FORMAT "F10.5" /Title = "CI for the difference between 2 population means (different variances)" / CLABELS = SAMPDIFF, TiL, SE, err, Lower, Upper. END MATRIX. !END DEFINE. DEFINE CI_L1P (n = !ENCLOSE ('(',')') /x = !ENCLOSE('(',')') /c = !ENCLOSE('(',')')). GET FILE='Q:\QUANTS\one.sav'. COMPUTE PROB = !c. COMPUTE PROBLG = 1 - !c. COMPUTE PROBL = PROBLG / 2. COMPUTE ZiL = PROBIT(PROBL). COMPUTE ZiU = -1 * ZiL . execute. MATRIX. COMPUTE n = !n. /* Enter the sample size here */ COMPUTE x = !x. /* Enter the number of "successes" or particular outcomes here */ COMPUTE CONFID = !c. /* Enter the desired confidence level here */ COMPUTE pTrad = x/n. /* the traditional estimate of the pop. proportion used in CI estimation */ COMPUTE pWlsn = (x+2)/(n + 4). /* the Wilson estimate */ GET zstar /VARIABLES = ZiL. COMPUTE SE_Trad = SQRT((pTrad*(1-pTrad))/n). COMPUTE SE_Wlsn = SQRT((pWlsn*(1-pWlsn))/(n+4)). COMPUTE eTrad = -zstar * SE_Trad. COMPUTE eWlsn = -zstar * SE_Wlsn. COMPUTE LOW_Trad = pTrad - eTrad. COMPUTE LOW_Wlsn = pWlsn - eWlsn. COMPUTE UP_Trad = pTrad + eTrad. COMPUTE UP_Wlsn = pWlsn + eWlsn. COMPUTE ANSWER = {pTrad, zstar, se_trad, etrad, low_trad, up_trad}. PRINT ANSWER / FORMAT "F10.6" /Title = "Traditional Large sample CI for one proportion" / CLABELS = ptrad, zstar, se_trad, etrad, low_trad, up_trad. COMPUTE ANSWER = {pWlsn, zstar, se_wlsn, ewlsn, low_wlsn, up_wlsn}. PRINT ANSWER / FORMAT "F10.6" /Title = "Wilson Large sample CI for one proportion" / CLABELS = pwlsn, zstar, se_wlsn, ewlsn, low_wlsn, up_wlsn. END MATRIX. !ENDDEFINE. DEFINE N_L1M (e = !ENCLOSE('(',')') /c = !ENCLOSE('(',')') /s = !ENCLOSE('(',')')). GET FILE='Q:\QUANTS\one.sav'. COMPUTE PROB = !c. COMPUTE E = !E. COMPUTE PROBLG = 1 - !c. COMPUTE PROBL = PROBLG / 2. COMPUTE ZiL_Var = PROBIT(PROBL). COMPUTE ZiU_Var = -1 * ZiL_Var . COMPUTE N = (ZiL_Var**2) * (!s**2) / (!e**2). execute. MATRIX. GET PROB_VAR /VARIABLES = PROB. GET N / VARIABLES = N. GET E / VARIABLES = E. 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 = {e, PROB, ziL, ziU, N}. PRINT ANSWER / FORMAT "F10.5" /Title = "n_hat = estimated sample size needed to achieve an error of size e given c" / CLABELS = e, c, ziL, ziU, n_hat. END MATRIX. !ENDDEFINE. *---- ... to the end of this line -------------------------------------------------------.