[R] Mahalanobis Distance

David L Carlson dcarlson at tamu.edu
Tue Sep 27 15:12:38 CEST 2011

David Cross is correct. Your covariance matrix is singular because you have
more columns (15) than rows (2). David actually produced the covariance
matrix for cbind(s.1, s.2) which is not singular, but you are using
rbind(s.1, s.2). Try cor(rbind(s.1, s.2)) and you will see that the
correlations are all +/-1.

David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of david.jessop at ubs.com
Sent: Tuesday, September 27, 2011 3:20 AM
To: thetroopermail at gmail.com; r-help at r-project.org
Subject: Re: [R] Mahalanobis Distance


One thought would be to fit say a GARCH model to your historical data
series, divide the returns by the sigma estimates and then repeat.  This
would have the advantage of getting the data to be closer to the same scale.



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of jorgeA
Sent: 26 September 2011 21:07
To: r-help at r-project.org
Subject: Re: [R] Mahalanobis Distance

Hello David,

Thank you for the help anyway. Well answering your question "However, I
wonder how much value there is to computing the Mahalanobis distance with
two variables that are measured on such different scales?":

These two variables are subseries of the same time series. What I'm doing is
using one method of forecasting time series that searches in the past of the
time series, similar subseries to be an input of a forecasting function. I'm
testing several distance measures, and one of that is the mahalanobis

But right now I'm stuck with this problem....

Best regards,

Jorge Aikes Junior
Universidade Estadual do Oeste do Paraná - Brazil.

View this message in context:
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Issued by UBS AG or affiliates to professional =\ invest...{{dropped:10}}

More information about the R-help mailing list