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:

$$x:=(y_1,~z_1,~y_2,~z_2,~\cdots,~y_N,~z_N)$$

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

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}$$