1

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)
Ian
  • 47
  • 1
  • 5

2 Answers2

4

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

dww
  • 30,425
  • 5
  • 68
  • 111
  • This is really helpful! I have a slightly different Gompertz equation that I am trying to calculat the inverse of Lt <- 2.825 * exp(3.623 * (1 - exp(-2.877 * t ))) – struggleBus Oct 29 '21 at 21:18
1

The form of the Gompertz in SSgompertz is:

y = Asym*exp(-b2*b3^x)

So the inverse is:

x = log((log(y / Asym) - log(Asym)) / -b2) / log(b3)

Which can be simplified to:

x = log( log(y / Asym) / -b2) / log(b3)
mikoontz
  • 592
  • 5
  • 11