BookmarkSubscribeRSS Feed

Community Member


Jun 23, 2011

Generate Autocorrelated Random Variable

Is there an easy way in JMP® to create an autocorrelated random variable with a specified (first lag) autocorrelation?

Re: Generate Autocorrelated Random Variable

I guess it depends on your definition of "easy". Alot of work goes into generating random number generators that don't exhibit any auto-correlation. You want the opposite, so is unlikely to be available as a simple callable function.

But you could do it in JSL. The technique for generated random numbers for 2 correlated variables involves the use of matrices and Cholesky decomposition, both of which are supported in JSL. I think the trick would be to take the first variable as your time series, then the second variable as your time series offset by the lag that you want exhibited in the autocorrelated data.

Re: Generate Autocorrelated Random Variable

I've been thinking about the method that I suggested. I haven't tried it but I don't think it would work. Depending on why/how you want to generate the autocorrelated sequence, you could try something like this. Generate 2 colulmns, the first a set of random uniforms, and the second derived from the lag offset that you are looking for:

Column 1 = Random Uniform(I)
Column 2 = Column 1 + Lag( Column 1, 1)

You can then fiddle (technical term!) with the formula for column 2 so that it exhibits the properties that you are looking for (e.g. change the weightings of the first or second term).