Simulation of a Gaussian process on $R^2$ with a stationary kernel using the Karhunen-Loève expansion

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Assume $X(omega, t) sim mathcalN(0, K(cdot, cdot))$ is a real-valued, centered Gaussian process on $R^2$, i.e., $X: Omega times R^2 to R$. Let the covariance function of the process be stationary, i.e., $K(t, s) = K(t - s)$, $forall t, s in R^2$. More specifically, let it be exponential: $K(t, s) = exp(-|t - s|/L)$ where $|cdot|$ stands for the Euclidean distance, and $L$ denotes the correlation length. Using the Karhunen-Loève expansion, $X$ can be represented as the following summation:



$X(t, omega) = sum_i=1^infty sqrtlambda_i phi_i(t) xi_i(omega)$



where $xi_i$ are independent, standard Gaussians, and $phi_i$ and $lambda_i$ are the eigenfunctions and eigenvalues of the covariance function $K$, which, in our case, can be computed analytically. For practical computations, the expansion above is truncated to keep, say, $n$ terms.



The question is: How to draw samples of the process on $R^2$, i.e., on a two-dimensional grid of fixed points, using the first $n$ eigenfunctions and eigenvalues of $K$? The problem is that the eigenfunctions are somewhat one-dimensional, and I cannot figure out how to properly use them to get realizations of $X$ on a plane. To be honest, the analytical solution that I claimed previously was initially obtained for processes on $R$, so I am not even sure that it applies directly to $R^2$. When I plug in the norms of points' coordinates into $phi_i$, I get radial patterns, which is presumably not correct.



Also, it is easy to simulate $X$ by constructing the corresponding covariance matrix for a set of points, which boils down to drawing samples from a multivariate Gaussian distribution. I am not interested in this approach.



I would be very grateful for any ideas. Thank you.










