Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(2 points) Create a character vector called coin containing two elements 'H' and 'T' (Head and Tail). Set: set . seed(16) Use the sample() function,
(2 points) Create a character vector called coin containing two elements 'H' and 'T' (Head and Tail). Set: set . seed(16) Use the sample() function, and a for loop, to generate a randOm sample of size n : 10, 20, ..., 1000 from the coin (you will have to set replace = T ). For each sample, calculate the proportion of heads observed in the sample, and store it in a vector called obs_prop (the vector will be of length 100}. Choose an appropriate function (of base R or of ggplotZ) to plot the vector obs_pr'op and show that, as the sample size increases, the estimated proportion approaches the probability of getting Head, i.e. 0.5
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