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: means compairison with weights and unequal variance


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: means compairison with weights and unequal variance
Date   Mon, 21 Nov 2011 09:09:48 +0000

The syntax ` ' only de-references local macro names. Once you change
the syntax as you did, the --ttesti- call reduces to

ttesti, unequal

which makes no sense. There is no reason to change it anyway.

Nick

On Mon, Nov 21, 2011 at 9:02 AM, David Ashcraft
<ashcraftd@rocketmail.com> wrote:
> John,
>
> I am trying to implement the code but replacing local with gen. Why I am not getting the same result, if I use gen rather than local?
>
> David
>
>
> ----- Original Message -----
> From: John Luke Gallup <jlgallup@pdx.edu>
> To: statalist@hsphsun2.harvard.edu
> Cc:
> Sent: Monday, November 21, 2011 8:40:40 AM
> Subject: Re: st: means compairison with weights and unequal variance
>
> Barbro,
>
> A simple alternative is to calculate the means and standard deviations for each group using -summarize- with weights, and then run -ttesti ..., unequal-:
>
> sysuse auto, clear
>
> sum mpg if foreign [aw=weight]
> local N1 = r(N)
> local av1 = r(mean)
> local sd1 = r(sd)
>
> sum mpg if !foreign [aw=weight]
> local N2 = r(N)
> local av2 = r(mean)
> local sd2 = r(sd)
>
> ttesti `N1' `av1' `sd1' `N2' `av2' `sd2', unequal
>
> John
>
> John Luke Gallup
> Department of Economics
> Portland State University
>

*
*   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