# Starting values for an nls model in R [duplicate]

I'm trying to fit an exponential model using nls, but I don't know how to select the starting values for the parameters. I know this question has been answered multiple times, but I spent some days surfing on forums and I couldn't find the solution for my particular case. Here they showed the very same problem, but the solution of liniarizing the data taking logs doesn't work wor me, because the fit of the transformed data is not linear. I would really appreciate a piece of advice here.

Here an example of my kind of data:

mes1 <- data.frame(CO2=c(354.68, 362.43, 374.12, 380.45, 385.92, 394.19, 400.2, 405.85, 407.81, 410.71, 414.77), time=c(1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101))

CO2i <- mes1$$CO2[1] Timei <- mes1$$time[1]
exp_eq <- function(time,B,CO2i,a,Timei){B + (CO2i- B)^(-a*(Timei-time))}


I know other kind of equations might work better, but I must use this one since is the reference in the field. The only thing I need is estimate the initial values for a and B

m <- nls(CO2 ~ exp_eq(time,B,CO2i,a,Timei)), data = mes1, start = list(B = 1, a = 1))


• Sure you can--it is, after all, just an estimate to get things started. But you need to assign the estimate to the correct variable: as time increases, the function approaches $B,$ not $C_0,$ in the limit. At the initial time, the function's value is$C_0.$ It's usually a good idea to graph your data and graph the function associated with your initial estimate to make sure they are reasonably close. – whuber Feb 17 '20 at 17:32