In Python generate 4096 flips of the coin using the binomial function of the random module...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In Python generate 4096 "flips" of the coin using the binomial function of the random module in numpy: import numpy.random flips = numpy.random.binomial(1, bias, 4096) Where bias is the value of the bias weighting you chose. In python write a function for the likelihood function for the flips. You'll want to be able to compute the function for a set of bias weightings, a number of flips, and a number of heads in that number of flips. You must: 1. Compute the various probabilities as (natural) logarithms. 2. Normalize the binomial function 3. Use the approximation: In(N!) ~ N In N - N + ln(2+N)/2. 4. Sample the bias weighting parameter H rather finely: AH = 0.001 works well. (In Python use numpy.arange(0.001, 1.0, 0.001) Choose an adequate prior and write a function for it, the prior on H is given by: H (0 -1/2H+3/8 (0.25 1/2H - 1/8 (0.5 -H+1 <H≤ 0.25 ) ≤H≤ 0.5 ) ≤H≤ 0.75 ) (0.75 ≤H≤ 1 ) use this prior and compare it to a prior from using the principal of indifference 10 P(H) = Construct the (normalized) posterior for the flips and write a function for it. Plot the posterior PDF of H2 and determine the most probable value of the bias weighting from the posterior Determine the best estimate and uncertainty of the bias weighting under the Gaussian assumption for the shape of the posterior (with uniform prior) Do this after 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, and 4096 flips. (Make a table of the most probable value of Q2, the best estimate, and the uncertainty as a function of the number of flips of Q3.) Does the Gaussian best estimate match the most probable value within the Gaussian uncertainty at each number of flips In Python generate 4096 "flips" of the coin using the binomial function of the random module in numpy: import numpy.random flips = numpy.random.binomial(1, bias, 4096) Where bias is the value of the bias weighting you chose. In python write a function for the likelihood function for the flips. You'll want to be able to compute the function for a set of bias weightings, a number of flips, and a number of heads in that number of flips. You must: 1. Compute the various probabilities as (natural) logarithms. 2. Normalize the binomial function 3. Use the approximation: In(N!) ~ N In N - N + ln(2+N)/2. 4. Sample the bias weighting parameter H rather finely: AH = 0.001 works well. (In Python use numpy.arange(0.001, 1.0, 0.001) Choose an adequate prior and write a function for it, the prior on H is given by: H (0 -1/2H+3/8 (0.25 1/2H - 1/8 (0.5 -H+1 <H≤ 0.25 ) ≤H≤ 0.5 ) ≤H≤ 0.75 ) (0.75 ≤H≤ 1 ) use this prior and compare it to a prior from using the principal of indifference 10 P(H) = Construct the (normalized) posterior for the flips and write a function for it. Plot the posterior PDF of H2 and determine the most probable value of the bias weighting from the posterior Determine the best estimate and uncertainty of the bias weighting under the Gaussian assumption for the shape of the posterior (with uniform prior) Do this after 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, and 4096 flips. (Make a table of the most probable value of Q2, the best estimate, and the uncertainty as a function of the number of flips of Q3.) Does the Gaussian best estimate match the most probable value within the Gaussian uncertainty at each number of flips
Expert Answer:
Answer rating: 100% (QA)
Here is a Python implementation of the likelihood function prior and posterior for estimating the ... View the full answer
Related Book For
Introduction to Management Science A Modeling and Cases Studies Approach with Spreadsheets
ISBN: 978-0078024061
5th edition
Authors: Frederick S. Hillier, Mark S. Hillier
Posted Date:
Students also viewed these accounting questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Hi there , I need help. for my work i need a relevant and well written introduction as well as conclusion to the following below. My work is complete i just need a introduction and conclusion please...
-
Job descriptions: In determining who will be responsible for what duties, you are to compile a Job description for the Assistant Front Office Manager, The Front Desk Agent, The Reservations Agent and...
-
U Ltd has three subsidiaries (one of which is dormant) and has the following results for the year to 31 December 2020: Compute the corporation tax liability for the year and state the date (or dates)...
-
Assume that FASB 8 is still in effect instead of FASB 52. Construct a translation exposure report for Centralia Corporation and its affiliates that is the counterpart to Exhibit 10.6 in the text....
-
Exercises 6971 will help you prepare for the material covered in the next section. Graph x - y = 3 and (x - 2) 2 + (y + 3)2 = 4 in the same rectangular coordinate system. What are the two...
-
Refer to the information in Exercise 22-12. Assume that each of the companys divisions has a required rate of return of 7%. Compute residual income for each division. Data From Exercise 22-12 A food...
-
OBrian Service Company purchased a copier on January 1, 2012, for $17,000 and paid an additional $200 for delivery charges. The copier was estimated to have a life of four years or 800,000 copies....
-
1. A ray of light enters glass (index 1.570) from air at an incident angle of 25. Find the angles of refraction and of deviation. 2. A light ray is directed through air (index 1.000) at a 25 angle of...
-
A bank categorizes its customers into one of three groups based on their banking habits. A random sample of 30 customers from each group was selected, and the number of times each customer visited...
-
What is the difference between accounts payable and accounts receivable? Support your reasoning with practical examples.
-
Equation yields 82 (w) = -wg(w) for the Fourier transform of the second derivative of f(x). The condition f(x) 0 for x may be relaxed slightly. Find the least restrictive condition for the preceding...
-
1. Aristotle (384 BC-322 BC) demonstrated that the Earth was round by watching the Earth's shadow on the Moon during a lunar eclipse. What were some other proofs mentioned in class that show the...
-
A 80-kg fisherman in a 132-kg boat throws a package of mass m = 15 kg horizontally toward the right with a speed of v; = 4.0 m/s as in the figure below. Neglecting water resistance, and assuming the...
-
Determine; L, Z, iT, VR, and v.
-
During a flight test, a 9000-kg helicopter start from rest at t = 0. The acceleration of its center of mass is a = 0.6t i + (1.8 -0.36t) j (m/s) The engineers want to express the total foece on the...
-
Question 8 Use the separation of variable method to find a solution to the differential equation -9y dy 16x-6x dx y 1-9yyy=8x+2x+C OA 16 e 1 gy_y=8x+2x4+C e 81 OC. No Answer is correct 1-9_2-9 = 8x -...
-
According to a recent survey, 40% of millennials (those born in the 1980s or 1990s) view themselves more as spenders than savers. The survey also reveals that 75% of millennials view social...
-
An electrical utility needs to generate 6,500 megawatts of electricity today. It has five generators. If any electricity is generated by a given generator, that generator must be started up and a...
-
Reconsider the Southwestern Airways crew scheduling problem presented in Section 7.4. Because of a blizzard in the Chicago area, all the flights into and out of Chicago (including flights 4, 6, 7,...
-
Reconsider the Little-town Fire Department problem presented in Section 6.4 and depicted in Figure 6.11. FIGURE 6.11 Due to maintenance work on the one-mile road between nodes A and B, a detour...
-
Meet local small business owners or representatives of as profit organizations. Find a company or organization that will host your team to produce a web site for them (nonmonetary, of course). Find...
-
More often than not, database environments in in organization reflect data structures that have been developed over a period of years, sometimes haphazardly, and that often reflect a variety of...
-
Although database systems have become the systems of choice for new and reengineered systems, are there any situations where a relational file-based system might be chosen instead? Explain your answer
Study smarter with the SolutionInn App