# Assignment 9: Maximum likelihood model fitting

*** Due date: Start of class in Week 10 ***

## Part 1: Compute the log-likelihood for one value of sigma (4 points)

• Follow along with the notes to write a script that computes the log likelihood for one value of sigma
• Convert that script into a function that can compute the log likelihood for any value of sigma

## Part 2: Compute the posterior (4 points)

• Use your function to compute the log-likelihood for a bunch of different sigma values
• Plot the log-likelihood vs sigma
• Convert your log-likelihood into a posterior distribution
• Plot the posterior as a function of sigma

## Part 3: Compute the posterior for subject number 2 (2 points)

One advantage of the Bayesian approach is that it works nicely with small amounts of data. In these cases your resulting distribution over sigma is usually wider - reflecting the increased uncertainty that comes with less data. In this part we're going to compute the posterior for just one participant - participant number 2.
• Compute and plot the posterior for subject number 2. You can get this person's data using
rsk(2,:)
• What's (roughly) the best fitting value of sigma for this person? How uncertain is the model about this estimate?

## Part 4: Compute the posterior for more subjects (2 extra credit points)

• Compute the posterior for a bunch more subjects (10 or more) and plot these posteriors o on the same figure.
• Some of these posteriors will likely be very wide indeed (e.g. subject number 1) and usually these are for participants with large sigma values. Why is the model more uncertain about the value of sigma when it is large?