Question: Please use R. Create the vectordie

Please use R.

Create the vectordie <- 1:6, and simulate 10, 20, 30, ..., 990, 1000 tosses of a fair die.

Calculate the proportion of times in which you got number 4 in each of the 100 cases (whenn=10,20,30,...,990,1000

n=10, 20, 30, ..., 990, 1000). Store these 100 values in a vector.

Create data frame containing the vector of proportions, along with the number of tosses.

Using ggplot2 andgeom_line()as geometry (or the base R plotting functions settingtype='l'), plot the 100 estimates againstnto show that, asn

nincreases, the proportion of 4 stabilizes around the true probability of obtaining 4, i.e.1/6. Usegeom_hline()(orabline()if using base R) to add a red dashed horizontal line wherey=1/6

y=1/6(type?geom_hlineif you have not used this function before).

Before you start coding, setset.seed(7).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!