How to process panel data for use in a recurrent neural network (RNN)
<p>I have been doing some research on recurrent neural networks, but I am having trouble understanding if and how they could be used to analyze panel data (meaning cross-sectional data that is captured at different periods in time for several subjects -- see sample data below for example).Most examples of RNNs I have seen have to do with sequences of text, rather than true panel data, so I'm not sure if they are applicable to this type of data.</p>

<p>Sample data:</p>

<pre><code>ID    TIME    Y    X1    X2    X3
1     1       5     3     0    10
1     2       5     2     2    6
1     3       6     6     3    11
2     1       2     2     7    2
2     2       3     3     1    19
2     3       3     8     6    1
3     1       7     0     2    0
</code></pre>

<p>If I want to predict Y at a particular time given the covariates X1, X2 and X3 (as well as their values in previous time periods), can this kind of sequence be evaluated by a recurrent neural network? If so, do you have any resources or ideas on how to turn this type of data into feature vectors and matching labels that can be passed to an RNN (I'm using Python, but am open to other implementations).</p>

<p>I find no reason in being able to train neural network with panel data. What neural network does is that it maps one set of values with other set of values who have non-linear relation. In a time series a value at a particular instance depends on previous occuring values. Example: your pronunciation of a letter may vary depending on what letter you pronounced just earlier. For time series prediction Recurrent Neural Network outperforms feed-forward neural networks. How we train time series with  a regular feed-forward network is illustrated in this picture. <a href="http://www.obitko.com/tutorials/neural-network-prediction/images/train.gif" rel="nofollow">Image</a></p>

<p>In RNN we can create a feedback loop in the internal states of the network and that's why RNN is better at predicting time series.
In your example data one thing to consider : do values of x1, x2, x3 have effect on y1 or vice-versa ? If it doesn't then you can train your model as such x1,x2,x3, y4 are same type of data i.e train them independently using same network (subject to experimentation). If your target is to predict a value where their values of one has effect on another i.e correlated you can convert them to one dimensional data where single time frame contains all variants of sample type. Another way might be   train four neural networks where first three map their time series using RNN and last one is a feed-forward network which takes 2 inputs from 2 time series output and maps to 3rd time series output and do this for all possible combinations. (still subject to experimentation as we can't surely predict the performance of neural network model without experimenting)</p>

<p><strong>Reading suggestion:</strong> Read about "Granger causality", might help you a bit.</p>

python recurrent-neural-network panel-data