[R-sig-dyn-mod] question about the limit of conversion rate

Thomas Petzoldt Thomas.Petzoldt at TU-Dresden.de
Mon Jun 24 23:25:22 CEST 2013


Try the following instead of the if block:

   K12 <- K12 * (1 + tanh(1e3 * (S1/V1 - 0.2))) / 2


where the "1e3" determines steepness of the transition:


x <- seq(0, 0.4, 1e-4)
plot(x, (1 + tanh(1e3*(x - 0.2)))/2, type = "l", col = "red")
abline(v = 0.2)


As a positive side effect, smooth transition (instead of "if") makes the 
model faster.

ThPe



More information about the R-sig-dynamic-models mailing list