Applied statistics (DVML, MATØK)

Frontpage Lecture plan Vidcasts Datasets R install help

Likelihood and maximum likelihood estimation

Literature

[WMMY] 9.14

Lecture material

This lecture as: slideshow (html), Rmarkdown (Rmd), notes (pdf).

The entire module: notes (pdf).

Exercises

  1. Logistic regression: The dataset Default also contains a variable balance giving the balance on the costumer’s account.

    1. Find a logistic regression model for the probability of default as a function of balance. Compute the maximum likelihood estimates numerically.

    2. Compare with the output from glm.

  2. One may also consider a multiple logistic regression model, where the probability of default depends on both balance x1 and income x2 as follows:
    $$p(x_1,x_2)=\frac{1}{1+e^{-(\alpha + \beta_1 x_1 + \beta_2 x_2)}}.$$
    That is, if we fix the value of x1, then p(x1, x2) is a logistic function of x2 and vice versa.

    1. Use numerical maximum likelihood estimation to estimate the parameters α, β1, β2 (you can follow the example from the lecture, the only difference being that theta is a vector of three parameters and the formula for computing px is different).
  3. Suppose that X has a binomial distribution Binom(n, p) (see Lecture 1.2).

    1. What is the maximum likelihood estimator (MLE) of p?

    2. Plot the log likelihood function for n = 10 and X = 5.

    3. Plot the log likelihood function for n = 100 and X = 50.

    4. Plot b) and c) in same figure. How and why are they different?

    5. Use the optim() function to find the MLE of p numerically in both cases.

    6. Compare the result from e) to the result using the theoretical formula from a)

  4. Finish old exercises.