Hi,
I am not sure if there is a package for this but assuming that your data is
A=[a1,a2,a3,a4...,an] in rows.
Then,
%A=matrix(rnorm(50),nr=5) %testing case 1
%A=matrix(rep(1,100),nr=5) %testing case 2
myDist=function(A){
intermediateRes1=A%*%t(A)
myVec=sqrt(diag(
intermediateRes1))
intermediateRes2=myVec%*%t(myVec)
myResult=as.dist(intermediateRes1/intermediateRes2)
return(myResult)
}
should do what you want.

cheers,
Achilleas


On Mon, Jun 27, 2011 at 8:35 AM, Sean Davis <sdavis2@mail.nih.gov> wrote:

> Hi, Joe.
>
> Not positive if this is what you want, but you might look at the
> cosine() function in the lsa package.
>
> Sean
>
> On Mon, Jun 27, 2011 at 8:24 AM, joe j <joe.stata@gmail.com> wrote:
> > Dear All,
> >
> > I am after a package that would calculate the uncentred correlation
> > (or cosine similarity; http://en.wikipedia.org/wiki/Cosine_similarity)
> > between pairs of observations. I know that bioconductor has packages
> > that compute distance measures such as mahalanobis distance (the
> > package mdqc does this). Is there any package that calculates cosine
> > similarity?
> >
> > Regards,
> > Joe.
> >
> > _______________________________________________
> > Bioconductor mailing list
> > Bioconductor@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/bioconductor
> > Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
> >
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

