Hi,
I want to know whether there is any function in R to find STRESS after using cmdscale and estimating the coordinates, I have written these functions to find stress (for p =1,2,3,4,5)
 
stress<-rep(0,5)
for(p in 1:5)
{
datahat<-cmdscale(d,p)
deltahat<-as.matrix(dist(datahat))
a<-0
b<-0
for(i in 1:n)
{
for(j in 1:n)
{
a<-d[i,j]^2+a
b<-(d[i,j]-deltahat[i,j])^2+b
}
}
stress[p]<-b/a
} 
stress<-sqrt(stress)
stress
 but it seems that it is not true when there are negative eigenvalues in dissimilarity matrix could you please help me to find the answer
thank you in anticipation

	[[alternative HTML version deleted]]

