How to prove statistically that mean jumps when a parameter crosses an unknown threshold value? We have a random numbers generator (it is actually a physical device standing outside of our building). By collecting of about 3000 numbers, generated by the device, we came to the conclusion that the mean of the generated numbers is positive (although it is close to zero). The statistical significance of this conclusion is quite good.
Recently we started to suspect that when temperatures outside are high, the device tends to generate slightly smaller numbers. Even more, we suspect that when temperature is above a threshold temperature, the mean of the generated numbers is negative (although we do not know what is exactly the value of this threshold temperature).
I also need to add, that we have a reason to believe, that the dependency of the mean of the generated numbers on the temperature is a step function. To make it more clear, we believe that when temperature is high enough two parts of the device disconnect from each other and the device switches to a new "regime" (associated with the generation of presumably smaller numbers).
So, my question is, how can we calculate the statistical significance of our hypothesis that there is a temperature triggered switch in the mean of the generated numbers?
We could, for example, find a value of the threshold temperature empirically such that the mean of the numbers, generated by the device, is negative and as low as possible and then we could calculate the statistical significance that the mean of these values is really negative (in the statistical sense). However, I guess that this approach is false, since we have manually chosen the split such that numbers corresponding to the high temperature are small, so it is not fair to prove if they have statistically significant negative mean.
In other words, would a threshold value of the temperature be given, we could just check if we have a statistical evidence to believe that values, corresponding to the high temperatures, have negative mean.
ADDED:
My question is not about physics. The "physical device" does not exists. I made the example just to make it less abstract and easier to grasp.

You could consider "post-selection inference" methods. This is a collection of approaches to getting p-values (or confidence intervals) for a selected model's parameters, designed to be valid given that you ran model-selection first instead of using a model chosen a priori. In your case, the "model selection" consists of using your dataset to choose a temperature changepoint, before you use the same dataset to test for statistical significance of this changepoint.
Take a look at Hyun et al. (2020), "Post-selection inference for changepoint detection algorithms with application to copy number variation data," Biometrics:
https://onlinelibrary.wiley.com/doi/10.1111/biom.13422
Preprint version:
https://www.stat.cmu.edu/~ryantibs/papers/binseginf.pdf
The basic idea, as I understand it: Find the temperature changepoint on your real dataset. Compute a test statistic for comparing the means of the response-variable, below vs above this estimated changepoint. Then, when you compare this test statistic against a null distribution... do not build this null distribution from all datasets where the null hypothesis of no-difference-in-means is true. Instead, build the null distribution only using those null datasets that also would have chosen the same changepoint as your real dataset did.
The clever math for how to do this is in the paper, and they also provide associated R software:
https://github.com/sangwon-hyun/binseginf/
Hyun et al. also mention a much simpler data-splitting approach. (It has less power, but might be good enough if your dataset is large.) First sort your dataset by temperature, and split it in half in alternating order: all the odd indices vs all the even indices. Then simply estimate your changepoint on one dataset, and use a usual t-test on the other dataset.
