|
On Nov 9, 10:21 am, "Tomaz " <tomaz.bart...@gmail.com> wrote:
> Greg, firstly thank you for your help.
> To tell you the truth my knowledge of statistics is not good enough to quite understand your hints. But let me rephrase my question.
>
> I have a data set with 4 independent normally distributed variables. I put this dataset in matrix A. From this it is easy to calculate average vector (MU):
> MU = mean(A);
>
> It is also trivial to obtain variance-covariance matrix (SIGMA).
> SIGMA = cov(A);
>
> So, given MU and SIGMA I can 'build' and plot normal (Gaussian) multi variate distribution.
>
> Now, what I need to do is to generate a value for x4, when I have x1, x2 and x3 given.
>
> I will be basicaly performing a simulation, where I will generate values for column x4 every time. I suppose I just need a normal (univariable) distribution of x4 and then sample from it. However, in my understanding this normal distribution is different (has other mean and stdDev) for every combination of x1, x2, x3. So, how an I get the right distribution function for some particular values of x1, x2 and x3? And how can I then sample values for x4 out of it?
>
> I hope I was more clear now?
On Nov 9, 10:21 am, "Tomaz " <tomaz.bart...@gmail.com> wrote:
> Greg, firstly thank you for your help.
> To tell you the truth my knowledge of statistics is not good enough to quite understand your hints. But let me rephrase my question.
>
> I have a data set with 4 independent normally distributed variables. I put this dataset in matrix A. From this it is easy to calculate average vector (MU):
> MU = mean(A);
>
> It is also trivial to obtain variance-covariance matrix (SIGMA).
> SIGMA = cov(A);
>
> So, given MU and SIGMA I can 'build' and plot normal (Gaussian) multi variate distribution.
>
> Now, what I need to do is to generate a value for x4, when I have x1, x2 and x3 given.
>
> I will be basicaly performing a simulation, where I will generate values for column x4 every time. I suppose I just need a normal (univariable) distribution of x4 and then sample from it. However, in my understanding this normal distribution is different (has other mean and stdDev) for every combination of x1, x2, x3. So, how an I get the right distribution function for some particular values of x1, x2 and x3? And how can I then sample values for x4 out of it?
>
> I hope I was more clear now?
Yes. Since all of the variables are normal, the solution is
relatively
simple.
Given: The sequence of random variables zi (i = 1,2,..) with the
properties
1. Zero mean, <zi> = 0
2. Unit variance <zi*zi> = 1
3. Independent <zi*zj> = 0 , |i-j|>0
Now consider the following sequence of random variables xi (i=1,2,...)
x1 = z1, <x1> = 0, <x1*x1> = 1
x2 = sqrt(1-C21^2)*z2 + C21*x1
<x2> = 0, <x2*x1> = C21, <x2*x2> = 1
x3 = sqrt(1-C32^2-C31^2)*z3+ C32*x2+C31*x1
<x3> = 0, <x3*x2> = C32 , <x3*x1> = C31, <x3*x3> = 1
Now, if the zi are N(0,1) distributed, the xi will be N(0,1)
(NOTE: NOT true with other distributions)
Furthermore, if x1 and x2 were obtained by any other means
but are still known to be N(0,1) distributed, the formula for x3
is still valid.
End of hints.
Good luck with solving your problem!
Greg
|