Problems with parameter estimation in R for an SIRD model
I’ve made an SIRD model using the deSolve package for the spread of COVID-19 in early 2020 in Mexico. It involves 4 parameters and I am now trying to estimate the values of these parameters using it’s predicted values of D and an optimising sums of squared distances to the true data approach. I tried making a function that takes parameter values from my model as an input and returns the sum of squared distances from the true data for these parameter values, I then tried defining a new function in terms of this first one that vectorises the parameters so I can use the optim() function on it. (The function “sird_1” runs the model for the parameters specified in it’s argument and I know it works as intended) This is my code: