# How to determine a random sequence has the same distribution?

suppose I have a random sequence $X$, I want to determine whether it is an i.i.d. sequence, I used Ljung-box test to determine whether sequence $X$ is mutually independent. Can anyone tell me how to show the sequence $X$ has the same probability distribution?

P.S. I tried to generate a normal distributed sequence $y\sim N(0,1)$ and a uniform distributed sequence $z\sim U(-1,1)$. I combined those two sequence and form a new sequence $x$ such that:

\begin{equation}x:=(y_1,~z_1,~y_2,~z_2,~\cdots,~y_N,~z_N) \end{equation}

The sequence $x$ can pass the Ljung-box test but it is not a identically distributed sequence.

• You would likely get multimodality in the density function if it is composed of many components with different means. So if you estimate the density function for example with histogram at least that is something you could see. – mathreadler Apr 17 '17 at 9:27
• You principally cannot tell if a single term of the sequence does not follow the common distribution. Instead, you may want to check statistical properties of suitable subsequences; in your example, odd vs even inidces would expose the problem – Hagen von Eitzen Apr 17 '17 at 9:33

## 1 Answer

You can plot a histogram. This is what it could look like if you have two gaussians sampled 128 and 64 samples each: $$\cases{\mu_1=0, {\sigma_1}^2=1\\\mu_2=4,{\sigma}_2^2=0.5}$$ There is a clear bi-modality in the histogram. A minimum around 2.5 that separates two well defined distributions. Unless the single distributions you consider can be rather sophisticated it is likely that this is at least two different mixed distributions.