Question: 1. Consider the Szeged Weather Data from the midterm project. The average temperature across all years/months is about 12 degrees- Create a new binary variable

1. Consider the Szeged Weather Data from the
1. Consider the Szeged Weather Data from the midterm project. The average temperature across all years/months is about 12 degrees- Create a new binary variable that is 1 if the given monthfyear is greater than or equal to 121 and 0 otherwise. For the questions below1 you may compute any grmlients/hcssiaas numerically, but you are to write your own optimization code unless told to do otherwise. (a) Writing out your own gradient descent aigorithm1 t a logistic regression model with your new variable as the outcome and WindSpeed as the predictor. Cheek your answer using both the optim function as well as gim. (b) New repeat (a), but using Newton's method (Le. use the Hessian as well as the gradient). Compare the number of iterations it took to converge with the number from (a). (e) We are now going to add on a penalty to the logiikelihood s (130.51} = ma; M3? Write an R function that takes A 2 {l as its input and returns the minimizer of the above function using gradient descent. Evaluate this function for several values of A and piot [31 as a function of A. How does A inuence the estimate

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!