AR function

Simulation of an AR(p) surrogate for a given time series x