# This is to simulate a function an uncorrelated linear time series. # The innovations in this time series are from a chi-square but you can # use what you want. artwist = function(a,n1){ n = (n1+200+1) # generate the innovations gen = (rchisq(n,1)-1) x = rep(0,n) for(j in c(2:n)){ x[j] = (a*x[j-1]+gen[j]) } y = (x[-n] - (a/(1-a**2))*gen[-1]) y1 = y[-c(1:200)] return(y1) } ##### # Test # showing that it is uncorrelated test = artwist(-0.6,400) acf(test) ## # showing that there is correlation in the squares (for the non-Gaussian case) acf(test**2)