# How to fit two (positive and negative) logistic functions using the same independent variable

My binary dependent variable (pollinator presence) responds to the independent variable (air temperature). With increasing temperatures there is a logistic increase in probability of pollinator presence (a positive logistic function), but at very high temperatures there is a second logistic decrease in probability of pollinator presence (a negative logistic function). Thus, I'd like to simultaneously fit two (positive and negative) logistic functions to one independent variable. I can do this using a custom non-linear fitting procedure using logistic functions (nls in R), but it seems that a formal/standard procedure must be available (e.g. using glm in R). The benefit of a formal approach would be the ability to compare models and easier treatment of interactions with other variables etc. Any suggestions? Presumably this type of approach is common, but not easy to find on the net. Thanks

• It seems like adding polynomials or splines would account for this in a single model.
– Noah
Sep 24, 2021 at 18:34

A common approach would be to add $$t^2$$ as a feature. i.e your linear model now will be $$sigmoid(W_1t + W_2t^2 + b)$$. This will enable the model second degree polynomial equation.
An example with $$W_1 = 2, W_2 = 0.3, b = -1$$ would result with this function: