3
$\begingroup$

How to construct a data set in three dimensional space, containing five classes (small overlapping is allowed but not advisable) clusters such that only two dimensions possess significant discriminatory power?

$\endgroup$
  • 1
    $\begingroup$ Questions solely about how software works are off-topic here, but you may have a real statistical question buried here. You may want to edit your question to clarify the underlying statistical issue. You may find that when you understand the statistical concepts involved, the software-specific elements are self-evident or at least easy to get from the documentation. $\endgroup$ – gung - Reinstate Monica Nov 28 '17 at 20:01
5
$\begingroup$

Does this count as a solution? I define the clusters by defining their centers in two dimensions and randomly make points around them. The third dimension consists of random numbers and therefore should not add anything to the cluster structure.

#centers of 5 clusters

center.x <- c(10, 20, 30, 40, 50)
center.y <- c(10, 20, 30, 40, 50)

x <- c(replicate(50, jitter(center.x[1])),
       replicate(50, jitter(center.x[2])),
       replicate(50, jitter(center.x[3])),
       replicate(50, jitter(center.x[4])),
       replicate(50, jitter(center.x[5])))

y <- c(replicate(50, jitter(center.y[1])),
       replicate(50, jitter(center.y[2])),
       replicate(50, jitter(center.y[3])),
       replicate(50, jitter(center.y[4])),
       replicate(50, jitter(center.y[5])))

z <- runif(5*50)

collected <- data.frame(x=x, y=y, z=z)

# 2D plot x and y
plot(x,y)

# cluster structure in all 3 dimensions
plot(hclust(dist(collected)))

# cluster structure in x and y dimension
plot(hclust(dist(collected[,c("x", "y")])))

You could make the 5 cluster structure even more pronounced by choosing centers that are not in a row but on a circle of the x-y-plane.

$\endgroup$
  • 1
    $\begingroup$ Although implementation is often mixed w/ substantive content in questions, we are supposed to be a site for providing information about statistics, machine learning, etc, not code. It can be good to provide code as well, but please elaborate your substantive answer in text for people who don't read this language well enough to recognize & extract the answer from the code. $\endgroup$ – gung - Reinstate Monica Nov 28 '17 at 20:00
  • $\begingroup$ I was just about to add some more text, when I saw your comment. Added a short explanation. $\endgroup$ – Bernhard Nov 28 '17 at 20:04
  • $\begingroup$ @Bernhard Yes it did work out now I am trying to compute the Kmeans so that these cluster look even nicer. After that I want to compute Fisher Score Could you help me how I can compute the Fisher Score on clusters? $\endgroup$ – nishant Nov 29 '17 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.