use standard deviation as predictor? My question is simple: is it statistically valid to use the standard deviation of a group of data points (X) as a predictor for Y? 
I am dealing with data that looks like this:

Well, at some point in the X values, the response just reaches an asymptotic in the mean, but the variance of the measured values keeps increasing. For each Y value, I have several experiments giving me a dozen of points.
Thus the idea of including in the model the standard deviation as explanatory variable: 
y ~ X + sd(X)

I even get an even better model with a single variable calculated as the product of the X-value by the standard deviation of its belonging group of points.
Is this OK? Can i call this a linear model still? What hypothesis should i check now?
Thanks
EDIT: (after discussion with Matthew) I add a precision to my study:
When I take a set of measures, I don't know in advance what the Y would be. However, I know by design that they are supposed to have the same value of Y, because they come from the same "batch"
 A: Going by your picture, it looks like what you are proposing is to stratify your data into layers depending on the value of $Y$, then compute the standard deviation of $X$ in each layer, then use that computed group standard deviation as a predictor.
This leaks the true value of $Y$ into your predictors.  Of course your model is more accurate, you've essentially allowed it to memorize the value of $Y$ by giving it a dictionary whose "words" are $\sigma(X)$ and whose "definitions" are $Y$.
Consider what happens if you are given a new dataset with only the values of $X$, and you want to make a prediction of $Y$.  How are you going to use your new $\sigma(X)$ predictor in this situation?  You need to know $Y$ to stratify $X$ and compute $\sigma(X)$ for each group!
Now, if you can define your groups without reference to $Y$, that's a different thing.

ok, what i don't understand still is the "leaking the value of Y into your predictors" because in the end every model uses the Y values to calculate its coefficients, so what's the difference? 

You're completely correct, all regressions use the values of $Y$ to calculate their coefficients.  Writing out the dependencies in detail, this looks like
$$ Y = \beta_0(X, Y) + \beta_1(X, Y) X_1 + \cdots + \beta_n(X, Y) X_N $$
each coefficient is a function of $Y$ (more precisely, the values of $Y$ in the training data), but each predictor is not.  In your case, you are creating a predictor that is a function of both $X$ and $Y$.  This is what I mean by "leaks the true value of Y into your predictors".

But let's assume that my method is not valid. However it gives me the smallest errors in a cross validation procedure for prediction.

Yes, it is not surprising that your cross validation error is lower.  Unfortunately, your application of cross validation is incorrect.  The correct procedure would be this


*

*Split your data into in fold and out of fold pairs.

*For each pair, compute your features using only the in fold data.

*Make predictions on the out of fold data using only the values of $X$, or features that are functions of $X$.

*Average the out of fold error rates of these predictions.


Your procedure violates the second and third bullet points.  I'd recommend taking a look at the section of Chapter 7 in The Elements of Statistical Learning titled The Wrong and Right Way to Do Cross-validation.

my stat teacher used to tell us "if you can create a predictor which is better, you don't need to explain people how you created it"

I don't mean to contradict your teacher without full context, but as stated, that is dubious advice.
A: I understood agenis to say that, in creating the std dev, he wanted to base them on bucketed X values, not Y values. If he were asking about bucketing the Y values, then Matthew Drury would be correct that this would "leak" Y into the predictors. In addition, agenis hasn't said whether or not there is a temporal dimension to the information. We're all assuming that there is not. If there is, then taking lags of Y would be appropriate and an adequate control for the issue of Y's "leakage" into the predictors. In addition, any temporal relationship would open up new classes of modeling options from nonlinear diffusion models to the many flavors of "Box-Jenkins" type methods.
There is still lots of room to play around here.
Simply bucketing the X values, e.g., creating 10 mutually exclusive groupings on X, amounts to a kind of poor-man's approach to kernel density analysis. Based on the chart and given the convex slope of the curve, one can see that these new groupings rapidly decline in their predictive power across the range of X wrt Y. Given that, it may well be that fitting 2 or 3 splines would provide a better fit than the main effects model as proposed.
If one chooses to bucket X, a consideration worth exploring is using the within bucket coefficient of variation instead of the std dev. The CV is the ratio of the std dev to the mean (times 100) and would result in a metric that is invariant and comparable across the levels of X. Why does this matter? Take two stock prices as an example. Stock 1 has an average price of 500 and a std dev of 100 while stock 2 has an average price of 50 and a std dev of 20. Which stock is more volatile? You can't look at the std devs in and of themselves to answer this question since they are scale dependent. The CV for stock 1 is 20 (100/500*100=20) and for stock 2 it is 40. Therefore and despite a smaller std dev, stock 2 has more inherent volatility than stock 1. To me, the advantages of a metric like this over a scale dependent std dev are clear. 
Another possibility would be not to bucket X and retain its continuously distributed nature with a transformation. For instance, it could be that, again based on the chart, the relationship between X and Y is exponential. Depending on the magnitude or scale of X, exponentiation could quickly result in byte overflow (values so large they don't fit into the numeric formatting). Given that risk, transforming X first with, e.g., a natural log function and then taking the exponent would be a workaround. Other transformations of X that retain its continuous nature and compress its PDF (probability density function, i.e., its tail) are also possible. There are literally dozens, if not more, transformations available in the literature. There is a book devoted to cataloguing mathematical transformations, although I forget the title.
All of the suggestions made so far involve linear functions and models based on X. Models nonlinear in the parameters are also possible but could be hairy in terms of both specification and interpretation.
At the end of the day, the question becomes one of the relative importance of prediction vs substantive interpretation of the model results. If the focus is simply on prediction, then a "black box" model that fits the data but is opaque in meaning is permissible. If strategic insights into the relationship between X and Y is the goal, then keeping things at the level, not just of the analyst, but the analyst's audience, is imperative. In this latter instance, highly technical solutions are to be avoided since it's almost certainly the case that the audience will be comprised of the technically semi-literate, at best, with a strong skew to technical illiteracy. It's every analyst's worst nightmare to be explaining something to an innumerate audience where they are the only person in the room who understands what they're talking about.
Of course, breaking the data into separate test and holdout samples (or k-folds) to evaluate the model fit "out-of-sample" and control for overfitting is mandated.
