# How to add knots to auto.arima() regressors?

I am using forecast package in R by Rob Hyndman. I am using the auto.arima() function and I have various regressors.

One of my regressors is temperature values, including both negative and positive values. I only want the temperature regressor to be effective when it is below 0 and I want the other values to be ignored.

Similarly I have another regressor (Production Prognosis) which has values that are greater than 0 Ranging from 200 to 5000. I only want to use this regressor for its values below 1000.

What is the best way to do this?

• Couldn't you simply set all temperatures above 0 to exactly 0? It's a model linear on innovations and levels/differences after all. – Firebug Dec 12 '17 at 17:32
• @Firebug - if you expand that comment somewhat and make it an answer, I'd vote for it. – jbowman Dec 12 '17 at 17:33
• @Firebug I could do that but is it a good solution? Is it the same as setting them all at 1000 degrees? I am not sure which one is the best solution and how to make sense of it. Also for the data ranging from 200 to 5000 how should I deal with data above 1000, setting them to 0 again? – Rafadan Dec 12 '17 at 17:42

Given the ARMAX model below, where $\phi_p(B)$ and $\theta_q(B)$ are backshift operators with lag orders $p$ and $q$:
$$\phi_p(B) y_t=\beta \cdot x_t+\theta_q(B)\epsilon_t$$
What you want is to incorporate an indicator variable telling if $x_t$ is contained in an interval $\tau$. Therefore, you actually end with the following model, which is simply allowing different slopes per category
$$\phi_p(B) y_t= \beta_{(x_t \in \tau)} \cdot I_{(x_t \in \tau)} \cdot x_t+\beta_{(x_t \not\in \tau)} \cdot I_{(x_t \not\in \tau)}\cdot x_t+\theta_q(B)\epsilon_t$$
As you said you don't want to use the exogenous variable if it's outside the interval, $\beta_{(x_t \not\in \tau)}=0$, so $$\phi_p(B) y_t= \beta_{(x_t \in \tau)} \cdot I_{(x_t \in \tau)} \cdot x_t+\theta_q(B)\epsilon_t$$
See $x_t^*=I_{(x_t \in \tau)} \cdot x_t$ is simply using $x_t$ if $(x_t \in \tau)$, and using $0$ when $(x_t \not\in \tau)$, resulting in a simple ARMAX like $$\phi_p(B) y_t= \beta_{(x_t \in \tau)} \cdot x_t^*+\theta_q(B)\epsilon_t$$