Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this assignment to be completed in R Markdown. Please and thank you! Spinner Games, Functions, and More Philip Pina nataharoun onon
I need help with this assignment to be completed in R Markdown. Please and thank you!
Spinner Games, Functions, and More Philip Pina nataharoun onon Part I Find The Fair Price Of The Game-The Expected Value In part I of this lab you will examine the random variable implied by the spinner game* above. The spinner game is played by first paying a "fair price" to play the game. You then spin the spinner. Where the spinner lands determines your winnings. Recall, we have seen that every discrete finite random variable can be thought of as a spinner game. It is natural to ask the question "What is a fair price to play this game?". We call this fair price the expected value and it is denoted by E[X]. Use the vector nature of R to determine E[X] the Games, Functions, and More 10/6/2022,9 expected value of X,V[X] the variance of X, and the standard deviation of X. You must display the code you used in this RMarkdown document. Here are the steps you should follow: cise 1 Create a vector named x that houses the values of the random variable. Display your code below. Create a vector named pmf that houses the values of the natural geometric probability (probability mass function) of the spinner game. Display your code below. Use x and pmf to determine E[X], the expected value of X, and store the result in a vector named mu. Display your code below. cise 4 Use x and pmf to determine V[X], the variance of X, and store the result in a vector named var. Display your code below. cise 5 Use x and pmf to determine the standard deviation of X and store the result in stdev. Display your code below. Part 2 Simulate The Spinner Game In this part of the lab we will use the function to simulate playing the spinner game 10,000 times. (Hint: To make your life easier I suggest that you use the help function to see what this puppy can do. A google search wouldn't hurt either) R uses a psuedorandom mechanism to create values from the population (i.e. the money we could win if we spin the spinner). Exercise 6 Type set.seed(124) at the console. Now use the sample function to mimic spinning the spinner 10,000 times storing the result in a vector called simvals. The set.seed() function starts the random mechanism. Make sure you exhibit your code below so I can run your simulation! If R works the way it should then we will have values of the random variable in proportion to their idealized probability of occurance. How can you check that the results we get are more or less in line with what our probabilistic model says it should be since we certainly can't count them all by hand and check their proportions? Exercise 7 Verify that the simulation gave accurate results. There are many ways to do this(some easier than others). Exhibit your code below. Exercise 8 When would it be absolutely necessary to use simulation techniques in a research, epidemiology, or medical setting? Though this is a vague question, there is a right answer. Think about this a little bit before you answer. It's not a trick question. Can you give an example? Part 3 The Dice Game In this final part of the lab you will analyze how to write your own functions to get things done that you don't want to do over and over again. Consider the code below: # Put initialization code in this file. dicef_pmfStep 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