I have a situation where there are n individuals and p features (variables). I do have their cluster information. Here is an example:
myd <- data.frame (
sub1 = c(1, "AB", "AB", "BB", "BB", "AA", "BB", "AB", "AA", "BB", "AB", "AA", "AB"),
sub2 = c(1, "AB", "BB", "BB", "BB", "AA", "BB", "AB", "AA", "BB", "AB", "AA", "AB"),
sub3 = c(1, "AB", "BB", "AB", "BB", "AA", "BB", "AB", "AA", "BB", "AB", "AA", "AB"),
sub4 = c(1, "AB", "BB", "AB", "BB", "AA", "BB", "AB", "AA", "BB", "AB", "AA", "AB"),
sub5 = c(1, "AB", "BB", "BB", "AB", "AB", "BB", "AB", "AA", "BB", "AB", "AA", "AB"),
sub6 = c(1, "AB", "BB", "BB", "BB", "AA", "AB", "AB", "AA", "BB", "AB", "AA", "AB"),
sub7 = c(2, "AA", "AA", "BB", "AB", "AA", "AB", "AB", "AB", "AB", "AB", "AB", "BB"),
sub8 = c(2, "AB", "AA", "AB", "AB", "AA", "AB", "AB", "AB", "AB", "AB", "AB", "BB"),
sub9 = c(2, "AA", "AA", "BB", "AB", "AA", "AB", "AB", "AB", "AB", "AB", "AB", "BB"),
sub10 = c(2, "AB", "AA", "BB", "AB", "AA", "BB", "AB", "AB", "AB", "AB", "AB", "BB"),
sub11 = c(2, "AA", "AA", "BB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB"),
sub12 = c(2, "AA", "AB", "BB", "BB", "AA", "AB", "AB", "AB", "AB", "AB", "AB", "BB"),
sub13 = c(3, "AB", "AB", "AB", "AB", "AB", "BB", "AB", "AA", "AB", "AA", "AB", "BB"),
sub14 = c(3, "AB", "BB", "BB", "AB", "AB", "BB", "AB", "AA", "AB", "AA", "AB", "BB"),
sub15 = c(3, "AA", "AB", "BB", "BB", "AA", "AB", "AB", "AB", "AB", "AB", "AB", "BB"))
rownames(myd) <- c("cluster", paste("var", 1:12, sep=""))
Thus this data has 15 subjects sub1 : sub15
classified by categorical variables var1: var12
. The cluster id is in the first row - with row name - cluster
.
myd
sub1 sub2 sub3 sub4 sub5 sub6 sub7 sub8 sub9 sub10 sub11 sub12 sub13 sub14 sub15
cluster 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3
var1 AB AB AB AB AB AB AA AB AA AB AA AA AB AB AA
var2 AB BB BB BB BB BB AA AA AA AA AA AB AB BB AB
var3 BB BB AB AB BB BB BB AB BB BB BB BB AB BB BB
var4 BB BB BB BB AB BB AB AB AB AB AB BB AB AB BB
var5 AA AA AA AA AB AA AA AA AA AA AB AA AB AB AA
var6 BB BB BB BB BB AB AB AB AB BB AB AB BB BB AB
var7 AB AB AB AB AB AB AB AB AB AB AB AB AB AB AB
var8 AA AA AA AA AA AA AB AB AB AB AB AB AA AA AB
var9 BB BB BB BB BB BB AB AB AB AB AB AB AB AB AB
var10 AB AB AB AB AB AB AB AB AB AB AB AB AA AA AB
var11 AA AA AA AA AA AA AB AB AB AB AB AB AB AB AB
var12 AB AB AB AB AB AB BB BB BB BB AB BB BB BB BB
I would like to see if the cluster is proper by calculating some of the measure (such as p-value) that can provide the probability that particular subject belong to certain cluster. How can I achieve this ? I do have a large number of variables / subjects, so I would need quicker solution as well.
check them if that is correct
. But what is correct? Any classification is "correct" if it can be justified. To check a classification, as you request, you must clearly define the rules and the procedure of the classification. To do it on the data and see if there occured any discrepancy with the given classification. $\endgroup$subs
in same class are similar with each other compared that from other class. The classification here is natural/biological (for example chromosomes - markers from same chromosomes are correlated/associated in contrast to that from other chromosome are not significantly correlated or are independent). So I know the classification but how I got this classification is biological, but outcome should follow statistical rule - from the same group should be associated compared to other group. $\endgroup$