# Forecasting on multivariate time series containing quaternions

I have a multivariate time series containing 3D position data ($$x,y,z)$$ and orientation data (as quaternions) obtained from motion sensors. My goal is to forecast the future position/orientation, and for this I'm looking into use sequence models, esp. LSTMs.

A quaternion has 4 elements, one of them denoting the real/scalar part (say $$q_w$$) and the other three denoting the imaginary/vector part (say $$q_x, q_y, q_z$$). So my time series has 7 columns in total.

My question: Considering that quaternion elements only jointly have a physical meaning (spatial rotations), is it reasonable to apply multivariate forecasting to data in its current format, where $$q_w, q_x, q_y, q_z$$ are stored as different variables? Quaternions are the most compact way to denote such rotations but I still have some doubts about whether I'm neglecting the physical dependency of different quaternion elements by treating them as separate variables. Any experience/insight would be great.

Edit: This answer suggests converting from quaternions to Euler angles but this brings a discontinuity for in my data, where there is a jump from 180 to -180 degrees. So not sure if that's a good idea. Another suggestion given here is to use the forward and right vector (not sure why not just take the direction vector?) instead of any of the other rotation formalisms.