Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gaussian process with linear correlation

  1. Jan 28, 2012 #1
    I have a stationary gaussian process { X_t } and I have the correlation function p(t) = Corr(X_s, X_(s+t)) = 1 - t/m, where X_t is in {1,2,..,m}, and I want to simulate this process.
    The main idea is to write X_t as sum from 1 to N of V_i, X_t+1 as sum from p+1 to N+p V_i and so on, where V_i are uniform variables in [-a, a]. From this point I will use the central limit theorem to prove that X_t is a normal variable. My question is: how can I find the correlation, covariance of X_T and X_t+k for example, a and p using this notification?
  2. jcsd
  3. Jan 29, 2012 #2

    Stephen Tashi

    User Avatar
    Science Advisor

    I don't know why you chose sums of independent uniform random variables. Why not use sums of independent normal random variables? Then you know the sums are normally distributed instead of approximately normally distributed.

    A specific example of your question is:
    Let [itex] u_1,u_2,u_3, u_4 [/itex] each be independent uniformly distributed random variables on [0,1].

    Let [itex] S_1 = u_1 + u_2 + u_3 [/itex]
    Let [itex] S_2 = u_2 + u_3 + u_4 [/itex]

    Find [itex] COV(S_1,S_2) [/itex].
    Find the correlation of [itex] S_1 [/itex] with [itex] S_2 [/itex].

    Well, the covariance of two sums of random variables should be easy enough. See
    http://mathworld.wolfram.com/Covariance.html equation 21.

    To force the autocorrelation to have a particular shape, you could use weighted sums . That would be another argument for using normal random variables for [itex] V_i [/itex].
  4. Jan 29, 2012 #3
    Thank you for the answer.

    Can you explain in detail how can I use the weighted sums to force the autocorrelation and how can I find all the parameters I need?
  5. Jan 29, 2012 #4

    Stephen Tashi

    User Avatar
    Science Advisor

    Whether I can explain it depends on you background in mathematics, including probability theory - and whether I have time! It isn't a good idea to write computer simulations for any serious purpose without having the mathematical background to understand how they work. If your are doing this for recreation, a board game etc. then perhaps it's Ok.

    To start with, I suggest that you consider the weights represented by constants [itex] k_1, k_2, k_3 [/itex].

    Let [itex] S_j = k_1 x_j + k_2 x_{j+1} + k_3 x_{j+2} [/itex]

    Compute [itex] Cov(S_j, S_{j+1}), Cov(S_j,S_{j+2}) [/itex] etc. and see how the constants determine those covariances.
  6. Jan 29, 2012 #5
    Yes, I understand what I have to calculate. Actually , what I don't understand is a result from a book I read. The idea is
    [itex]X_t[/itex] is a stationary gaussian process. I have m states.
    [itex]p(t) = 1 - t/m[/itex] the autocorrelation function.
    So, [itex] p(t) = Cov(X_s, X_{s+t}) / Var(X_t) [/itex].
    Now, to simulate it, are generated some uniform random values [itex]V_i[/itex] in [itex] [-a,a][/itex].
    Now [itex]X_t = V_1 + V_2 + .. +V_N, X_{t+1} = V_{p+1} + V_{p+2} + .. + V_{N+p}[/itex] and so on.N is enough large to use the central limit theorem.
    My real problem is that there is stated that [itex]Cov[X_t , X_{t+k}] = E[(X_t - X_{t+k})^2] = 2No -Cov(X_t,X_{t+k}) [/itex], where o is the variance for [itex]V_t[/itex]. Next is stated that for [itex]k < N/p, Cov[X_t , X_{t+k}] = E[(X_t - X_{t+k})^2] = 2kp^2[/itex]. My problem is that I can't reach to this results, I can't prove them. If you can give me some ideas or links to read about this idea to aproximate, it would be great. Thanks again.
  7. Jan 29, 2012 #6

    Stephen Tashi

    User Avatar
    Science Advisor

    [tex] E[(X_t - X_{t+k})^2] = E( X_t^2 - 2 X_t X_{t+k} + X_{t+k}^2) = E(X_t^2) - 2 E(X_t X_{t_k}) + E(X_{t+k}^2) = N_o - 2 E(X_t X_{t+k}) + N_o [/tex]

    That could be a mess to write out, but the way I would start it is:

    [tex] COV( X_t, X_{t+k}) = COV( (\sum_A V_i + \sum_B V_i) (\sum_B V_i + \sum_C V_i) ) [/tex]

    Where [itex] A [/itex] are the [itex] Vi [/itex] unique to [itex] X_t [/itex], [itex] B [/itex] are the [itex] V_i [/itex] common to both [itex] X_t [/itex] and [itex] X_{t+k} [/itex] and [itex] C [/itex] are the [itex] V_i [/itex] unique to [itex] X_{t+k} [/itex].

    As I recall, the covariance function obeys a distributive law that would give:

    [tex] = COV( \sum_A V_i ,\sum_B V_i) + COV(\sum_A V_i ,\sum_C V_i) + COV(\sum_B V_i ,\sum_B V_i) + COV(\sum_B V_i ,\sum_C V_i) [/tex]

    [tex] = 0 + 0 + COV(\sum_B V_i, \sum_B V_i) + 0 [/tex]

    So you must comput the variance of [itex] \sum_B V_i [/itex], which will be a function of the variance of one particular [itex] V_i [/itex] and the number of the [itex] V_i [/itex] in the set [itex] B [/itex].
  8. Jan 29, 2012 #7
    I have one more question. Maybe is obvious, but I don't see it. Why is the relation [itex]Cov(X_t,X_{t+k}) = E[(X_t - X_{t+k})^2][/itex] true?
  9. Jan 29, 2012 #8

    Stephen Tashi

    User Avatar
    Science Advisor

    I don't have time to think about that now.

    Is [itex] X_t [/itex] assumed to have mean = 0 as part of the terminology "gaussian"?

    Also, I notice that I got [itex] 2 N_0 - 2 E(X_t,X_{t+k}) [/itex] instead of what you wrote.

    I'll be back this evening.
  10. Jan 29, 2012 #9
    Yes, the mean is 0. Also, from what I calculated, there it should be [itex]kpo[\itex] instead of [itex]kp^2[\itex].
  11. Jan 29, 2012 #10

    Stephen Tashi

    User Avatar
    Science Advisor

    The notation is getting confusing. We have p() for the correlation function and p in the index that defines [itex] X_t [/itex] as a sum of the [itex] V_i [/itex]. What is "po"?

    Anyway, let's say that the cardinality of the set [itex] B [/itex] is b.

    [tex] COV( \sum_B V_i, \sum_B V_i) = VAR( \sum_B V_i) [/tex]

    [tex] =\sum_B ( VAR(V_i)) = b (VAR(V_i)) [/tex]


    [tex] E( (X_t - X_{t+k})^2) = E ( ( \sum_A V_i - \sum_C V_i)^2) [/tex]

    [tex] = E( (\sum_A V_i)^2 + (\sum_C V_i)^2 - 2 \sum_A V_i \sum_C V_i ) [/tex]

    [tex] = E( (\sum_A V_i)^2 + E (\sum_C V_i)^2 - 2 E( \sum_A V_i)E(\sum_C V_i) [/tex]

    I gather we are assuming [itex] E(V_i) = 0 [/itex] so [itex] E( \sum_A V_i)^2 = VAR( \sum_A V_i) [/itex] etc.

    So the above is

    [tex] = VAR( \sum_A V_i) + VAR(\sum_C V_i) - 2 (0)(0) [/tex]

    Let a = the cardinality of [itex] A [/itex] and c = the cardinality of [itex] C [/itex]

    [tex] = (a + c) VAR(V_i) [/tex]

    It there an argument that (a+c) = b ?
  12. Jan 30, 2012 #11
    Thank you for the help, I figured it out finally. I have one more question. Now I have the algorithm for simulating the process and I want to validate it. Can you give some hints how it must be done?
  13. Jan 30, 2012 #12

    Stephen Tashi

    User Avatar
    Science Advisor

    Do you mean you want to validate it as a computer program by running it and looking at the data? Or do you mean you want to validate whether the algorithm implements the procedure in the book by reading the code of the algorithm?
  14. Jan 30, 2012 #13
    I meant if I see the values the computer program generated, what tests could I use to see if it is working correctly? I am thinking to check if the average of the values estimates the mean, the values respect the autocorrelation function rules and I was wondering if there are more things I could test.
  15. Jan 30, 2012 #14

    Stephen Tashi

    User Avatar
    Science Advisor

    I'd have to think about this in detail to give good advice. On the spur of the moment, I'd say to also check whether the X_i are normally distributed.

    In the history of simulations, there are examples where the random number generating functions were flawed in certain software packages. Don't assume that the random number generator in your software really works. Test it or at least find some documentation that someone else did. A quick test is to do a 2D plot of (X,Y,color) where each component is selected by a uniform distribution on some scale. See if any pronounced visual patterns appear. (Some random number generators misbehave only on particular seeds.)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook