Is a Logistic Regression always viable for having a dichotomous response variable?

I have learned some about a simple logistic regression with one explanatory variable (quantitative) and one response variable (binary: $$0$$ or $$1$$)

Generally the plot for such a set of data may look like this:

Then we can run a logistic regression to find a model to fit the data.

However, it looks as if in general the rule for the model is, the higher we let our explanatory variable be, the higher the probability that we would have a success.

What if our data suggested otherwise, and instead going too high would end up giving a response variable of $$0$$ again. Another way to ask my question is, what if our data looks a little something like this:

Would a logistic model even be viable still in this situation? If not, then what kind of nonlinear regression would represent something like this?

Thanks for any clarification given.

• You can enter $x$ into the model as a quadratic term, so logistic regression is viable. Is this an extreme example of the relationship you would like to estimate with logistic regression? – Heteroskedastic Jim Oct 23 '18 at 20:04
• I see what you mean, I apologize for not explaining it, but what instead of having $x$ values ranging from $-5$ to $5$ instead they ranged over an interval where both endpoints are positive? Say, $10$ to $15$? This is what I'm asking, regardless of my endpoints of the interval, not just the ones where they happen to span both positive and negative values for $x$. My example just so happened to be closely symmetric around $0$ – WaveX Oct 23 '18 at 20:09
• Does not matter, that's why you have both $x$ and $x^2$ in the model. – Heteroskedastic Jim Oct 23 '18 at 20:13
• I posted a worked example of such a U-shaped logistic regression at stats.stackexchange.com/a/64039/919. It reflects a different technique--the circumstance there suggested a nonstandard link function rather than introducing nonlinear functions of the regressors. – whuber Oct 23 '18 at 21:27
• @Phil it would, you're almost in separation territory. That's why I asked OP if this extreme example was really like the data OP has or is only for demonstration purposes. – Heteroskedastic Jim Oct 24 '18 at 11:20