|
|
|
||||
|
|
|||||
We will illustrate this using the hsb2 dataset pretending that the variable socst is the sampling weight (pweight) and that the sample is stratified on ses. Let's say that we wish to do a t-test for write by male/female.
use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear
svyset [pw=socst], strata(ses)
pweight: socst
VCE: linearized
Strata 1: ses
SU 1:
FPC 1:
svy: mean write, over(female)
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 3 Number of obs = 200
Number of PSUs = 200 Population size = 10481
Design df = 197
male: female = male
female: female = female
--------------------------------------------------------------
| Linearized
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
write |
male | 51.65351 1.041066 49.60045 53.70658
female | 55.81467 .721354 54.3921 57.23723
--------------------------------------------------------------
test [write]male = [write]female
Adjusted Wald test
( 1) [write]male - [write]female = 0
F( 1, 197) = 10.45
Prob > F = 0.0014
lincom [write]male - [write]female
( 1) [write]male - [write]female = 0
------------------------------------------------------------------------------
| Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | -4.161156 1.2871 -3.23 0.001 -6.699419 -1.622892
------------------------------------------------------------------------------
svy: regress write female
(running regress on estimation sample)
Survey: Linear regression
Number of strata = 3 Number of obs = 200
Number of PSUs = 200 Population size = 10481
Design df = 197
F( 1, 197) = 10.45
Prob > F = 0.0014
R-squared = 0.0519
------------------------------------------------------------------------------
| Linearized
write | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
female | 4.161156 1.2871 3.23 0.001 1.622892 6.699419
_cons | 51.65351 1.041066 49.62 0.000 49.60045 53.70658
------------------------------------------------------------------------------
test female
Adjusted Wald test
( 1) female = 0
F( 1, 197) = 10.45
Prob > F = 0.0014
Regardless of the method that we use, we obtain an F-ratio of 10.45 and a t-value
of 3.23 with a p-value of 0.0014.Note: This FAQ was inspired by several responses to a question on the Statalist.
UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services