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

Re: st: svrest & svresttest commands

From   Nick Winter <>
Subject   Re: st: svrest & svresttest commands
Date   Tue, 15 Jun 2004 09:42:58 -0400

At 03:47 PM 6/14/2004 -0700, you wrote:
Hi everyone,
I am using the svrmean command to calculate the mean of variable by race and
gender.  I then want to see if difference in mean between males and females
among whites is significantly different from the gender difference in other
races.  I gather that fro this I need to use the svrest and svresttest
commands.  However, I do not know how to access the mean values after the
estimation command and do the test.  This is what I am doing (0 and 1 stand
for males and females respectively):
. svrest "svrmean usc, by (smallrace pcpreq)"
error when command executed on original dataset
invalid syntax
Please help.

As author of these programs, I'll take a crack at this.

I think in this case you don't actually need -svrest-, since you can use -svrmean- to get the basic means and their (co)variances. -svrest- is designed to let you do replication-based variance estimation for models and commands that don't have prepackaged svr-based programs already; this is not the case for means. (Think heckman, or user-written -nl- programs, etc.)

So in this case you can just use -svrmean-, followed by -test-:

. svymean usc, by(smallrace pcpreq)
. test [usc]1-[usc]2-[usc]3+[usc]4=0

(You will need to look at the handy key provided by -svrmean- to get the mappings between values of your by() variables and the values 1, 2, 3 and 4 displayed in the output).

Note also that -test- now recognizes the fact that the previous command was a -svy-command, so there is no need for -svytest-; my -svr- commands masquerade as -svy- commands in this context, so the adjusted test gets done.

--Nick Winter

Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government e
308 White Hall w
Cornell University
Ithaca, NY 14853-4601
* For searches and help try:

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