Define and draw a hyperplane for hierarchical clustering result - r

I used hclust on my data and got a two-cluster solution. Then I used the scatter3d() to create a 3D scatterplot to visualize the two clusters by getting x, y,z coordinates multidemsional scaling (see below).
I am wondering how can I define and draw a linear discrminant hyperplane that separate these two clusters.

The most useful and sensible answer to the first part of my question can be found here:
https://stat.ethz.ch/pipermail/r-help/2010-May/239195.html
For the second part, I think surface3d() will do the trick.

Related

3D Visualization: "3D"-geom_rect function in rgl?

Refering to this question I found a solution for my first problem, but know I have a visualization question regarding rgl.
I did a tedious simulation and got a square which fits into this "space" I created with the mentioned code. In 2D I would use geom_rect to visualize it.
Is there a 3D-geom_rect function in rgl or is there a way to get multiple 3D objects in one plot?

Confidence ellipse formula in JS or R

What I have: A scatter chart(plot) of PCA. Plotted in JS. I have Rtools that Ive used to push PCA data to the client side.
What I'm trying to do: Plot a confidence ellipse formula.
I can't seem to find a straight forward formula for the CI ellipse. I came across a lot of theory and a lot of examples in R which give you the end result - an ellipse (One can use ggplot or CRAN to plot it).
But Im looking for a formula that I could use in the client side to plug my scatter chart points and calculate the ellipse or even better a function in R that would give me a formula for the ellipse.
I have the covariance matrix and Eigen vectors as well (calculated in R).
All suggestions much appreciated.
Haven't found a formula but after using Momocs:::conf_ell library I managed to get the vertices and the x,y points of an ellipse.
I will update this answer once I find the second part to my answer - a straight forward formula.

Labview - How to merge scatter and surface 3d plots?

I have 2 sets of data for 3D plot. First is defined on scattered grid and consist of X-,Y-,Z-vector, the second is defined on structured grid, consist of X-,Y-,Z-matrix and is obtained by interpolation of the first.
How do I plot surface of the second and points of the first inside of one 3d plot?
There are many solutions on the web, such as:
http://digital.ni.com/public.nsf/allkb/0ABACC8B023C15D3862572ED0070E4A6
https://decibel.ni.com/content/docs/DOC-4271
https://decibel.ni.com/content/docs/DOC-4585
You can go over and find the one which matches to your problem

How to reproduce this graphical explanation (a scatter plot) of how covariance works?

I found this graphical intuitive explanation of covariance:
32 binormal points drawn from distributions with the given covariances, ordered from most negative (bluest) to most positive (reddest)
The whole material can be found at:
https://stats.stackexchange.com/questions/18058/how-would-you-explain-covariance-to-someone-who-understands-only-the-mean
I would like to recreate this sort of graphical illustration in R, but I'm not sufficiently familiar with R's plotting tools. I don't even know where to start in order to get those colored rectangles between each pair of data points, let alone make them semi-transparent.
I think this could make a very efficient teaching tool.
The cor.rect.plot function in the TeachingDemos package makes plots similar to what is shown. You can modify the code for the function to make the plot even more similar if you desire.

Make density cloud from point cloud

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:
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.
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)

Resources