# [R] Using the Mahalanobis Function

From: Tyler Rinker <tyler_rinker_at_hotmail.com>
Date: Sun, 20 Mar 2011 01:53:47 -0400

I am a 2 month newbie to R and am stumped. I have a data set that I've run multivariate stats on using the manova function (I included the data set). Now it comes time for a table of effect sizes with significance. The univariate tests are easy. Where I run into trouble filling in the table of effect sizes is the Mahalanobis D as an effect size. I've included the table so you can see what group's I'm comparing. I know there's a great function for filling in ?1 and ?2 : mahalanobis(x, center, cov, inverted=FALSE, ...)

The problem is I lack the knowledge around cluster analysis of what goes into the function for [x, center, & cov.] I have only a basic understanding of this topic (a picture of a measured distance between two clusters on a graph). Could someone please use my data set or a similar one (a multivariate with at least 3 outcome variables) and actually run this function (mahalanobis). Then please send me your output from [R] starting from the data set all the way to the statistic. PS I know the Mahalanobis D should be ?1=3.93 & ?2=3.04.

The Y,M,O in the data set stands for young, middle, old.

I am running the latest version of R on a windows 7 machine.

Effect Sizes

Contrasts

Dependent Variables

Friends

Parents

Strangers

All

Young-Middle

-1.8768797*

-3.2842941*

-1.1094004*

?1

Middle-Old

1.34900725*

1.54919532*

-2.0107882*

?2

Gender Age Friend.Agression Parent.Agression Stranger.Agression

```1       f   y                8                7                  8
2       f   y                5                6                  8
3       f   y                6                3                  7
4       f   y                5                5                  7
5       f   m               15               13                 10
6       f   m               13               11                  9
7       f   m               12               12                  9
8       f   m               18               10                  7
9       f   o               11               11                 10
10      f   o               10                4                 12
11      f   o               12                9                 12
12      f   o                9                8                 14
13      m   y               13                7                  7
14      m   y                9                5                 10
15      m   y               11                4                  4
16      m   y               15                3                  4
17      m   m               14               12                  8
18      m   m               10               15                 11
19      m   m               12               11                  8
20      m   m               10                9                  9
21      m   o               10                8                 11
22      m   o               13               11                 13
23      m   o                9                8                 12
24      m   o                7                9                 16

[[alternative HTML version deleted]]

______________________________________________
```
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 20 Mar 2011 - 05:59:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 Mar 2011 - 10:40:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.