Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: geometric mean saved results

From   JLGreig <>
Subject   Re: st: RE: geometric mean saved results
Date   Wed, 18 Sep 2002 11:14:29 -0700 (PDT)

I apologize--let me provide a few more details.  The
previous was actually part of a larger little program
which essentially used a portion of a large database
(gender==1), displayed a description of the ranksum to
be performed, quietly tabulated the arithmetic,
geometric, and harmonic means of a continuous variable
then attempted to ranksum test for differences in the
geometric means of that continuous variable across
categories of categorical variables noted as `1' (var1
var2), as in the below, full program.  There is only
one observation of the continuous variable per id.  

capture program drop taball
program define taball
	while "`1'" ~="" {
	use database1, clear
	keep if gender==1
	display "ranksum GEOMETRIC MEAN fp3 by `1' "
	sort `1'
	quietly means fp3
	local `gmeanfp3' = r(mean_g)
        ranksum `gmeanfp3' if `1'~=9999, by(`1')
		mac shift
taball var1 var2

I can report the geometric means of my continuous
variable across categories of var1, etc., but I want
to test if there are differences in these geometric
means of the continuous variable between those
categories of var1, if that makes sense.  

I know that the local macro generates a constant, and
thus the above would not work, however I can't think
of alternatives at this point.

Again, any suggestions would be appreciated.

--- "Steichen, Thomas" <> wrote:
> JL Greig writes:
> > I'm having a great deal of difficulty trying to do
> > anovas, ranksums, regressions, etc. on the
> geometric
> > mean of a continuous variable--just capturing the
> > saved results following a means command ofcourse
> does
> > not work, as below with ranksum:
> > 
> > .quietly means fp3
> > .local `gmeanfp3' = r(mean_g)
> > .ranksum `gmeanfp3' if `1'~=9999, by(`1')
> > 
> > which gives me an error message of "_= invalid
> name". 
> > 
> > Any suggestions at all would be much appreciated.
> JL,
> I think you need to be clearer about what you intend
> to accomplish.
> Please provide a more explicit description or
> example of what
> you are trying to do.
> Beyond that... it is very difficult to perform most
> statistical 
> techniques when your variable is a constant (and
> that is what you 
> have when you use -means- and a local macro). I'm
> sure -ranksum- 
> is blowing out because it does not have a variable
> to operate on... 
> `gmeanfp3' is a local macro, not a variable.
> Further, `1' may or may not be defined... but we
> can't tell from
> the code you show.
> Tom
> > CONFIDENTIALITY NOTE:  This e-mail message,
> including any attachment(s), contains information
> that may be confidential, protected by the
> attorney-client or other legal privileges, and/or
> proprietary non-public information.  If you are not
> an intended recipient of this message or an
> authorized assistant to an intended recipient,
> please notify the sender by replying to this message
> and then delete it from your system.  Use,
> dissemination, distribution, or reproduction of this
> message and/or any of its attachments (if any) by
> unintended recipients is not authorized and may be
> unlawful.

Do you Yahoo!?
Yahoo! News - Today's headlines
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index