# 2 sample t-test on autocorrelated time series

#### SteveSg83

##### New Member
Hello everybody, I really need your help! I've got an autocorrelated time series. For each value in the time series I have a corresponding dummy variable (that can be equal to 0 or 1). I'd need to know whether or not the mean and the standard deviation of the values linked to the 0s are statistically equal or different from the ones of the values linked to the 1s. With non correlated data I would do a 2 sample t-test, but wouldn't it be not correct to do the same with an autocorrelated time series? What should I do? Thanks so much for your help!

#### katxt

##### Well-Known Member
An interesting problem. Perhaps a permutation test is a possibility.
Under the null hypothesis, there is no difference between the dummy 0 points and the dummy 1 points. There is some autocorrelation factor which may go back several lags which we must try to preserve.
So permute the value at any time at random between the 0 points and the 1 points.

Find the difference in the groups Diff. Permute at random Y0 and Y1 to PY0 and PY1. Find PDiff. Repeat many times to find the sampling distribution of PDiff. See where Diff fits into this sampling distribution to get a p value.
This scheme preserves the autocorrelation over several lags.
The same would work for the SD, I think.
I can't think of anything smarter at the moment.

#### SteveSg83

##### New Member
Thanks so much katxt, but I do not understand how should I calculate the differences. Are you talking about mean of Y0 - mean of Y1, and then mean of PY0 - mean of PY1 and so on?

#### katxt

##### Well-Known Member
Yes. There were more rows that weren't included in the screenshot.
I can't think of anything smarter at the moment.
If you want to preserve the number of 0's and 1's, you could permute the D column for a very similar and perhaps simpler arrangement.

#### katxt

##### Well-Known Member
Do you have suitable software?

#### SteveSg83

##### New Member
I usually use Minitab, I think it should be fine. I won't be at home this week, but the next I'll try..

#### katxt

##### Well-Known Member
Great. If Minitab doesn't work out, I can point you to an Excel file that makes things like this fairly straightforward.