I am working on some data on thermal performances on my organism for my thesis. I came across the Ricker Model which is a right skewed curve as shown below.

enter image description here

How can I modify it to become a left skewed curve with a peak to the right hand side at higher x values. Hence, performance of the organisms slowly increases from at smaller x values until it hit an optimum, then decreases as x continues to increase.

This is the general form to which my data conform, but I don't know much about models and equations to find one to would fit my data set and explains the biology observed.

So far, I have been this coding below to fit my data. However, the initial increase is a little to abrupt compare to what is measured.

fit <- glm(y ~ exp(x)) + x,
       family = gaussian(link = "log"),
       data = df)

enter image description here

Pointers, help, comments are extremely appreciated! Thank you.

  • $\begingroup$ Would you please post a link to the data? $\endgroup$ Sep 24, 2018 at 12:23
  • $\begingroup$ drive.google.com/file/d/1yXhHGiOkx8r2SaXIUnaWDFutlTOy80fB/… Here's the link to the data file. There are two dependent variables independent of each other, but their distribution both conform to the same shape with temperature as the independent variable. $\endgroup$
    – Rhyn
    Sep 24, 2018 at 17:17

1 Answer 1


After reading some papers for mathematical models in thermal biology, I tested out a few equations: gaussian function, lactin 2 function, and the logan 6 function (Krenek et al., 2011) and got some solutions AND more questions! Below are the plot and AIC results:

enter image description here

AIC(lactin) = 126.6063
AIC(logan) = 112.1064
AIC(gaussian) = 110.6587

As you can see, visually the best fitting curve is the one produced by the Lactin 2 model, however, it has the highest AIC values and the peak occurred slightly later (25.5°C) than where I would like it to be (24°C). The Gaussian model has the best AIC value, but I don't know if it's peaking a little too early?

Which model should I pick given the shape of fitting and the AIC values? If I should go for the Lactin 2 model, how can I change where the peak occurs?

My data: https://drive.google.com/file/d/1yXhHGiOkx8r2SaXIUnaWDFutlTOy80fB/view

My codes:

#### Thermo-Models ####
gaussian <- nlsLM(etr ~  L*exp(-0.5*((tmp-tmpo)/sigma)^2), start=list(L = 10, sigma = 2, tmpo=16.5), 
                  data=etr, trace=TRUE, control=nls.lm.control(maxiter=200))

logan <-  nlsLM(etr ~ a*(1/(1+k*exp(-1*p*tmp)))-exp((-tmpm+tmp)/(24-tmpm)), start=list(a=15, k=20, p=0, tmpm=30),
                data=etr, trace=TRUE, control=nls.lm.control(maxiter=100))

lactin <- nlsLM(etr ~ exp(-1*p*tmp) - exp(p*tmpm-(tmpm-tmp)/(tmpm-24)) + L, start=list(p=0, tmpm=30, L=1000),
                data=etr, trace=TRUE, control=nls.lm.control(maxiter=100))

#### Plot ####
p_etr <- ggplot(etr, aes(x=tmp, y=etr)) +
  geom_point(size=2) + 
                  data = etr,
              method = "nlsLM",
              formula = y ~  L*exp(-0.5*((x-tmpo)/sigma)^2),
              se = FALSE,
              method.args = list(start=c(L = 10, sigma = 2, tmpo=16.5))) +
  theme_bw() +
  theme(plot.background = element_blank(),
        panel.grid.major.y = element_blank(),
        panel.grid.major.x = element_blank(),
        panel.grid.minor.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        axis.title = element_text(size=16, colour="black"),
        axis.text = element_text(size=10, colour="black"),
        strip.text = element_text(size = 9, colour="white"),
        strip.background = element_rect(size = 50)) +
  ylab("Means") + 
  xlab("Temperature (°C)") +
  scale_x_continuous(breaks = c(16.5, 18, 19.5, 21, 22.5, 24, 25.5, 27))
p_etr <- p_etr + 
              data = etr,
              method = "nlsLM",
              formula = y ~ a*(1/(1+k*exp(-1*p*x)))-exp((-tmpm+x)/(24-tmpm)),
              se = FALSE,
              method.args = list(start=c(a=15, k=20, p=0, tmpm=30)))
p_etr + 
              data = etr,
              method = "nlsLM",
              formula = y ~ exp(-1*p*x) - exp(p*tmpm-(tmpm-x)/(tmpm-24)) + L,
              se = FALSE,
              method.args = list(start=c(p=1, tmpm=30, L=1000))) +
                     labels=c("Lactin 2","Logan 6","Gaussian"),
  • 1
    $\begingroup$ This plot appears to have over 30 individual data points in the scatterplot, yet the linked data has less that 30 data points. Would you please verify the linked data? $\endgroup$ Sep 28, 2018 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.