// LabOpinionPollSpecs.txt. 3/23/2020. import Foundation class LabCoinTossSpecs { let strOpinionPollSpecs :String = """ `` Lab Specs .1 .9 .1 .5 // 0: List of Population Proportions 1 2 3 4 10 16 25 50 100 200 400 // 1: List of Sample Sizes .000 .200 .300 .350 .400 .425 .450 .475 .500 // 2: From Values .500 .525 .550 .575 .600 .650 .700 .800 1.000 // 3: To Values `` Prob Specs ` Problem 0 Start Screen 1 - Estimated Population Fraction // 0: Title // ActFrac // SampleSize // PauseCheckbox(-1 checked 0 cleared) // NonRandomSampleCheckbox(-1 visible unchecked, 0 not visible, 1 visible checked) // To-FromValues(0 hide, -1 reset values to none, 1 leave current values intact) //.5 16 -1 0 0 // 1: Specs .5 // 1: Actual population fraction (ActFrac) 16 // 2: Sample size T // 3: Pause checkbox selected F F // 4: Relative frequency and From-To options .450 .550 // 5: From-To values ` Text Start // 6: Text Three Objectives: First, show that the fraction of those supporting Clint in a single poll typically does not equal the fraction of the actual population that supports Clint. That is, the estimated population fraction, EstFrac, typically does not equal the actual population fraction, ActFrac. Second, show that the estimated fraction, EstFrac, is a random variable. Even if we knew the actual population fraction, we are not able to predict the estimated fraction before a poll is conducted. Third, recall that 12 of the 16 students Clint polled supported him. We shall show it possible that 12 or even more of the students sampled in one poll could support Clint even though the election is actually a toss up. The list in the upper left hand corner indicates the actual population fraction, the actual fraction of the population supporting Clint. For purposes of illustrate, we assume that the actual population fraction, ActFrac, equals .5. That is, we assume that the election is a toss up: half the population supports Clint and half does not. The list to the right indicates the sample size, the number of individuals polled. By default, the sample size is specified as 16, the same as Clint's poll. 1. To conduct one poll, click the Start button. The simulation reports now reports the number of individuals polled who support Clint. How many of the 16 individuals polled support Clint? 2. To conduct a second poll, click the Next button. How many of the 16 individuals support Clint in the second poll? 3. Click the Next button several more times, each time noting the number of individuals who support Clint. Even though the actual population fraction, ActFrac, equals .5, do half of the individuals sampled in a single poll typically support Clint? 4. Even though we know that the actual fraction, ActFrac, equals one half, is it possible to predict the value of the estimated fraction, EstFrac, before a poll is conducted. That is, is the estimated fraction, EstFrac, a random variable? Explain why or why not. 5. Clear the Pause checkbox. The simulation will no longer stop after each poll. Click Next and then after many, many repetitions, click Stop. Is it possible hat 12 or more of the individuals sampled in one poll of 16 could support Clint even though the election is actually a toss up (even though the actual population fraction, ActFrac, is one half). ` Prob End ` Problem 1 Start Screen 2 - Relative Frequency // 0: Title // ActFrac // SampleSize // PauseCheckbox(-1 checked 0 cleared) // NonRandomSampleCheckbox(-1 visible unchecked, 0 not visible, 1 visible checked) // To-FromValues(0 hide, -1 reset values to none, 1 leave current values intact) //.5 1 -1 0 0 // 1: Specs .5 // 1: Actual population fraction (ActFrac) 1 // 2: Sample size T // 3: Pause checkbox selected T F // 4: Relative frequency and From-To options .450 .550 // 5: From-To values ` Text Start // 6: Text Objective: Illustrate the relative frequency interpretation of probability. After many, many repetitions of the experiment the distribution of a random variable's numerical values mirrors the random variable's probability distribution; consequently, after many, many repetitions the mean and variance of the numerical values will equal the mean and variance of the probability distribution. We begin by considering a sample size of only 1. Let v equal the number of individuals polled who support Clint. That is, v equals 1 if the individual polled supports Clint and 0 if the individual does not. As before, suppose that the election is a toss up; that is, suppose that the population fraction, ActFrac, equals .5. Half the population supports Clint and half does not. 1. What is the probability that v would equal each of its possible values, 0 and 1, in a single poll. What is the mean and variance of the random variable v's probability distribution? 2. Click the Start button. Does the individual support Clint? Record the numerical value of v for the first repetition of the experiment. 3. Click the Next button to repeat the poll for a second time. What does the numerical value of v equal for the second repetition of the experiment? Record its value. Is the simulation computing the relative frequencies, the mean, and the variance of v's numerical values correctly? 4. Click the Next button a few more times and record the value of v in each repetition. Convince yourself that the simulation is computing the relative frequencies, the mean, and the variance of v's numerical values correctly. 5. Clear the Pause checkbox. Click the Next button and then after many, many repetitions click the Stop button. What are the relative frequencies of v's numerical values? What are the mean and variance of the numerical values? 6. Compare your answers to 1 and 5. Are your answers consistent with the relative frequency interpretation of probability? Explain. ` Prob End ` Problem 2 Start Screen 3 - Mean and Value of the Estimated Fraction // 0: Title // ActFrac // SampleSize // PauseCheckbox(-1 checked 0 cleared) // NonRandomSampleCheckbox(-1 visible unchecked, 0 not visible, 1 visible checked) // To-FromValues(0 hide, -1 reset values to none, 1 leave current values intact) //.5 2 0 0 0 // 1: Specs .5 // 1: Actual population fraction (ActFrac) 2 // 2: Sample size F // 3: Pause checkbox selected T F // 4: Relative frequency and From-To options .450 .550 // 5: From-To values ` Text Start // 6: Text Objective: Exploit the relative frequency interpretation of probability to check our calculations for the mean and variance of the estimated fraction's probability distribution when a sample size equals 2. As before, the actual population fraction, ActFrac, equals .5. That is, the election is a toss up: half the population supports Clint and half does not. Note that the sample size of 2 has been selected. 1. Calculate the mean and variance of the estimated population fraction's, EstFrac's, probability distribution? 2. Note that the Pause checkbox is cleared. Click the Start button and then, after many, many repetitions click the Stop button. What are the mean and variance of EstFrac's numerical values? 3. Compare your answers to 1 and 2. In view of the relative frequency interpretation of probability, are your answers consistent? 4. Use the appropriate equations to calculate the mean and variance of the estimated fraction's, EstFrac's, probability distribution when the sample size is 25. Select a sample size of 25 in the lab. Click the Start button and then, after many, many repetitions click the Stop button. What are the mean and variance of EstFrac's numerical values? Are the equations and lab results consistent. Do the same for a sample size of 100 and then 400. ` Prob End ` Problem 3 Start Screen 4 - Importance of the Mean // 0: Title // ActFrac // SampleSize // PauseCheckbox(-1 checked 0 cleared) // NonRandomSampleCheckbox(-1 visible unchecked, 0 not visible, 1 visible checked) // To-FromValues(0 hide, -1 reset values to none, 1 leave current values intact) //.5 100 -1 0 -1 // 1: Specs .5 // 1: Actual population fraction (ActFrac) 100 // 2: Sample size T // 3: Pause checkbox selected F T // 4: Relative frequency and From-To options .000 .500 // 5: From-To values ` Text Start // 6: Text Objective: Show that when the estimated fraction's probability distribution is symmetric, the chances that the estimated fraction will be less than the actual population fraction in any one poll equal the chances that the estimated fraction will be greater than the actual fraction. The actual population fraction equals.5. The election is a tossup. Half the population supports Clint and half does not. Be certain that a sample size of 100 is selected. Note that two new lists have appeared in the lower left of the window: a From list and a To list. NB: Select a From value of .000 and a To value of .500 are selected. The From-To Percent line reports the percent of repetitions in which the estimated fraction lies between the From value, .000, and the To value, .500. Click Start. What is the estimated fraction from the first repetition? Now, click Next a few times to convince yourself that the simulation is calculating the From-To percent correctly. 2. Be certain that the Pause checkbox is cleared. Click Start and then, after many, many repetitions, click Stop. What percent of the repetitions fell between .000 and .500? 3. Recall that the actual population fraction, ActFrac, equals .5. How do the chances that the estimate from one poll will be too high compare with the chances that the estimate will be too low? Explain. 4. Does the estimation procedure systematically underestimate or overestimate the actual population fraction? Explain. ` Prob End ` Problem 4 Start Screen 5 - Importance of the Variance // 0: Title // ActFrac // SampleSize // PauseCheckbox(-1 checked 0 cleared) // NonRandomSampleCheckbox(-1 visible unchecked, 0 not visible, 1 visible checked) // To-FromValues(0 hide, -1 reset values to none, 1 leave current values intact) //.5 25 0 0 -1 // 1: Specs .5 // 1: Actual population fraction (ActFrac) 25 // 2: Sample size F // 3: Pause checkbox selected F T // 4: Relative frequency and From-To options .450 .550 // 5: From-To values ` Text Start // 6: Text Objective: Show that the reliability of Clint's unbiased estimation procedure depends on the variance of the estimated fraction's, EstFrac's, probability distribution. Note that .5 has been selected as the actual population fraction. Once again, the election is a toss up: half the population supports Clint and half does not. Focus on the From and To lists in the lower left hand corner of the screen. When you specify a From and To value, the simulation calculates the percent of repetitions in which the numerical value of the estimated fraction falls between the From and To values. Selected .450 in the From list and .550 in the To list. The simulation will now calculate the percent of repetitions in which the numerical value of the estimated fraction falls between .450 and .550. 1. We begin with a sample size of 25. 1a. Using the appropriate equations, calculate the mean and variance of EstFrac's probability distribution. Is the estimation procedure unbiased? Explain. 1b. Be certain that the Pause checkbox is cleared. Click Start and then, after many, many repetitions, click Stop. What are the mean and variance of the numerical values of the estimated fractions? 1c. How do the mean and variance of EstFrac's probability distribution compare to the mean and variance of the numerical values after many, many repetitions? 1d. What percent of the repetitions fell between .450 and .550; that is, what percent of the repetitions fell within .05 of the actual population fraction, .50? 2. Next, change the sample size o 100. 2a. Using the appropriate equations, calculate the mean and variance EstFrac's probability distribution. Is the estimation procedure unbiased? Explain. 2b. Be certain that the Pause checkbox is cleared. Click Start and then, after many, many repetitions, click Stop. What are the mean and variance of the numerical values of the estimated fractions? 2c. How do the mean and variance of EstFrac's probability distribution compare to the mean and variance of the numerical values after many, many repetitions? 2d. What percent of the repetitions fell between .450 and .550; that is, what percent of the repetitions fell within .05 of the actual population fraction, .50? 3. Now, change the sample size o 400. 3a. Using the appropriate equations, calculate the mean and variance EstFrac's probability distribution. Is the estimation procedure unbiased? Explain. 3b. Be certain that the Pause checkbox is cleared. Click Start and then, after many, many repetitions, click Stop. What are the mean and variance of the numerical values of the estimated fractions? 3c. How do the mean and variance of EstFrac's probability distribution compare to the mean and variance of the numerical values after many, many repetitions? 3d. What percent of the repetitions fell between .450 and .550; that is, what percent of the repetitions fell within .05 of the actual population fraction, .50? 4a. What happens to the variance of the numerical values of the estimated fractions as the sample size increases? 4b. What happens to the percent of repetitions that fall close to the actual population fraction as the sample size increases and the variance decreases? 4c. That is, what happens to the reliability of an estimate as the sample size increases and the variance decreases? Explain this intuitively. ` Prob End ` Problem 5 Start Screen 6 - Central Limit Theorem // 0: Title // ActFrac // SampleSize // PauseCheckbox(-1 checked 0 cleared) // NonRandomSampleCheckbox(-1 visible unchecked, 0 not visible, 1 visible checked) // To-FromValues(0 hide, -1 reset values to none, 1 leave current values intact) //.5 25 0 0 -1 // 1: Specs .5 // 1: Actual population fraction (ActFrac) 25 // 2: Sample size F // 3: Pause checkbox selected F T // 4: Relative frequency and From-To options .450 .550 // 5: From-To values ` Text Start // 6: Text Objective: Illustrate the Central Limit Theorem: Show that as the sample size increases the normal distribution becomes a better and better approximation of EstFrac's probability distribution. Note that .5 has been selected as the actual population fraction. That is, the election is a toss up: half the population supports Clint and half does not. 1. Suppose that the sample size is 25. 1a. Using the appropriate equations, calculate the mean and variance of EstFrac's probability distribution. 1b. What is the standard deviation of EstFrac's probability distribution? Focus on the two lists in the lower left hand corner of the screen: the "From" list and the "To" list. When you specify a From and To value, the simulation calculates the percent of repetitions in which the numerical value of the estimated fraction falls between these two values. 1c. Based on your answers to 1a and 1b, what From and To values should you specify to calculate the percent of repetitions within 1 standard deviation of the mean? 1d. Specify these values. Click Start and after many repetitions, click Stop. What percent of repetitions fall within 1 standard deviations of the mean? 1e. Respecify the From and To values to determine the percent of repetitions that fall within 2 standard deviations of the mean. Click Start and then after many, many repetitions repetitions, click Stop. What is the percent? 1f. Respecify the From and To values to determine the percent of repetitions that fall within 3 standard deviations of the mean. Click Start and then after many, many repetitions repetitions, click Stop. What is the percent? 2. Next, note that the sample size have been increased from 25 to 100. 2a. Using the appropriate equations, calculate the mean and variance of EstFrac's probability distribution. 2b. What is the standard deviation of EstFrac's probability distribution? 2c. Based on your above answers, what From and To values should you specify to calculate the percent of repetitions within 1 standard deviation of the mean? 2d. Specify these values. Click Start and after many repetitions, click Stop. What percent of repetitions fall within 1 standard deviations of the mean? 2e. Respecify the From and To values to determine the percent of repetitions that fall within 2 standard deviations of the mean. Click Start and then after many, many repetitions repetitions, click Stop. What is the percent? 2f. Respecify the From and To values to determine the percent of repetitions that fall within 3 standard deviations of the mean. Click Start and then after many, many repetitions repetitions, click Stop. What is the percent? 3. Last, note that the sample size have been increased from 100 to 400. 3a. Using the appropriate equations, calculate the mean and variance of EstFrac's probability distribution. 3b. What is the standard deviation of EstFrac's probability distribution? 3c. Based on your above answers, what From and To values should you specify to calculate the percent of repetitions within 1 standard deviation of the mean? 3d. Specify these values. Click Start and after many repetitions, click Stop. What percent of repetitions fall within 1 standard deviations of the mean? 3e. Respecify the From and To values to determine the percent of repetitions that fall within 2 standard deviations of the mean. Click Start and then after many, many repetitions repetitions, click Stop. What is the percent? 3f. Respecify the From and To values to determine the percent of repetitions that fall within 3 standard deviations of the mean. Click Start and then after many, many repetitions repetitions, click Stop. What is the percent? 4. In a single table, summarize your answers to 1d, 1e, 1f and 2d, 2e, 2f, and 3d, 3e, 3f. That is, for each sample size, 25, 100, and 400, what is the percent of repetitions that fall with 1 standard deviation of the mean 2 standard deviations of the mean 3 standard deviations of the mean after many, many repetitions. 5. What interesting observation does your table illustrate? ` Prob End ` Problem 6 Start Screen 7 - Reliability of the Estimated Fraction // 0: Title // ActFrac // SampleSize // PauseCheckbox(-1 checked 0 cleared) // NonRandomSampleCheckbox(-1 visible unchecked, 0 not visible, 1 visible checked) // To-FromValues(0 hide, -1 reset values to none, 1 leave current values intact) //.5 16 0 0 0 // 1: Specs .5 // 1: Actual population fraction (ActFrac) 25 // 2: Sample size F // 3: Pause checkbox selected F F // 4: Relative frequency and From-To options .450 .550 // 5: From-To values ` Text Start // 6: Text Poll Results: A poll of 16 students just completed reveals that 12 students support Clint suggesting that Clint leads. Cynic's View: Despite the fact that 12 of the 16 students Clint polled support Clint, the election is actually a tossup. Objective: Show that the cynic could be correct. Since the cynic claims that the election is a tossup, a population fraction of .5 has been selected. Also, the sample size is specified as 16, the number of students polled. 1. Be certain that the Pause checkbox is cleared. Click Start and then after many, many repetitions click Stop. Look at the histogram. After many, many repetitions do 12 of more of the 16 students selected support Clint in some polls? Could the cynic be correct? ` Prob End `` Prob Specs """ }