[WMMY] 9.14
This lecture as: slideshow (html), Rmarkdown (Rmd), notes (pdf).
The entire module: notes (pdf).
Logistic regression: The dataset Default also contains a variable balance giving the balance on the costumer’s account.
Find a logistic regression model for the probability of default as a function of balance. Compute the maximum likelihood estimates numerically.
Compare with the output from glm.
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.
theta is a vector of three parameters and the formula for computing px is different).Suppose that X has a binomial distribution Binom(n, p) (see Lecture 1.2).
What is the maximum likelihood estimator (MLE) of p?
Plot the log likelihood function for n = 10 and X = 5.
Plot the log likelihood function for n = 100 and X = 50.
Plot b) and c) in same figure. How and why are they different?
Use the optim() function to find the MLE of p numerically in both cases.
Compare the result from e) to the result using the theoretical formula from a)
Finish old exercises.