Reputation: 2299
I have some doubts on how to ensure independence of random variables in a Matlab simulation. Consider the following example:
T=400;
x=randi(3,T,1); %Tx1
w=randn(T,1); %Tx1
We know that, for t=1,...,T
, x(t)
is a draw from a Unif([1,3])
.
We can think of x(t)
as the realisation of a random variable X_t~Unif([1,3])
for t=1,...,T
with
(X_1,..., X_T)
mutually independent.
We know that, for t=1,...,T
, w(t)
is a draw from a N(0,1)
.
We can think of w(t)
as the realisation of a random variable W_t~N(0,1)
for t=1,...,T
with (W_1,..., W_T)
mutually independent.
Question: Suppose I want to ensure that, for each t=1,...,T
, W_t
is independent of X_t
: do my steps above automatically ensure that and, if not, which modifications I should introduce?
Upvotes: 3
Views: 102
Reputation: 2343
Yes, you can as far as it is possible for pseudorandom numbers in general. But casting the pseduo part aside, all numbers come from the same number generator as mentioned here in the documentation
"Each time you call rand, randi, or randn, they draw a new value from their shared random number generator, and successive values can be treated as statistically independent. "
So if you say that the values (X_1,..., X_T)
are mutually independent then the values (X_1,..., X_2T)
are also mutually independent. In your example (X_1,..., X_T)
are used for x
while (X_T+1,..., X_2T)
are used for w
.
Upvotes: 4