clear all set obs 100 gen t=_n gen u=invnorm(uniform()) gen y=u if t==1 replace y=y[_n-1]+u if t>1 gen v=invnorm(uniform()) gen x=v if t==1 replace x=x[_n-1]+v if t>1 regress y x predict fit graph y x t, c(ll) title("Fig. 1: Y and X Time Series") saving (fig1, replace) graph y fit x, c(.l) s(o.) title ("Fig. 2: Y fitted on X") saving (fig2, replace) graph using, saving (null, replace) graph using fig1 null null fig2, saving (gn, replace)