Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: Test of differences between geometric means

From   Nick Cox <>
To   "''" <>
Subject   RE: st: RE: Test of differences between geometric means
Date   Tue, 15 Nov 2011 18:31:25 +0000

The majority of user-written programs were written because the programmers wanted to use them themselves. So, you may need to write what you want to use. Meanwhile here is one sketch. 

*! 0.1.0 NJC 15 Nov 2011
program geomsu, rclass  
	version 9 
	syntax varname(numeric) [if] [in] 
	marksample touse 
	qui count if `touse' 
	if r(N) == 0 error 2000 
	qui count if `touse' & `varlist' <= 0 
        if r(N) > 0 error 411 
	quietly { 	
		tempvar work 
		gen `work' = log(`varlist') if `touse' 
		su `work'
		local fmt : format `varlist' 

	di "geometric mean  " `fmt' exp(r(mean)) 
	di "geometric SD    " `fmt' exp(r(sd)) 
	return scalar gmean = exp(r(mean))
	return scalar gsd = exp(r(sd)) 

Junlin Liao

I'm wondering if someone could write a procedure to summarize
lognormal data automatically in the form of geometric mean and std
etc. It's easy to transform data to get the results, but it would be
nice if it's automated. The means commands (gmeans or ameans) do not
give standard deviation.

On Tue, Nov 15, 2011 at 3:41 AM, Nick Cox <> wrote:

> There is I believe some literature on ad hoc tests for this question, but the results of
> . findit lognormal
> do not show any Stata implementations. I'd recast the problem as one of estimating a model using either -glm, link(log) f(normal)- or -lognfit- (SSC).
> Nick
> Is there a test of differences between geometric means, assuming lognormal distributions?

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index