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.

Use the temperatures to sort your data (from low to high temperatures). Then, run a test for structural breaks (e.g. cusum, or Bai-Perron) on the random numbers (as if they were a time series).
If the software you use to run the structural break tests asks you to frame your model as a regression model, then make it a regression of the random numbers on a constant only.
Under the null hypothesis that temperatures have no effect, which you want to test, the sorting has no impact on the distribution of the test statistic. Therefore any test for structural breaks provides valid inferences.
Both cusum and Bai-Perron (mentioned above) detect the breakpoint (in your case the temperature threshold) automatically, so that you do not have to pick it with a separate optimization (that would affect the distribution of the test statistic).
Here is the R code for breakpoint detection with the Bai and Perron method (apologies, I am not very familiar with R). In this example, the breakpoint is detected almost perfectly by the algorithm.
n_obs <- 4000
temperature_threshold <- 1.5
increase_if_above_threshold <- 0.5

library(strucchange)
set.seed(1)

random_numbers <- rnorm(n_obs)
temperatures <- rnorm(n_obs)

for (j in 1:n_obs) { 
  if (temperatures[j] > temperature_threshold) {
    random_numbers[j] <- random_numbers[j] + increase_if_above_threshold
  }
}

df <- data.frame(random_numbers, temperatures)
df <- df[order(df$temperature),]
row.names(df) <- NULL

results <- breakpoints(df$random_numbers ~ 1, 0.01, 1)
estimated_threshold <- df$temperatures[results$breakpoints]
print(paste0("Threshold estimated with Bai and Perron's method: ",  estimated_threshold))

And here is the code for testing the null hypothesis of absence of breakpoints:
f_statistics = Fstats(df$random_numbers ~ 1, 0.01)
test_H0_no_breakpoints = sctest(f_statistics, "supF")
print(paste0("P-value for the null hypothesis of no breakpoints: ", test_H0_no_breakpoints$p.value))

P.S.: the idea of using methods for breakpoint detection in time series to tackle non-linearities in non-time-series data is not new. It goes back at least to West, M. and J. Harrison (1997), Bayesian forecasting and dynamic models, Second Edition, Springer Verlag, New York.
