Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This question requires the use of the software R. Specifically you need to create a short R script. Please attach your R script and outputs
This question requires the use of the software R. Specifically you need to create a short R script. Please attach your R script and outputs to your assignment. Please perform 2 monte carlo experiments and investigate the behaviour of the sum of all the sample data. consider the example of rolling a dice five times in a row. A sample now consists of five independent random draws from the set(1,2,3,4,5,6) for instance, your sample set may be (2,5,1,1,5). It is apparent that the sum of these five random variables (2+5+1+1+5=14) is also a random variable. We can't use R's random number generation to learn more about the distribution of the sample sum. The basic idea is to simulate outcomes of the true distribution repeatedly To perform these simulations in R, please proceed as follows: 1 Set the sample size equal 5 and number of sample(repetitions) to be drawn according to your own preference. You could use for instance 200; 10,000 or 500,000 etc. Make sure to choose a smaller number of repetitions (5,000) for the second experiment. 2 Make a number 123456 and make it in the title of the histogram. You can do so by adding the command line main= "number=123456, after hist (sample sums..) 3 Use the function replicate () in conjunction with sample() to draw random observations. Note: the outcome of replicate () is a matrix. It contains the drawn samples as columns. 4 Compute sample sums using the command colSums(). This function computes the sum of each column, i.e., of each sample and returns a vector, 5 Plot the computed vector of means in a histogram. Keep the number of bins of the histogram equal to 25 for the two experiments Carefully describe what you see in the first experiment ( smaller number of repetitions) and in the second experiment( larger number number of repetions) Crefully compare the two histograms and explain what you see. H www This question requires the use of the software R. Specifically you need to create a short R script. Please attach your R script and outputs to your assignment. Please perform 2 monte carlo experiments and investigate the behaviour of the sum of all the sample data. consider the example of rolling a dice five times in a row. A sample now consists of five independent random draws from the set(1,2,3,4,5,6) for instance, your sample set may be (2,5,1,1,5). It is apparent that the sum of these five random variables (2+5+1+1+5=14) is also a random variable. We can't use R's random number generation to learn more about the distribution of the sample sum. The basic idea is to simulate outcomes of the true distribution repeatedly To perform these simulations in R, please proceed as follows: 1 Set the sample size equal 5 and number of sample(repetitions) to be drawn according to your own preference. You could use for instance 200; 10,000 or 500,000 etc. Make sure to choose a smaller number of repetitions (5,000) for the second experiment. 2 Make a number 123456 and make it in the title of the histogram. You can do so by adding the command line main= "number=123456, after hist (sample sums..) 3 Use the function replicate () in conjunction with sample() to draw random observations. Note: the outcome of replicate () is a matrix. It contains the drawn samples as columns. 4 Compute sample sums using the command colSums(). This function computes the sum of each column, i.e., of each sample and returns a vector, 5 Plot the computed vector of means in a histogram. Keep the number of bins of the histogram equal to 25 for the two experiments Carefully describe what you see in the first experiment ( smaller number of repetitions) and in the second experiment( larger number number of repetions) Crefully compare the two histograms and explain what you see. H www
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started