Well, I've removed the need for the "if `1'~=9999" and
the below does perform ranksums, however I'm still
concerned since each p-value is exactly the same for
all the ten variables (var1-var10) in the output.
Also, when I substitute regresss for ranksum, only
coefficients appear in the output tables--with "."
appearing in the regression output columns for Std.
Err., t, P>|t|, etc., ...so now I'm REALLY scared.(!)
But thanks anyways. If the other STATA gods have
suggestions, I'll still take 'em.
--- "Steichen, Thomas" <[email protected]> wrote:
> JL Greig writes:
>
> > 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
> > }
> > end
> > 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.
>
> Consider rewriting your code as:
>
>
-------------------------------------------------------
> capture program drop taball
> program define taball
> use database1, clear
> keep if gender == 1
>
> tempvar log_fp3 mlog_fp3 gm_fp3
>
> while "`1'" ~= "" {
> display "ranksum GEOMETRIC MEAN fp3 by `1'"
> sort `1'
>
> * manually generate geometric means within
> levels of `1'
> qui gen `log_fp3' = log(fp3)
> qui egen `mlog_fp3' = mean(`log_fp3'), by(`1')
> qui gen `gm_fp3' = exp(`mlog_fp3')
>
> ranksum `gm_fp3' if `1' ~= 9999, by(`1')
>
> drop `log_fp3' `mlog_fp3' `gm_fp3'
>
> mac shift
> }
> end
>
> taball var1 var2
>
---------------------------------------------------------
>
> Having done that, you should note that using the
> geometric
> mean is no different from using the mean. Ranks are
>
> preserved by this transformation, so the statistics
> in
> -ranksum- will be identical.
>
> Also, I would be concerned of the effect of using
> the
> "if `1' ~= 9999" qualifier for -ranksum- while not
> enforcing
> it on the calculation of the geometric means.
>
> Overall, It seems more likely to me that you must
> want the geometric
> means of fp3 computed for levels of a different
> categorical variable
> (not `1'), as the above approach seems to accomplish
> nothing useful.
>
> 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
http://news.yahoo.com
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/