# SARIMAX: transforming the exogenous variables

I am trying to build a (S)ARIMAX model where the endogenous variable (daily stock log-returns) has already been transformed: the log returns are the first difference of the logs of the daily stock price. This should make the time series of the endogenous variable roughly stationary.

Does it mean that I need to similarly transform the exogenous variable (daily trade volume)?

The exogenous variable is on a different scale - it denotes counts of shares (i.e. integer-valued and well above 10^8) rather than price (a float smaller than 200) and exhibits a different pattern - for the observed period the trade volume drops while the stock price increases.

You could difference the exogenous variable and then go from there, however, you don't necessarily have to. For example, you could model daily log stock returns with the daily trade volume of the previous day.

I would work with the original (observed) data ( properly scaled to be commensurate) and after having treated/detected anomalies via Intervention Detection and evolved a possible representation (SARIMAX) including the latent deterministic structure ... I would consider examining the residuals to ascertain whether there was a systematic behavior between the level of the series and the error variance or whether GLS was more appropriate.

This thread Incorrect Lambda value with Box-Cox transformation on time series data in python might help further

• Thanks. What do you mean by "properly scaled"?
– Nick
Commented Dec 21, 2019 at 20:58
• You allude to counts of shares being HUGE ... They should be coded down to the same size as the y variable as numerical problems can be avoided in this manner, " commensurate ... corresponding in size or degree; in proportion" Commented Dec 21, 2019 at 21:03
• Thanks! Shall I just use some sort of scaling for both the independent and dependent variable (e.g. MinMaxScaling or StandardScaling)? Shall I do this on the raw data - i.e. before doing the transformation (log-differencing)?
– Nick
Commented Dec 21, 2019 at 21:34
• yes ... and stay way clear of transformations unless you have a theory or the box-cox test suggests a power transform of the dependent series . stats.stackexchange.com/questions/18844/… Commented Dec 22, 2019 at 0:14