# How to organize time series and make nice figures

Hi all,

I have a single time series "A", and the length of the series is 32 years. The series start in 1983 and last observation is in 2014. The single time series "A" store in a separate file. I have a multi series 1, 2, 3, 4, ….N which are generated series. They are stored in B and with length 50 years.

Problem: How can I stack the single series A (1x32) and the multi series B (Nx50) with A on the top, and GRAPH the time series? Note that the single series A starts in 1983 ends in 2014 and the multi-series starts in 2015.

Regards, TL

edit retag close merge delete

Sort by » oldest newest most voted

One simple way would be to insert the same observed values A into all the columns of B series before the generated data. When plotted there would be one line up until start of B after which the lines would show the differences.

more

Thanks for your suggestion, The problem is that matrix B is generated as a result of the do-loop simulation process. I think some matrix algebra could solve the problem, but I'm not sure how to do it.

( 2017-01-31 21:48:50 +0000 )edit

Here is how to combine 2 series and graph them

* Create A series
sample 1 5
genr a = time(0)
print a

* Create B series
sample 1 15
genr b = time(10)
print b

* Convert series to matrices and concatenate
matrix a1 = a
matrix b1 = b
matrix c1 = a1'|b1'
matrix c = c1'
print c1 c

* Graph the combined data
graph c / line

( 2017-02-01 23:34:56 +0000 )edit

Thanks a lot - it works! I have a follow-up question: How do you organize the data (matrix) when matrix B has let's say 5 columns? (and the dimension of B is not changed).

( 2017-02-02 13:22:31 +0000 )edit