SHAZAM Community
Ask Your Question
0

How to organize time series and make nice figures

asked 2017-01-30 20:44:36 +0000

TL gravatar image

updated 2017-01-31 06:27:26 +0000

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 flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-01-31 20:30:59 +0000

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.

edit flag offensive delete link more

Comments

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.

TL gravatar imageTL ( 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
SHAZAMHelp gravatar imageSHAZAMHelp ( 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).

TL gravatar imageTL ( 2017-02-02 13:22:31 +0000 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2017-01-30 20:44:36 +0000

Seen: 22 times

Last updated: Jan 31