# What are some left skewed models for curve fitting?

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. 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,
data = df) Pointers, help, comments are extremely appreciated! Thank you.

• Would you please post a link to the data? – James Phillips Sep 24 '18 at 12:23
• 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. – Rhyn Sep 24 '18 at 17:17

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: 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 codes:

#### Thermo-Models ####
library(minpack.lm)
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))
AIC(gaussian)

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))
AIC(logan)

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))
AIC(lactin)

#### Plot ####
library(ggplot2)
p_etr <- ggplot(etr, aes(x=tmp, y=etr)) +
geom_point(size=2) +
geom_smooth(aes(color="red"),
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 +
geom_smooth(aes(color="green"),
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 +
geom_smooth(aes(color="blue"),
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))) +
scale_color_manual(name="Models",
labels=c("Lactin 2","Logan 6","Gaussian"),
values=c("red","blue","green3"))

• 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? – James Phillips Sep 28 '18 at 12:40