# Average distance between consecutive points in a one-dimensional auto-correlated sequence

Case A. Simplest problem: Choose two points from the unit interval according to a uniform random distribution. The average distance between them is one-third, as shown in a related question.

Case B. More complicated: Form a sequence of random numbers but impose an auto-correlation constraint:

S[N] = S[N-1]*C + Random*(1-C)

where C is a correlation coefficient between zero and one. When C = 0, we have case A. When C is not zero, I have found experimentally that the average distance between one point and the next in the sequence is:

Average = (1-C)/3

(If I am wrong, let me know!)

Case C. My question: Add one more constraint. The probability that the next number in the sequence will stay the same or reverse direction compared to the previous interval is a constant R. The probability that the next number in the sequence will continue in the same direction is 1 - R. Now what is the average distance between consecutive pairs of numbers in the sequence?

NOTE: The motivation is this. Given actual data series, I want to infer an auto-regressive model for use in simulations of a data compression algorithm and deduce C and R from the data. My theory is that fewer reversals and higher correlation lead to higher data compression, but what is the relationship? Deducing R is easy: count the number of reversals and divide by the number of intervals. How do I infer C?

UPDATE:

I wrote code to perform an experiment and derived empirical values for my relatinship. I still need to do a surface fit to the data. Here is my LaTex table:

$$\begin{array}{c|lcr} - & \text{Reversal} & \text{Frequency} \\ \hline Correlation & 0 & 0.001 & 0.002 & 0.003 & 0.004 & 0.005 & 0.01 & 0.02 & 0.03 & 0.04 & 0.05 & 0.06 & 0.07 & 0.08 & 0.09 & 0.1 & 0.2 & 0.3 & 0.4 & 0.501 & 0.601 & 0.701 & 0.801 & 0.901 & 1 \\ \hline 0 & 0.0005 & 0.00153 & 0.00249 & 0.00355 & 0.00448 & 0.0055 & 0.01026 & 0.01962 & 0.02875 & 0.0377 & 0.04608 & 0.05415 & 0.06184 & 0.06916 & 0.07667 & 0.0835 & 0.14389 & 0.18733 & 0.22226 & 0.25163 & 0.2729 & 0.29216 & 0.3081 & 0.32229 & 0.33342 \\ 0.05 & 0.0005 & 0.0015 & 0.0025 & 0.00343 & 0.00447 & 0.00547 & 0.01028 & 0.01978 & 0.02887 & 0.03722 & 0.04578 & 0.05339 & 0.06079 & 0.06824 & 0.07562 & 0.08271 & 0.13951 & 0.18112 & 0.21258 & 0.23814 & 0.25691 & 0.27475 & 0.28958 & 0.30089 & 0.31114 \\ 0.1 & 0.00054 & 0.00148 & 0.0025 & 0.00344 & 0.00453 & 0.00547 & 0.01025 & 0.01961 & 0.02849 & 0.03698 & 0.04482 & 0.05282 & 0.0603 & 0.06702 & 0.07447 & 0.08089 & 0.13454 & 0.17383 & 0.20203 & 0.22511 & 0.24343 & 0.25769 & 0.27231 & 0.28146 & 0.29031 \\ 0.2 & 0.0005 & 0.00147 & 0.00247 & 0.00349 & 0.00444 & 0.00543 & 0.01011 & 0.01935 & 0.02776 & 0.03588 & 0.04393 & 0.05136 & 0.05808 & 0.06508 & 0.07152 & 0.07721 & 0.12492 & 0.15788 & 0.18211 & 0.19991 & 0.21456 & 0.22637 & 0.23456 & 0.24319 & 0.24986 \\ 0.3 & 0.00054 & 0.00145 & 0.00247 & 0.00347 & 0.0044 & 0.00542 & 0.01009 & 0.01903 & 0.02741 & 0.03522 & 0.04264 & 0.04907 & 0.05607 & 0.06214 & 0.06795 & 0.0734 & 0.11532 & 0.14185 & 0.16145 & 0.17547 & 0.18602 & 0.19418 & 0.20108 & 0.20691 & 0.21139 \\ 0.4 & 0.00047 & 0.00145 & 0.0025 & 0.00348 & 0.00444 & 0.00534 & 0.01009 & 0.01891 & 0.02662 & 0.03442 & 0.04097 & 0.04766 & 0.05333 & 0.05858 & 0.06311 & 0.06846 & 0.10327 & 0.12487 & 0.13995 & 0.15032 & 0.15833 & 0.16398 & 0.16949 & 0.17232 & 0.17634 \\ 0.5 & 0.00049 & 0.00151 & 0.00244 & 0.00347 & 0.00441 & 0.00541 & 0.00994 & 0.0183 & 0.02584 & 0.03243 & 0.039 & 0.04463 & 0.04971 & 0.05495 & 0.05882 & 0.063 & 0.09002 & 0.10709 & 0.11799 & 0.12522 & 0.13112 & 0.13438 & 0.13778 & 0.14067 & 0.14283 \\ 0.6 & 0.0005 & 0.00148 & 0.00246 & 0.00343 & 0.00432 & 0.00526 & 0.00971 & 0.01773 & 0.0244 & 0.03077 & 0.03596 & 0.04062 & 0.0455 & 0.04869 & 0.0527 & 0.05573 & 0.0769 & 0.08825 & 0.09503 & 0.10001 & 0.10392 & 0.10631 & 0.10819 & 0.10966 & 0.11084 \\ 0.7 & 0.00048 & 0.00151 & 0.00239 & 0.0034 & 0.00425 & 0.00519 & 0.00945 & 0.01675 & 0.02276 & 0.02803 & 0.03216 & 0.03597 & 0.03937 & 0.04188 & 0.04482 & 0.04692 & 0.06125 & 0.06818 & 0.07213 & 0.07505 & 0.07663 & 0.07832 & 0.07941 & 0.08018 & 0.08105 \\ 0.8 & 0.00051 & 0.00146 & 0.00249 & 0.00332 & 0.00424 & 0.005 & 0.0089 & 0.01497 & 0.02009 & 0.02359 & 0.02651 & 0.029 & 0.03163 & 0.03296 & 0.03461 & 0.03571 & 0.04366 & 0.04696 & 0.04886 & 0.05015 & 0.05091 & 0.05153 & 0.05206 & 0.05227 & 0.05246 \\ 0.9 & 0.00058 & 0.00147 & 0.00238 & 0.0032 & 0.0039 & 0.00473 & 0.00747 & 0.01155 & 0.0143 & 0.01637 & 0.01746 & 0.01844 & 0.01918 & 0.01973 & 0.02043 & 0.02087 & 0.02327 & 0.02426 & 0.0247 & 0.025 & 0.02516 & 0.02538 & 0.02554 & 0.02563 & 0.02565 \\ 0.95 & 0.0005 & 0.0014 & 0.00222 & 0.0029 & 0.00337 & 0.004 & 0.00592 & 0.00786 & 0.00909 & 0.00987 & 0.01033 & 0.01055 & 0.01095 & 0.01108 & 0.01125 & 0.01134 & 0.01199 & 0.01232 & 0.01241 & 0.01248 & 0.01251 & 0.01259 & 0.01264 & 0.01263 & 0.01263 \\ \end{array}$$