$30.00
Description

Suppose ( _{#}, _{%}, … , _{‘}) is a random sample from a Bernoulli distribution where ~ ( ) with probability mass function, pmf of Y
( _{1} ) = ^{4}5(1 − )^{#84}5; _{1} ∈ {0,1; 1 = }


Find maximum likelihood estimate of . (5 marks)



In five independent Bernoulli trials from above Bernoulli process, three successes and two failures were observed. Calculate the maximum likelihood estimates of in this situation? (5 marks)



Plot the log likelihood function for the data in part ii by performing a grid search over a set of possible values of parameter. Add a vertical line to the plot at the value of that maximizes the loglikelihood. (3 marks)


Consider the case of simple logistic regression where is the binary dependent variable and is the predictor variable with sample data ( _{#}, _{#}), ( _{%}, _{%}), … . , ( _{‘}, _{‘}) . Binary outcomes are modeled as Bernoulli trials as in Question 1 above. Here
( _{1} _{1}) = _{1}^{4}5(1 − _{1})^{#84}5; _{1} ∈ {0,1; 1 = }
^{E}F^{GE}H^{I}5
^{1} ^{=} _{1 +} E_{F}GE_{H}I_{5}

Derive the loglikelihood function, ( ) where= ( _{M}, _{#}). (3 marks)

Write a function, ll(), to calculate the log likelihood. (3 marks)

Using Default data in the book, ISLR, fit a logistic regression model to predict default given balance as a predictor using glm(). (3 marks)
IV. Use optim() function together with your ll() and initial parameter estimates as
zero to calculate maximum likelihood estimates of regression coefficients in part
iii. (3 marks)

Comment on the maximum likelihood estimates obtained using your work and using glm() in part iii. (1 mark)

VI.
Calculate the standard errors of your estimates. Hint: Include the parameter option
‘hessian = TRUE’ in the function optim() when you call optim() in part iv. (3
marks)
VII.
Comment on the standard error estimates obtained using your work and using
glm() in part iii. (1 mark)
Chapter 5, Q6 on page 199

We continue to consider the use of a logistic regression model to predict the probability of default using income and balance on the Default data set. In particular, we will now compute estimates for the standard errors of the income and balance logistic regression coeﬃcients in two diﬀerent ways: (1) using the bootstrap, and (2) using the standard formula for computing the standard errors in the glm() function. Do not forget to set a random seed to 100 before beginning your analysis.

Using the summary() and glm() functions, determine the estimated standard errors for the coeﬃcients associated with income and balance in a multiple logistic regression model that uses both predictors. (2 marks)

Write a function, boot.fn(), that takes as input the Default data set as well as an index of the observations, and that outputs the coeﬃcient estimates for income and balance in the multiple logistic regression model. (3 marks)

Use the boot() function together with your boot.fn() function to estimate the standard errors of the logistic regression coeﬃcients for income and balance. (3 marks)
IV. Comment on the estimated standard errors obtained using the glm() function and using your bootstrap function. (2 marks)