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)
stepbystep guide to implement the Bayesian inference for estimating the bi... 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)...
-
The horizontal x axis is drawn through the centroid C of the area shown and divides the area into two component areas A1 and A2. Determine the first moment of each component area with respect to the...
-
McNulty et al. (2008) also found a relationship between a persons attractiveness and their relationship satisfaction among newlyweds. Using the same data as in Tasks 1 and 2, find out if this...
-
Find an article about writing summary judgment motions from the courts perspective. What tips are given for writing a summary judgment motion?
-
After five years with a national CPA firm with mostly large manufacturing clients, Amy Kimbell joined Hi-Quality Productions Inc. (Hi-Q) as manager of Manufacturing Accounting. Amy has both CPA and...
-
Cost of capital is 9.97% annually. Both are independent projects. a. What is the financial manager's goal in selecting investment projects for the firm? Explain the capital budgeting process and how...
-
John Parsons (123-45-6781) and George Smith (123-45-6782) are 70% and 30% owners, respectively, of Premium, Inc. (11-1111111), a candy company located at 1005 16th Street, Cut and Shoot, TX 77303....
-
The company "Chicks say", orders chicks from the central hatchery of the company "Pio, Pio, Pio". Every day of the 360 days of the year, 22 and a half dozen chicks are requested. It costs 40 CU to...
-
Weighted Average Shares At the beginning of 2 0 1 9 , Hardin Company had 3 4 0 , 0 0 0 shares of $ 1 0 par common stock outstanding. During the year, it engaged in the following transactions related...
-
On December 31 of 2022, Tkaronto Corp. had 750 units in inventory of its product, which cost $15 per unit to produce. During January 2023, the company produced 1000 units at a cost of $17 per unit....
-
On January 1, 2023, Stream Company acquired 25 percent of the outstanding voting shares of Q-Video, Incorporated, for $718,000. Q- Video manufactures specialty cables for computer monitors. On that...
-
A marketing research organization made contact with a major consumer food company (Barilla) to conduct a large scale segmentation study with the objective of improving market share. 1) The Researcher...
-
As shown in the figure below, a 2.25 kg block is released from rest on a ramp of height h. rough patch m 15.0 cm When the block is released, it slides without friction to the bottom of the ramp, and...
-
One item is omitted in each of the following summaries of balance sheet and income statement data for four different corporations, AL, CO, KS, and MT. Enter the missing amounts. Beginning of the...
-
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...
-
Is $\mathrm{O}(2)$ an Abelian or a non-Abelian group?
-
Let $G$ be the group of discrete transformations that leave a rectangle invariant (with the composition law given by subsequent application of two transformations as the group product), including the...
-
Prove that the cyclic group of order 3 does not have proper subgroups.
Study smarter with the SolutionInn App