# Revision history [back]

Using your series you can script you can store the results in a matrix as follows:

* Set variable
gen1 series = 10
gen1 length = 5
gen1 p = 0.2

* Dimension a matrix to store results
dim A length series

* Generate a number of series
do(# = 1, series)

* Sample length for each series
sample 1 length

* Generate an AR(p) series
genr YEAR = TIME(0)
genr X2 = NOR(3)
genr Y = 1
genr Y = 1 + p*LAG(Y) + X2

* Store Y as a matrix column and make a line graph
* of the individual series
matrix A(0,#)=Y
graph Y YEAR / line

endo

* Line graph of all series
graph A YEAR / line nokey


The output produces individual graphs per series and the following graph of all series: Using your series you can script you can it is possible to store the results in a matrix and graph the output as follows:

* Set variable
gen1 series = 10
gen1 length = 5
gen1 p = 0.2

* Dimension a matrix to store results
dim A length series

* Generate a number of series
do(# = 1, series)

* Sample length for each series
sample 1 length

* Generate an AR(p) series
genr YEAR = TIME(0)
genr X2 = NOR(3)
genr Y = 1
genr Y = 1 + p*LAG(Y) + X2

* Store Y as a matrix column and make a line graph
* of the individual series
matrix A(0,#)=Y
graph Y YEAR / line

endo

* Line graph of all series
graph A YEAR / line nokey


The output produces individual graphs per series and the following graph of all series: Using your script it is possible to store the results in a matrix and graph the output as follows:

* Set variable
some useful constants
gen1 series = 10
gen1 length = 5
gen1 p = 0.2

* Dimension a matrix to store results
dim A length series

* Generate a number of series
do(# = 1, series)

* Sample length for each series
sample 1 length

* Generate an AR(p) series
series (with drift)
genr YEAR = TIME(0)
genr X2 = NOR(3)
genr Y = 1
genr Y = 1 + p*LAG(Y) + X2

* Store Y as a matrix column and make a line graph
* of the individual series
matrix A(0,#)=Y
graph Y YEAR / line

endo

* Line graph of all series
graph A YEAR / line nokey


The output produces individual graphs per series and the following graph of all series: 