Dear R users, I'm having trouble with calculating pvalues for my 2d dataset. First I performed clustering and I would like to get some info about the strength of cluster membership for each point. I've calculated (thanks to nice people help) the multivariate normal densities (mnd) using dmvnorm function: pd11=mvtnorm::dmvnorm(dataset1,mean=dataset1MC$parameters$mean[,1],sigma=dataset1MC$parameters$variance$sigma[,,1]) I've obtained a vector of mnds for each cluster: NA12043 NA12249 NA12264 NA12707 NA12716 NA12717 NA12751 NA12762 NA12864 NA12873 NA07034 NA07048 NA07055 NA07345 NA07348 NA07357 NA10830 NA10835 8.627681e+00 8.465797e+00 1.522724e+01 2.047262e+01 1.780368e+01 2.443946e+01 8.687642e+00 5.024366e+00 2.163811e+01 6.093326e-01 1.503374e+00 2.263341e+00 2.177880e+01 2.851877e+01 1.240402e+01 7.498245e+00 1.186389e+01 1.229760e+01 NA12154 NA12234 NA12236 NA12763 NA12801 NA12812 NA12813 NA12878 NA10851 NA10854 NA10857 NA10859 NA10861 NA10863 NA11839 NA11840 NA11881 NA11882 8.293616e+00 4.019101e-19 2.733848e+01 2.623284e+01 2.320810e+01 5.112927e-01 1.432336e+01 1.000314e+01 1.675454e+01 8.239816e+00 2.449679e+01 2.655419e+01 2.294064e+01 2.218329e-17 8.844933e+00 2.911991e+00 2.170381e+01 3.089883e+00 NA11994 NA12044 NA12056 NA12057 NA12891 NA12892 1.668749e+01 1.588963e+01 5.913443e+00 2.924297e+01 1.765777e+01 7.935129e+00 Next, what I would like to do is to calculate the pvalue for each point, which was assigned to particular cluster. In order to do this i'm using pmvnorm function, but I found it difficult to set the region of integration. As I understand to get the probability of cluster membership I should define how 'far' from the cluster mean is my point. However, I've got 2d dataset and my mean is also 2d: [1,] [2,] 1.348992 1.269590 but I've got only one density value for each point. Using: pmvnorm(mean=dataset1MC$parameters$mean[,1],sigma=dataset1MC$parameters$variance$sigma[,,1], lower=2.218329e-17, upper=as.vector(dataset1MC$parameters$mean[,1])) gives strange results, since for 2.218329e-17 the output is: [1] 0.348126 attr(,"error") [1] 1e-15 attr(,"msg") [1] "Normal Completion" and pmvnorm(mean=dataset1MC$parameters$mean[,1],sigma=dataset1MC$parameters$variance$sigma[,,1], lower= as.vector(dataset1MC$parameters$mean[,1]) , upper=2.924297e+01) gives: [1] 0.348126 attr(,"error") [1] 1e-15 attr(,"msg") [1] "Normal Completion" If it is possible I would like to get some info about: Is my idea of calculating the probability of cluster membership is correct? How I can set properly the region of integration? I would be grateful for any help. Best Wishes, Bas. [[alternative HTML version deleted]]