I have a data consisting of simulated values. The data set is a 95*525 matrix and below I have printed a small sample of the data.

``0.01076 0.01076 0.01076 0.01076 0.010760.0105259 0.010586823 0.010968957 0.010919492 0.0106853720.010461666 0.010271274 0.01124356 0.010362122 0.0106994930.010621132 0.009699747 0.01143447 0.010169863 0.0109201170.01090401 0.009537089 0.011461832 0.010613986 0.0109645970.010876345 0.008634657 0.011353565 0.0111837 0.0104561990.010245947 0.009195114 0.012275926 0.011230311 0.0100935070.010056854 0.009557125 0.01199076 0.010158304 0.0097598210.008903207 0.009537452 0.011057318 0.010154896 0.009851610.008249492 0.010232035 0.01133204 0.009719779 0.009958710.006726547 0.010441961 0.010392739 0.009166036 0.010438270.007159706 0.010254763 0.009552638 0.009371703 0.0102617910.007692135 0.01099915 0.009913062 0.008190215 0.009553324``

In order to plot kernel densities I have downloaded the package KernSmooth, which works nicely. However I would like to create one kernel density plot that includes all of my simulations. That is, I would like to plot one kernel density for 95 columns, instead of a kernel density consisting of only one column.

The code I have used to get a one column kernel is the following

``> kernel=bkde(cir[,1])> plot(kernel, type="l")``

If I disregard of the [,1] to make it include all columns, I get an error.

Further, I have plotted the different paths for my simulated values in one graph. What I would like to do next is to rotate the kernel density plot 90 degrees and then combine it and the end of my simulation path plot.If my explanation of this is some what diffuse, I can try to provide a picture as an example.

Use

``````kernel <- bkde(as.vector(cir))
``````

to get the kernel density estimate of all your data.

To rotate graphs by 90 degrees, simply exchange the `x` and `y` coordinates in the `plot` command, as for example in

``````x <- seq(-3,3,.1)
plot(x, dnorm(x))
plot(dnorm(x), x)
``````

Hope that helps.

Top