1

My question consists of two sub questions.

I have a graphical illustration presenting (some virtual) worst case scenarios sampled from history organized based on two parameters.

Image: enter image description here

At this moment I have a point cloud. I would like to create nicely splined density cloud of my results. I would like the 3d spline to consider density of points when aproximating (so aproximate further around when there are less samples availabe and more exactly in more dense region of space)

Because then, having that density cloud, I would be able scale the density in each vertical line specified by the two input parameters, and that would make it a likehood function of each outcome - [the worst case scenario])

Second part is, I would like to plot it, at best as semi-transparent 3d-regions that would be forming sometihng like a fog around the most dense region.

Uh,wow.. that wasn't easy to explain. Sigh. :) Thanks for reading that far.

jjaskulowski
  • 2,524
  • 3
  • 26
  • 36
  • Use hexbins? [High Density Scatterplots](http://www.statmethods.net/graphs/scatterplot.html) – zx8754 May 20 '14 at 10:31
  • Looks like it's 2D only. – jjaskulowski May 20 '14 at 11:31
  • You can play with alpha transparency, see [Scatterplot with too many points](http://stackoverflow.com/a/7727681/680068) – zx8754 May 20 '14 at 11:57
  • I will try that for sure to see more but I still need to compensate fewer number of points at areas far from center and I need a Real function that would interpolate the density well in every given point in space. – jjaskulowski May 20 '14 at 12:12
  • I wonder, am I doing something unusal that people usually didn't try to do? – jjaskulowski May 20 '14 at 12:13
  • Real question is why 3D? `pairs()` is better for viewing and printing... – zx8754 May 20 '14 at 12:14
  • Because my ultimate goal is not to plot but to have a function that I can use to make other calculations. And 3D density is needed beacuse estimating density based on distance in 3D space is more accurate in this scenario than estimating solely based on any randomly selectad plane cutting through the cordiantes of interest. – jjaskulowski May 20 '14 at 12:43
  • I would need something like you do on maps to show height (http://zspbielice.edupage.org/files/mapa_poziomic.jpg) but in 3D and for density in place of height. – jjaskulowski May 20 '14 at 12:45

1 Answers1

2

So here is a way to generate 3D density plots using the ks package. Since you provided no data this example is taken directly from the documentation to plot(...) in the ks package

library(MASS)
library(ks)
x <- iris[,1:3]
H.pi <- Hpi(x, pilot="samse")
fhat <- kde(x, H=H.pi, compute.cont=TRUE)  
plot(fhat, drawpoints=TRUE)

jlhoward
  • 58,004
  • 7
  • 97
  • 140