Question: quick note: here we took the same prior for 1 and 2 . One can consider different priors. For example, if we believe that sometime

quick note: here we took the same prior for 1 and 2. One can consider different priors. For
example, if we believe that sometime around week 30 the pattern changed, then we can define
different values of considering separate averages for , one for W30 and the other for
W30. But, be aware that this will have a minimal effect on our final conclusion.
Our model has 3 parameters, 1;2 and Ws. We are going to find the posterior of these three
parameters to infer that how much we believe in the change in Bob's tweeting pattern and when
is the most likely week for this change?
e) Use numpy.linspace to create two variables with 150 array in the interval of 25 and 50. These
variables are defined as the model space that we want to search for posterior of 1 and 2. You
have also defined an array in part a which shows the week number. This provides a space for Ws.
Consider all these points as a 3-D mesh-grid, how can we find posterior for each point in the 3-D
space given all the information you have? Use Bayes' theorem to elaborate your method in detail.
f) Write a code to find marginalized-posterior for 1,2 and Ws. Plot posteriors for 1 and 2 in
the same figure and create a bar plot for posterior of Ws in a separate figure. Running your code
for this part may take a long time since you compute posterior for every single point in your
model space. However, we will learn more efficient way, Markov chain Monte Carlo (MCMC),
later in the next homework.
g) How is your belief updated about a sudden change in Bob's tweeting habit? Can you estimate
the week when tweeting pattern changed? Use marginalized 2-D posteriors of 1 and 2 to obtain
P(2-1>5). This shows the probability that Bob's weekly tweet counts has increased by five
at some point.
quick note: here we took the same prior for 1 and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!