Question

In: Statistics and Probability

preform a Monte Carlo simulation in R to generate the probability distribution of the sum of...

preform a Monte Carlo simulation in R to generate the probability distribution of the sum of two die (for example 1st die is 2 and second die is 3 the random variable is 2+3=5). The R-script should print out (display in R-studio) or have saved files for the following well labeled results:

1. Histrogram or barchart of probability distribution

2. Mean of probability distribution

3. Standard deviation of probability distribution

Solutions

Expert Solution

Answer:-

Given That:-

preform a Monte Carlo simulation in R to generate the probability distribution of the sum of two die (for example 1st die is 2 and second die is 3 the random variable is 2+3=5). The R-script should print out (display in R-studio) or have saved files for the following well labeled results:

R code with comments

All Code in text format

---
title: "the sum of two dice"
output: html_document
---

{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)


Simulate the toss of 2 dice
{r}
#set the number of simulations
n<-10000
#simulate 2*n tosses
x<-sample(1:6,size=2*n,replace=TRUE,prob=rep(1/6,6))
#convert this into a matrix of 2xn
x<-matrix(x,nrow=2)
#get the column sums, represeting the sum of 2 dice
y<-colSums(x)

1. Histrogram or barchart of probability distribution?

plot the histogram of the sums
{r}
hist(y,main=" the probability distribution of the sum of two dice",freq=FALSE,breaks=12)

2. Mean of probability distribution?

Mean of the distribution
{r}
sprintf('Mean of probability distribution is %.4f',mean(y) )

3. Standard deviation of probability distribution?

Standard deviation of probability distribution
```{r}
sprintf('Standard deviation of probability distribution is %.4f',sd(y) )


Related Solutions

Running a Monte Carlo simulation to calculate the probability that the daily return from S&P will...
Running a Monte Carlo simulation to calculate the probability that the daily return from S&P will be > 5%. We will assume that the historical S&P daily return follows a normal distribution with an average daily return of 0.03 (%) and a standard deviation of 0.97 (%). To begin we will generate 100 random samples from the normal distribution. For the generated samples we will calculate the mean, standard deviation, and probability of occurrence where the simulation result is greater...
Describe the steps needed to perform the Monte Carlo Simulation.
Describe the steps needed to perform the Monte Carlo Simulation.
A Monte Carlo simulation is a method for finding a value that is difficult to compute...
A Monte Carlo simulation is a method for finding a value that is difficult to compute by performing many random experiments. For example, suppose we wanted to estimate π to within a certain accuracy. We could do so by randomly (and independently) sampling n points from the unit square and counting how many of them are inside the unit circle (assuming that the probability of selecting a point in a given region is proportional to the area of the region)....
I need to generate a loop for 1,000 Monte Carlo iterations in R. I have two...
I need to generate a loop for 1,000 Monte Carlo iterations in R. I have two randomly generated standard normal variables for this with sample sizes of 100.
This problem is also a Monte Carlo simulation, but this time in the continuous domain: must...
This problem is also a Monte Carlo simulation, but this time in the continuous domain: must use the following fact: a circle inscribed in a unit square has as radius of 0.5 and an area of ?∗(0.52)=?4.π∗(0.52)=π4. Therefore, if you generate num_trials random points in the unit square, and count how many land inside the circle, you can calculate an approximation of ? For this problem, you must create code in python (A) Draw the diagram of the unit square...
This problem is also a Monte Carlo simulation, but this time in the continuous domain: must...
This problem is also a Monte Carlo simulation, but this time in the continuous domain: must use the following fact: a circle inscribed in a unit square has as radius of 0.5 and an area of ?∗(0.52)=?4.π∗(0.52)=π4. Therefore, if you generate num_trials random points in the unit square, and count how many land inside the circle, you can calculate an approximation of ? For this problem, you must create code in python (B) Without drawing the diagram, calculate the value...
Please provide an example of a Monte Carlo simulation model (and explain). Your simulation example should...
Please provide an example of a Monte Carlo simulation model (and explain). Your simulation example should be able to: Tackle a wide variety of problems using simulation Understand the seven steps of conducting a simulation Explain the advantages and disadvantages of simulation Develop random number intervals and use them to generate outcomes Understand alternative computer simulation packages available Explain the different type of simulations Explain the basic concept of simulation
Perform Monte Carlo integration using R statistical programming to estimate the value of π. Generate N...
Perform Monte Carlo integration using R statistical programming to estimate the value of π. Generate N pairs of uniform random numbers (x,y), where x ∼ U(0,1)and y ∼ U(0,1) and each (x,y) pair represents a point in the unit square. To obtain an estimate of π count the fraction of points that fall inside the unit quarter circle and multiply by 4. Note that the fraction of points that fall inside the quarter circle should tend to the ratio between...
(Use R Programming to Code) Use the Monte Carol simulation to estimate the probability that all...
(Use R Programming to Code) Use the Monte Carol simulation to estimate the probability that all six faces appear exactly once in six tosses of fair dice.
Discuss about Monte Carlo simulation, with a focus on its steps. (100% rating)
Discuss about Monte Carlo simulation, with a focus on its steps. (100% rating)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT