Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In R Markdown, Maximum Likelihood Estimator in Logistic Regression Suppose we have data in pairs (xi,yi) for i=1,2,...,30. Conditional on xi, yi is Bernoulli with

In R Markdown,

Maximum Likelihood Estimator in Logistic Regression Suppose we have data in pairs (xi,yi) for i=1,2,...,30. Conditional on xi, yi is Bernoulli with success probability

pi=P[yi=1|xi]=exp(0+1xi)/(1+exp(0+1xi)).

The aim is to compute the maximum likelihood estimate ^ of the parameter vector =(0,1)T.

The log-likelihood is

()=i=1n[yilog(pi)+(1yi)log(1pi)].

The data are given below:

X values:

1.34 -1.38 -0.19 -0.44 1.90 -0.80 0.91 0.26 1.37 -1.62 -0.96 1.90 0.99 1.96 -1.57 1.51 -1.61 -1.02 -0.92 -1.87 1.73 -1.23 -1.24 0.22 1.42 1.40 1.23 -0.75 1.47 -0.93

Y values:

1 0 0 1 1 0 1 1 1 0 1 1 1 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0

(a) Use the function optim()to compute ^ using initial value (.25,.75).

(b) Again, starting with (.25,.75) find the next value when using the Newton-Raphson algorithm.

(c) Assume that 0=0, and plot the likelihood function L(1) as a function of 1.

(d) Again, assume 0=0 and compute ^1 using uniroot(), a grid search, and by the Newton-Raphson algorithm. You can use the plot in part (c) to find a good initial value.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Calculus Early Transcendental Functions

Authors: Ron Larson, Robert P. Hostetler, Bruce H. Edwards

1st Edition

618879188, 618879182, 978-0618879182

More Books

Students also viewed these Mathematics questions

Question

Which of the following is NOT a relational operator? 1. =

Answered: 1 week ago