[R] mahalanobis distance
Ekin Akoglu
ekin at ims.metu.edu.tr
Mon Jul 20 22:47:35 CEST 2009
Thank you..this is what i needed...
Rolf Turner wrote:
>
> On 21/07/2009, at 7:57 AM, Michael Knudsen wrote:
>
>> On Mon, Jul 20, 2009 at 9:37 PM, ekinakoglu<ekin at ims.metu.edu.tr> wrote:
>>
>>> Could you please help me with a pseudo matrix of 4x4
>>> that is gonna work with mahalanobis?
>
> Please speak English. ``gonna'' is not appropriate
> for written communication.
>
>> Hmmm ... I have been trying some different matrices myself now, but I
>> keep getting the same error. Even if det(S) is very far from zero.
>> Maybe I just don't get the point of the mahalanobis() function in R.
>> It looks quite weird to me :-(
>
> Huh?
>
> Try:
>
> > set.seed(42)
> > X <- matrix(rnorm(100),25,4)
> > S <- var(X)
> > x <- rnorm(4)
> > mahalanobis(x,rep(1,4),S)
> [1] 6.082543
>
> cheers,
>
> Rolf Turner
>
>
> ######################################################################
> Attention:This e-mail message is privileged and confidential. If you
> are not theintended recipient please delete the message and notify the
> sender.Any views or opinions presented are solely those of the author.
>
> This e-mail has been scanned and cleared by
> MailMarshalwww.marshalsoftware.com
> ######################################################################
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the R-help
mailing list