Answer to Question #138722 in Statistics and Probability for nati

Question #138722
IN R studio

# 3. Rolling two dice.Experiment: Given two die which are biased to land on 3 with probability .5 and equally likely to land on all other numbers with probability .1.We roll these die.

Define a random variable "sum_dice" that calculates the sum of the numbers that show up on the two dice. ```{r}```

Run a simulation of 100000 rolls. Use this simulation to compute the empirical probability distribution of this random variable. Compare this with the theoretical probability distribution. ```{r}```

Compute the expected value and the variation of this random variable. ```{r}```
1
Expert's answer
2020-10-19T17:02:22-0400

Simulating 2 die tosses with the probability of getting a 3 = 0.5;


```{r}
toss = function() {
  outcomes = sample(x = c(1,2,3,4,5,6), size = 2, replace = TRUE, prob = c(0.1, 0.1, 0.5, 0.1, 0.1,0.1))
  sum_dice = sum(outcomes)
  sum_dice
}
```


The distribution of the sum of the outcomes is:


```{r}
set.seed(100000)

sum_dice = replicate(100000, toss())

sum = 2:12
Probability = c(mean(sum_dice == 2), mean(sum_dice == 3), mean(sum_dice == 4), mean(sum_dice == 5), mean(sum_dice == 6), mean(sum_dice == 7), mean(sum_dice == 8), mean(sum_dice == 9), mean(sum_dice == 10), mean(sum_dice == 11), mean(sum_dice == 22))
```


The sum_dice values are: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 with probabilities 0.01015, 0.01988, 0.10903, 0.12149, 0.29217, 0.1399, 0.13059, 0.1182, 0.02859, 0.02002, 0 respectively


```{r}
mean = mean(sum_dice)
variance = var(sum_dice)
```


The expectation is 6.59023 and variance 3.5938745.



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS