Question 3 Consider the MacKay coin-flipping example from lectures. In this question you will do hypothesis testing the 'second way' using marginal likelihoods. A coin was flipped N = 250 times and heads was the result x = 140 times (with tails appearing 110 times). We want to know whether the coin flipping was fair or not. Let 0, the unknown parameter be the probability of heads on each flip, and let Ho be the hypothesis that = 0.5, and H₁ the hypothesis that 00.5. Use R for this question. 1 (a) Create a vector of values for ranging from 0 to 1 in steps of 0.001. Also, create a prior for given H₁ that is proportional to dnorm (theta, mean=0.5, sd=0.1). This models the idea that we only would have expected a slightly biased coin tossing procedure. (b) Calculate the marginal likelihood P(x = 140 | H₁). (c) Calculate a 95% credible interval for under the assumption of H₁. (d) Calculate the likelihood for Ho and therefore the Bayes Factor for H₁ over Ho. (e) Find the posterior probability of Ho if it has a prior probability of 0.5.
Question 3 Consider the MacKay coin-flipping example from lectures. In this question you will do hypothesis testing the 'second way' using marginal likelihoods. A coin was flipped N = 250 times and heads was the result x = 140 times (with tails appearing 110 times). We want to know whether the coin flipping was fair or not. Let 0, the unknown parameter be the probability of heads on each flip, and let Ho be the hypothesis that = 0.5, and H₁ the hypothesis that 00.5. Use R for this question. 1 (a) Create a vector of values for ranging from 0 to 1 in steps of 0.001. Also, create a prior for given H₁ that is proportional to dnorm (theta, mean=0.5, sd=0.1). This models the idea that we only would have expected a slightly biased coin tossing procedure. (b) Calculate the marginal likelihood P(x = 140 | H₁). (c) Calculate a 95% credible interval for under the assumption of H₁. (d) Calculate the likelihood for Ho and therefore the Bayes Factor for H₁ over Ho. (e) Find the posterior probability of Ho if it has a prior probability of 0.5.
Chapter8: Sequences, Series,and Probability
Section8.7: Probability
Problem 50E: Flexible Work Hours In a recent survey, people were asked whether they would prefer to work flexible...
Related questions
Question
not use ai please
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
College Algebra
Algebra
ISBN:
9781305115545
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage
College Algebra
Algebra
ISBN:
9781305115545
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage