Hi,
I want to create a fictional dataset where the error term of a time series regression should be characterized by p-th order autocorrelation.
I'm stuck with imposing the autocorrelation ... Does somebody has a clue how to generate this type of data?
Below you find something similar where I generated heteroskedasticity (which turns out fine) ... so I would be very happy to be able to create something similar, but with autocorrelation ...
Thank you very much!
I want to create a fictional dataset where the error term of a time series regression should be characterized by p-th order autocorrelation.
I'm stuck with imposing the autocorrelation ... Does somebody has a clue how to generate this type of data?
Below you find something similar where I generated heteroskedasticity (which turns out fine) ... so I would be very happy to be able to create something similar, but with autocorrelation ...
Code:
clear set seed 123 set obs 200 * Creating independent variable gen x=runiform(1,1000) * Creating heteroskedastic resid gen sd=runiform(0,4) gen u=2*rnormal(0,sd*x) * Creating dependent variable gen y=1000+10*x+u * Regression (and plots indication heteroskedasticity) reg y x scatter y x rvfplot