# Using statistics to determine a trigger/threshold value between continuous variables

I'm working with a few continuous variables, as below:

# A tibble: 6 x 3
pH Log Chl-a Log Toxin
<dbl>       <dbl>       <dbl>
1  8.1        1.30         3.15
2  8.36       0.968        3.30
3  8.03       1.21         3.90
4  7.86       1.10         2.79
5  7.81       1.19         3.30
6  8.04       1.46         3.41


I know from literature there is relationship between pH and chl-a, and both would be related to toxic algae levels in a water body.

I want to establish a trigger using these variables. So, if chl-a and/or pH goes above a certain level, I can be sure that toxin levels in the water body are elevated.

Unfortunately, after looking at regression between pH vs toxin and chl-a vs toxin, the relationship looks relatively poor (R=0.26 and 0.29 respectively).

My question is, how could I set up a threshold/trigger of either chl-a, pH, or the combination of the two, to predict high toxic algae? Will regression help yield this trigger value?

Thanks!

• I think your range of pH and Log Chl-a values is too narrow. It appears like your threshold is outside of these ranges. You need to collect more data. Sep 2, 2021 at 7:57

One method is to learn the "threshold-response" function $$v \mapsto E_WE[Y|A \geq v, W]$$ where $$Y$$ is your outcome, $$A$$ is your continuous variable of interest, and $$W$$ are variables to adjust for. You could plot this as a function of the threshold $$v$$ and see if there is any natural threshold or choose a threshold that leads to a sufficiently high average outcome.
An easy way to implement this is to estimate $$E[Y|A \geq v, W]$$ for each $$v$$ separately using for instance linear regression or generalized additive models. Then average the predictions across all observations to get your estimate. Specifically, perform the regression of $$Y$$ on $$W$$ using only observations with $$A\geq v$$ for each threshold $$v$$. If inference is wanted, there are ways to get this as well.
If you have multiple thresholds for different continuous variables, you can also estimate $$(v_1,v_2) \mapsto E_WE[Y|A_1 \geq v_1, A_2 \geq v_2, W]$$ for a grid of thresholds $$v_1,v_2$$ and then visualize the estimates with a 2d plot.