share|cite|improve this question



























    up vote
    1
    down vote

    favorite












    Assume $X(omega, t) sim mathcalN(0, K(cdot, cdot))$ is a real-valued, centered Gaussian process on $R^2$, i.e., $X: Omega times R^2 to R$. Let the covariance function of the process be stationary, i.e., $K(t, s) = K(t - s)$, $forall t, s in R^2$. More specifically, let it be exponential: $K(t, s) = exp(-|t - s|/L)$ where $|cdot|$ stands for the Euclidean distance, and $L$ denotes the correlation length. Using the Karhunen-Loève expansion, $X$ can be represented as the following summation:



    $X(t, omega) = sum_i=1^infty sqrtlambda_i phi_i(t) xi_i(omega)$



    where $xi_i$ are independent, standard Gaussians, and $phi_i$ and $lambda_i$ are the eigenfunctions and eigenvalues of the covariance function $K$, which, in our case, can be computed analytically. For practical computations, the expansion above is truncated to keep, say, $n$ terms.



    The question is: How to draw samples of the process on $R^2$, i.e., on a two-dimensional grid of fixed points, using the first $n$ eigenfunctions and eigenvalues of $K$? The problem is that the eigenfunctions are somewhat one-dimensional, and I cannot figure out how to properly use them to get realizations of $X$ on a plane. To be honest, the analytical solution that I claimed previously was initially obtained for processes on $R$, so I am not even sure that it applies directly to $R^2$. When I plug in the norms of points' coordinates into $phi_i$, I get radial patterns, which is presumably not correct.



    Also, it is easy to simulate $X$ by constructing the corresponding covariance matrix for a set of points, which boils down to drawing samples from a multivariate Gaussian distribution. I am not interested in this approach.



    I would be very grateful for any ideas. Thank you.










    share|cite|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Assume $X(omega, t) sim mathcalN(0, K(cdot, cdot))$ is a real-valued, centered Gaussian process on $R^2$, i.e., $X: Omega times R^2 to R$. Let the covariance function of the process be stationary, i.e., $K(t, s) = K(t - s)$, $forall t, s in R^2$. More specifically, let it be exponential: $K(t, s) = exp(-|t - s|/L)$ where $|cdot|$ stands for the Euclidean distance, and $L$ denotes the correlation length. Using the Karhunen-Loève expansion, $X$ can be represented as the following summation:



      $X(t, omega) = sum_i=1^infty sqrtlambda_i phi_i(t) xi_i(omega)$



      where $xi_i$ are independent, standard Gaussians, and $phi_i$ and $lambda_i$ are the eigenfunctions and eigenvalues of the covariance function $K$, which, in our case, can be computed analytically. For practical computations, the expansion above is truncated to keep, say, $n$ terms.



      The question is: How to draw samples of the process on $R^2$, i.e., on a two-dimensional grid of fixed points, using the first $n$ eigenfunctions and eigenvalues of $K$? The problem is that the eigenfunctions are somewhat one-dimensional, and I cannot figure out how to properly use them to get realizations of $X$ on a plane. To be honest, the analytical solution that I claimed previously was initially obtained for processes on $R$, so I am not even sure that it applies directly to $R^2$. When I plug in the norms of points' coordinates into $phi_i$, I get radial patterns, which is presumably not correct.



      Also, it is easy to simulate $X$ by constructing the corresponding covariance matrix for a set of points, which boils down to drawing samples from a multivariate Gaussian distribution. I am not interested in this approach.



      I would be very grateful for any ideas. Thank you.










      share|cite|improve this question















      Assume $X(omega, t) sim mathcalN(0, K(cdot, cdot))$ is a real-valued, centered Gaussian process on $R^2$, i.e., $X: Omega times R^2 to R$. Let the covariance function of the process be stationary, i.e., $K(t, s) = K(t - s)$, $forall t, s in R^2$. More specifically, let it be exponential: $K(t, s) = exp(-|t - s|/L)$ where $|cdot|$ stands for the Euclidean distance, and $L$ denotes the correlation length. Using the Karhunen-Loève expansion, $X$ can be represented as the following summation:



      $X(t, omega) = sum_i=1^infty sqrtlambda_i phi_i(t) xi_i(omega)$



      where $xi_i$ are independent, standard Gaussians, and $phi_i$ and $lambda_i$ are the eigenfunctions and eigenvalues of the covariance function $K$, which, in our case, can be computed analytically. For practical computations, the expansion above is truncated to keep, say, $n$ terms.



      The question is: How to draw samples of the process on $R^2$, i.e., on a two-dimensional grid of fixed points, using the first $n$ eigenfunctions and eigenvalues of $K$? The problem is that the eigenfunctions are somewhat one-dimensional, and I cannot figure out how to properly use them to get realizations of $X$ on a plane. To be honest, the analytical solution that I claimed previously was initially obtained for processes on $R$, so I am not even sure that it applies directly to $R^2$. When I plug in the norms of points' coordinates into $phi_i$, I get radial patterns, which is presumably not correct.



      Also, it is easy to simulate $X$ by constructing the corresponding covariance matrix for a set of points, which boils down to drawing samples from a multivariate Gaussian distribution. I am not interested in this approach.



      I would be very grateful for any ideas. Thank you.







      probability-theory stochastic-processes normal-distribution simulation






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Feb 20 '13 at 6:48

























      asked Jan 12 '13 at 17:52









      Ivan

      538416




      538416




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          %choose a kernel (covariance function)

          kernel = 2;
          switch kernel
          case 1; k = @(x,y) 1*x'*y; %linear
          case 2; k = @(x,y) exp(-100*(x-y)'*(x-y));
          case 3; k = @(x,y) exp(-1*sqrt((x-y)'*(x-y)));
          end

          %choose points at which to sample
          points = (0:0.02:1)';
          [U,V] = meshgrid(points, points);
          x=[U(:) V(:)]';
          n=size(x,2);

          %construct the covariance matrix
          C = zeros(n,n);
          for i = 1:n
          for j = 1:n
          C(i,j) = k(x(:,i), x(:,j));
          end
          end
          %sample from the Gaussian process at these points
          u = randn(n,1);
          [A,S,B]= svd(C);
          z = A*sqrt(S)*u;

          %plot
          figure(2); clf;
          Z = reshape(z, sqrt(n), sqrt(n));
          surf(U,V,Z);





          share|cite|improve this answer






















          • Some information is lacking ; it should especially be said that the Singular Value Decomposition (svd operator in Matlab) is the finite equivalent of Karhuenen-Loeve decomposition.
            – Jean Marie
            Dec 17 '17 at 23:23










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "69"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f276448%2fsimulation-of-a-gaussian-process-on-r2-with-a-stationary-kernel-using-the-kar%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          %choose a kernel (covariance function)

          kernel = 2;
          switch kernel
          case 1; k = @(x,y) 1*x'*y; %linear
          case 2; k = @(x,y) exp(-100*(x-y)'*(x-y));
          case 3; k = @(x,y) exp(-1*sqrt((x-y)'*(x-y)));
          end

          %choose points at which to sample
          points = (0:0.02:1)';
          [U,V] = meshgrid(points, points);
          x=[U(:) V(:)]';
          n=size(x,2);

          %construct the covariance matrix
          C = zeros(n,n);
          for i = 1:n
          for j = 1:n
          C(i,j) = k(x(:,i), x(:,j));
          end
          end
          %sample from the Gaussian process at these points
          u = randn(n,1);
          [A,S,B]= svd(C);
          z = A*sqrt(S)*u;

          %plot
          figure(2); clf;
          Z = reshape(z, sqrt(n), sqrt(n));
          surf(U,V,Z);





          share|cite|improve this answer






















          • Some information is lacking ; it should especially be said that the Singular Value Decomposition (svd operator in Matlab) is the finite equivalent of Karhuenen-Loeve decomposition.
            – Jean Marie
            Dec 17 '17 at 23:23














          up vote
          0
          down vote













          %choose a kernel (covariance function)

          kernel = 2;
          switch kernel
          case 1; k = @(x,y) 1*x'*y; %linear
          case 2; k = @(x,y) exp(-100*(x-y)'*(x-y));
          case 3; k = @(x,y) exp(-1*sqrt((x-y)'*(x-y)));
          end

          %choose points at which to sample
          points = (0:0.02:1)';
          [U,V] = meshgrid(points, points);
          x=[U(:) V(:)]';
          n=size(x,2);

          %construct the covariance matrix
          C = zeros(n,n);
          for i = 1:n
          for j = 1:n
          C(i,j) = k(x(:,i), x(:,j));
          end
          end
          %sample from the Gaussian process at these points
          u = randn(n,1);
          [A,S,B]= svd(C);
          z = A*sqrt(S)*u;

          %plot
          figure(2); clf;
          Z = reshape(z, sqrt(n), sqrt(n));
          surf(U,V,Z);





          share|cite|improve this answer






















          • Some information is lacking ; it should especially be said that the Singular Value Decomposition (svd operator in Matlab) is the finite equivalent of Karhuenen-Loeve decomposition.
            – Jean Marie
            Dec 17 '17 at 23:23












          up vote
          0
          down vote










          up vote
          0
          down vote









          %choose a kernel (covariance function)

          kernel = 2;
          switch kernel
          case 1; k = @(x,y) 1*x'*y; %linear
          case 2; k = @(x,y) exp(-100*(x-y)'*(x-y));
          case 3; k = @(x,y) exp(-1*sqrt((x-y)'*(x-y)));
          end

          %choose points at which to sample
          points = (0:0.02:1)';
          [U,V] = meshgrid(points, points);
          x=[U(:) V(:)]';
          n=size(x,2);

          %construct the covariance matrix
          C = zeros(n,n);
          for i = 1:n
          for j = 1:n
          C(i,j) = k(x(:,i), x(:,j));
          end
          end
          %sample from the Gaussian process at these points
          u = randn(n,1);
          [A,S,B]= svd(C);
          z = A*sqrt(S)*u;

          %plot
          figure(2); clf;
          Z = reshape(z, sqrt(n), sqrt(n));
          surf(U,V,Z);





          share|cite|improve this answer














          %choose a kernel (covariance function)

          kernel = 2;
          switch kernel
          case 1; k = @(x,y) 1*x'*y; %linear
          case 2; k = @(x,y) exp(-100*(x-y)'*(x-y));
          case 3; k = @(x,y) exp(-1*sqrt((x-y)'*(x-y)));
          end

          %choose points at which to sample
          points = (0:0.02:1)';
          [U,V] = meshgrid(points, points);
          x=[U(:) V(:)]';
          n=size(x,2);

          %construct the covariance matrix
          C = zeros(n,n);
          for i = 1:n
          for j = 1:n
          C(i,j) = k(x(:,i), x(:,j));
          end
          end
          %sample from the Gaussian process at these points
          u = randn(n,1);
          [A,S,B]= svd(C);
          z = A*sqrt(S)*u;

          %plot
          figure(2); clf;
          Z = reshape(z, sqrt(n), sqrt(n));
          surf(U,V,Z);






          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Jul 20 '14 at 4:23









          snarski

          4,1691119




          4,1691119










          answered Feb 22 '13 at 0:22









          ibrahim

          1




          1











          • Some information is lacking ; it should especially be said that the Singular Value Decomposition (svd operator in Matlab) is the finite equivalent of Karhuenen-Loeve decomposition.
            – Jean Marie
            Dec 17 '17 at 23:23
















          • Some information is lacking ; it should especially be said that the Singular Value Decomposition (svd operator in Matlab) is the finite equivalent of Karhuenen-Loeve decomposition.
            – Jean Marie
            Dec 17 '17 at 23:23















          Some information is lacking ; it should especially be said that the Singular Value Decomposition (svd operator in Matlab) is the finite equivalent of Karhuenen-Loeve decomposition.
          – Jean Marie
          Dec 17 '17 at 23:23




          Some information is lacking ; it should especially be said that the Singular Value Decomposition (svd operator in Matlab) is the finite equivalent of Karhuenen-Loeve decomposition.
          – Jean Marie
          Dec 17 '17 at 23:23

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f276448%2fsimulation-of-a-gaussian-process-on-r2-with-a-stationary-kernel-using-the-kar%23new-answer', 'question_page');

          );

          Post as a guest













































































          這個網誌中的熱門文章

          tkz-euclide: tkzDrawCircle[R] not working

          How to combine Bézier curves to a surface?

          1st Magritte Awards