After modelling a series of data to the Gompertz equation, I would like to predict the value on the x axis from the outputted parameters for a given y. However, predict() only predicts the y values for given x's and inverse.predict() only does this for single values and not from nlsList values.
Is there a straightforward way to do this?
#Example data
data<-data.frame(x=c(0,1,2,4,8,16,32,64,0,1,2,4,8,16,32,64,0,1,2,4,8,16,32,64),y=c(70,90,160,250,410,510,610,650,NA,NA,NA,NA,NA,NA,NA,NA,70,90,160,250,410,510,610,650),GROUPING=c(1,1,1,1,1,1,1,1,45,45,45,45,45,45,45,45,643,643,643,643,643,643,643,643))
Parameters<-nlsList(y~SSgompertz(x, Asym, xmid, scal)|GROUPING, data=data, na.action = na.omit)
Value_of_y<-300
inverse.predict(Parameters, Value_of_y)
The general form of a Gompertz function is
G=A*exp(-k1*exp(-k2*t))
We can calculate the inverse of this function analytically, so no need to use inverse.predict:
t=log(k1/log(A/G))/k2