I'm using sm.density.compare()
function to visualize if my variable of interest helps distinguish categorical outcome variable (a variable of 13 classes) using the following code:
library(sm)
load("~/df.Rdata")
sm.density.compare(df$X, df$Y, col=rainbow(13))
sm.density.compare()
or simply because the X
is uninformative?
FYI, the data can be accessed here and I referenced this thread from another forum.
Thank you.
In your data, only two points have df$Y ==2 and both have the same X value, so there is no good way to define the density for those points. If you leave out the Y==2 points, the plot works fine.
SUB = which(df$Y != 2)
sm.density.compare(df$X[SUB], df$Y[SUB])