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 at the end of May, and its replacement, statalist.org 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 <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
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 	
	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)) 
end 
	
Nick 
n.j.cox@durham.ac.uk 

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 <n.j.cox@durham.ac.uk> 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
> n.j.cox@durham.ac.uk
>
> N.M.Postel-Vinay@lse.ac.uk
>
> Is there a test of differences between geometric means, assuming lognormal distributions?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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