Assignment 2

Report 16 Downloads 73 Views
Assignment 2 Romelia Solano 2/14/2017 1 Simulations This week’s assignment asks us to run some simulations in R in order to better understand the The Law of Large Numbers and the Central Limit Theorem.

2 The Law of Large Numbers Create a simulation designed to evaluate the Law of Large Numbers. Suppose you are conducting a survey asking people whether or not they think the country is moving in the right direction or the wrong direction. You believe the underlying probability of a randomly selected individual saying the country is moving in the wrong direction is some number between 0 and 1 (you choose). Be sure to explain what your R code is doing. 1. Develop a simulation where you draw a total of 1,000 respondents from the population in which the true probability is your chosen number. Every time you draw another respondent, compute the proportion of respondents you have selected so far that believe that the country is headed in the wrong direction. Thus, after you draw one respondent, you compute the proportion that think the country is headed in the wrong direction. After you fraw anothe respondent, you compute the proportion from among those two you have drawn so far that think the country is headed in the wrong direction. You continue this for the third, fourth, fifth, etc. . . all the way up to the 1,000th respondent. 2. Construct a graph that plots the number of respondents selected so far on the x-axis and the proportion of respondents selected so far that believe the country is going in the wrong direction on the y-axis. Describe what you see and what you think this means. R code:

set.seed(8567) #set the seed for reproducible results n