Graph of probability density over time in R

Let's say I have the result of simulating a monte-carlo one variable over several different iterations (I think millions). For each iteration, I have the values ​​of the variable at each point in time (from t = 1 to t = 365).

I would like to create the following plot: For each point in time t on the x axis and for each possible value of "y" in a given range, set the color x, y to "k", where "k" is the count of the number of observations within the vicinity of the distance " d "to x, y.

I know that you can easily make density maps for 1D data, but is there a good package for doing this on 2 dimensions? Should kriging be used?

Edit: The data structure is currently a matrix.

                                     data matrix

                                      day number
             [,1]    [,2]         [,3]      [,4]       [,5]      ... [,365]
iteration    [1,]    0.000213   0.001218    0.000151   0.000108  ... 0.000101
             [2,]    0.000314   0.000281    0.000117   0.000103  ... 0.000305
             [3,]    0.000314   0.000281    0.000117   0.000103  ... 0.000305
             [4,]    0.000171   0.000155    0.000141   0.000219  ... 0.000201
              .
              .
              .
     [100000000,]    0.000141   0.000148    0.000144   0.000226  ... 0.000188

, "" , "", . .

+4
1

, , .

  • .

    myData <- mapply(rnorm, 1000, 200, mean=seq(-50,50,0.5))

1000 () 201 . -50 50. 0,5 .

  1. .

    myDensities <- apply(myData, 2, density, from=-500, to=500)

. , , ( -500 500) .

  1. .

    Ys <- sapply(myDensities, "[", "y")

. .

  1. .

    img <- do.call(cbind, Ys)

Ys .

  1. Plot.

    filled.contour(x=1:ncol(img), y=myDensities[[1]]$x, t(img))

fill.contour. . , D[[1]]$x.

:

densities

-50 50.

, . , , , . , - .

+3

All Articles