Re: [R] mahalanobis

2007-06-02 Thread Michael Friendly
Yianni You probably would have gotten more helpful replies if you indicated the substantiative problem you were trying to solve. From your description, it seems like you want to calculate leverage of predictors, (X1, X2) in the lm( y ~ X1+X2). My crystal ball says you may be an SPSS user, for

Re: [R] mahalanobis

2007-06-01 Thread gatemaze
On 31/05/07, Anup Nandialath [EMAIL PROTECTED] wrote: oops forgot the example example try this line sqrt(mahalanobis(all, colMeans(predictors), cov(all), FALSE) Hi and thanks for the reply Anup. Unfortunately, I had a look on the example before posting but not much of a help... I did some

[R] mahalanobis

2007-05-31 Thread gatemaze
Hi, I am not sure I am using correctly the mahalanobis distnace method... Suppose I have a response variable Y and predictor variables X1 and X2 all - cbind(Y, X1, X2) mahalanobis(all, colMeans(all), cov(all)); However, my results from this are different from the ones I am getting using another

[R] Mahalanobis distance and probability of group membership using Hotelling's T2 distribution

2007-02-20 Thread Mike White
I want to calculate the probability that a group will include a particular point using the squared Mahalanobis distance to the centroid. I understand that the squared Mahalanobis distance is distributed as chi-squared but that for a small number of random samples from a multivariate normal

[R] Mahalanobis distance and probability of group membership using Hotelling's T2 distribution

2007-02-20 Thread Mike White
I want to calculate the probability that a group will include a particular point using the squared Mahalanobis distance to the centroid. I understand that the squared Mahalanobis distance is distributed as chi-squared but that for a small number of random samples from a multivariate normal

[R] Mahalanobis distances

2005-06-24 Thread Karen Kotschy
Dear R community Have just recently got back into R after a long break and have been amazed at how much it has grown, and how active the list is! Thank you so much to all those who contribute to this amazing project. My question: I am trying to calculate Mahalanobis distances for a matrix

Re: [R] Mahalanobis distances

2005-06-24 Thread Spencer Graves
The first thing I'd try is scale, as that should not affect the Mahalinobis distances: Fgmat - scale(fgmatrix) fg.cov - cov.wt(Fgmat) mahalanobis(Fgmat, center = Fg.cov$center, cov = Fg.cov$cov) Does this give you the same result. If no, the

Re: [R] Mahalanobis distances

2005-06-24 Thread Christian Hennig
On Fri, 24 Jun 2005, Spencer Graves wrote: (...) The key is computing your own generalized inverse and using that with inverted=TRUE. (...) One method to do this is function solvecov in package fpc. Christian spencer graves Karen Kotschy wrote: Dear R community Have

[R] mahalanobis distance

2004-09-12 Thread Murli Nair
Is there a function that calculate the mahalanobis distance in R . The dist function calculates euclidean', 'maximum', 'manhattan', 'canberra', 'binary' or 'minkowski'. Thanks ../Murli __ [EMAIL PROTECTED] mailing list

RE: [R] mahalanobis distance

2004-09-12 Thread Liaw, Andy
See (surprising enough) ?mahalanobis... Andy From: Murli Nair Is there a function that calculate the mahalanobis distance in R . The dist function calculates euclidean', 'maximum', 'manhattan', 'canberra', 'binary' or 'minkowski'. Thanks ../Murli

RE: [R] mahalanobis distance

2004-09-12 Thread John Fox
: [R] mahalanobis distance Is there a function that calculate the mahalanobis distance in R . The dist function calculates euclidean', 'maximum', 'manhattan', 'canberra', 'binary' or 'minkowski'. Thanks ../Murli __ [EMAIL PROTECTED] mailing list

[R] Mahalanobis

2004-03-26 Thread Alberto Murta
Dear all Why isn'it possible to calculate Mahalanobis distances with R for a matrix with 1 row (observations) more than the number of columns (variables)? mydata - matrix(runif(12,-5,5), 4, 3) mahalanobis(x=mydata, center=apply(mydata,2,mean), cov=var(mydata)) [1] 2.25 2.25 2.25 2.25 mydata

RE: [R] Mahalanobis

2004-03-26 Thread Liaw, Andy
If I'm not mistaken, the data you generated form a simplex in the p-dimensional space. Mahalanobis distance for such data, using sample mean and covariance, just give the distance to the centroid after normalization. The normalization step make all the points equidistance from the centroid. To