turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- CV: TTEST vs MEANS

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
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-28-2010 02:08 PM

I am trying to produce the coefficient of variation. I see that PROC MEANS calculates this simply as the STD/Arith.Mean, and I can verify that calculation if I output the std, mean, and cv.

However, I have also been told that PROC TTEST calculates the CV as well, when using the option dist=lognormal. In the past, I have only used this option for getting the geometric mean, so I was hesitant to use this to get the CV. However, the documentation does show that the CV is calculated. And while in the syntax documentation for TTEST itself, there is no mention of how CV is calculated, in this example, it states that the CV displayed with dist=lognormal is in fact the same: "The CV of 0.1676 is the ratio of the standard deviation to the (arithmetic) mean" (http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#/documentation/cdl/en/statug/63033/HTML/default/statug_ttest_sect013.htm).

My problem is that these two PROCs do not give the same result. The simple test I did was a dataset of number 1-10. Obviously, the dist option is affecting the calculation of the CV somehow. Can anyone explain to me the difference? Thanks!

data junk;

input x;

datalines;

1

2

3

4

5

6

7

8

9

10

;

run;

ods listing;

proc ttest data = junk dist = lognormal;

var x;

run;

proc means data = junk n mean std cv;

var x;

run;

Message was edited by: Kastchei (edited, since I had pasted in code that I had altered in an attempt to figure out the difference)

Message was edited by: Kastchei

However, I have also been told that PROC TTEST calculates the CV as well, when using the option dist=lognormal. In the past, I have only used this option for getting the geometric mean, so I was hesitant to use this to get the CV. However, the documentation does show that the CV is calculated. And while in the syntax documentation for TTEST itself, there is no mention of how CV is calculated, in this example, it states that the CV displayed with dist=lognormal is in fact the same: "The CV of 0.1676 is the ratio of the standard deviation to the (arithmetic) mean" (http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#/documentation/cdl/en/statug/63033/HTML/default/statug_ttest_sect013.htm).

My problem is that these two PROCs do not give the same result. The simple test I did was a dataset of number 1-10. Obviously, the dist option is affecting the calculation of the CV somehow. Can anyone explain to me the difference? Thanks!

data junk;

input x;

datalines;

1

2

3

4

5

6

7

8

9

10

;

run;

ods listing;

proc ttest data = junk dist = lognormal;

var x;

run;

proc means data = junk n mean std cv;

var x;

run;

Message was edited by: Kastchei (edited, since I had pasted in code that I had altered in an attempt to figure out the difference)

Message was edited by: Kastchei

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Kastchei

06-29-2010 07:48 AM

I did a quick search of the PROC TTEST documentation, and learned something new (as I almost always do when I read the manual). For the lognormal distribution, the formula for the CV is NOT the standard deviation divided by the mean. It is instead sqrt(exp(variance) - 1).

Given that, it doesn't surprise me so much that the CV of a lognormal variable is not the standard deviation divided by the mean. See also the documentation for PROC GLIMMIX, under the MODEL statement for the DIST= option, where the estimators for the lognormal distribution are given.

Steve Denham

Given that, it doesn't surprise me so much that the CV of a lognormal variable is not the standard deviation divided by the mean. See also the documentation for PROC GLIMMIX, under the MODEL statement for the DIST= option, where the estimators for the lognormal distribution are given.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

06-29-2010 09:15 AM

Thanks for the information!
For the folks at SAS, could I suggest that this definition be placed in the documentation in an easier place to find? The page covering CV (http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/statug_ttest_a0000000123.htm) has a section for the lognormal distribution, but does not mention that it is calculated differently from the normal distribution, which would tend to lead people to believe it is calculated the same way. Thanks!

Message was edited by: Kastchei

Message was edited by: Kastchei