turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Computing Sample Covariance

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 1, 2011 7:13 AM
(444 views)

I have the following matrix: [35 36 40, 38 37 40, 48 41 42, 50 46 54] for which I am trying to compute the sample covariance. When calculating by hand, the sample covariance matrix should be: [40.6875 23.5 28.0, 23.5 15.5 21.5, 28.0 21.5 34.0] however I am unable to recreate this in JMP. I found an option for calculating covariance, but it does not return the same result.

Can anyone help point me in the right direction? I'm extremely new to this software and never used software as an undergraduate.

Thanks!

Anna

1 REPLY

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 1, 2011 2:14 PM
(294 views)

Try the JSL code below (open a script windom and paste and hit run).

sample_Q = Covariance**(** **[****35** **36** **40**, **38** **37** **40**, **48** **41** **42**, **50** **46** **54****]** **)**;

pop_Q = Covariance**(** **[****35** **36** **40**, **38** **37** **40**, **48** **41** **42**, **50** **46** **54****]** **)** * **3** / **4**;

Show**(** sample_Q, pop_Q **)**;

You should get the results

**sample_Q = **

**[** **54,25 31,33 37,33, **

**31,33 20,66 28,66, **

**37,33 28,66 45,33];**

**pop_Q = **

**[** **40,6875 23,5 28, **

**23,5 15,5 21,5, **

**28 21,5 34];**

The latter equals your calculation. The difference between the two is a factor of 3/4 i.e. (N-1)/1. I think the equation you have used is actually not for the (unbiased) sample covariance but rather the population covariance which would be the right choice if the population mean is known. Try to use N-1 as denominator instead of N and you should end up with the same covariance estimate as JMPs formula.