Question: Using R: The logistic regression model from Question 3 can be extended to more variables, by defining the probability p ( x ) = 1
Using R: The logistic regression model from Question can be extended to more variables, by defining
the probability
a Write a function momentdistancefi that receives the name of an aftershock file,
and returns a dataframe with three columns: the mainshock seismic logmoment log
of moment in allevents.csv the distance between the mainshock and the possible
aftershock location computed assume that the mainshock is at the centre of the grid of
points in the aftershock file and column with the presenceabscence of an aftershock.
Use the column names moment, distance, aftershock, and note that the moment is the
same for all the rows, since we are looking only at one mainshock event. Display the first
few rows of the dataframe obtained by applying this function to BHUJINYAGI.
b Implement a function fitX X Y that minimises the negative loglikelihood
function in Question and returns the values of Use optim in or
scipy optimize.minimize in Python, and do not use the derivative of Obtain the
values of for BHUJINYAGI using moment for distance for and
aftershock for
c Implement a function fitfilefi that returns the values of for the af
tershock file fi using moment for distance for and aftershock for Plot
the values of vs and vs in two separate plots, one point for each event in
selectedEvents.csv
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
