Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: -svy: mean- with more than 400 subpopulations


From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st: -svy: mean- with more than 400 subpopulations
Date   Fri, 28 Jan 2011 18:33:27 -0500

Julian, I didn't observe your anomaly with 440 groups of about 20 people each (one had n=19). Note that my -svy: mean- command was slightly different than the one you used. I'm on OS X 10.5.8

Steve
[email protected]

************************
set memory 500m
set matsize 11000
set seed 45681
sysuse auto, clear
 expand 150
 gen group = int(_n/20) +1
 sum group
 drop if group>440
gen wt = weight + 200*(runiform()-1/2)
gen mp = mpg + 10*(runiform()-1/2)
sum wt mpg
svyset _n
svy: mean wt mp , over(group)
***********************

On Jan 28, 2011, at 5:27 PM, Julian Reif wrote:

I am using the -svy: mean- command to calculate means for two different variables for 432 subgroups of a large survey and appear to be encountering a small bug. It looks like Stata allows only 400 subgroups for the first variable, and then stores the 401-432 results under the name of the second variable twice (see output table below). This is not just a display issue; typing -matrix list e(b)- at the prompt confirms that this is how the results are stored in the estimation matrices as well. If I calculate the mean for only the first variable (i.e., -svy, over(group1 group2 group3): mean var1- instead of -svy, over(group1 group2 group3): mean var1 var2-) then the results are stored correctly.

I am running Stata 11.1 on Windows XP.

Julian

. svyset psu [pw=finalwt], strata(stratum) vce(linearized) singleunit(certainty)
. svy, over(group1 group2 group3): mean var1 var2

[OUTPUT TRUNCATED]

--------------------------------------------------------------
            |             Linearized
       Over |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
var1     		 |
  _subpop_1 |   .2170561     .02307      .1718395    .2622727
  _subpop_2 |   .1973901   .0172478      .1635849    .2311953
  _subpop_3 |   .2355301   .0152678      .2056056    .2654546
  _subpop_4 |   .2178633   .0258603      .1671778    .2685488

[OUTPUT TRUNCATED]

_subpop_397 |   .1809095   .0799016      .0243045    .3375144
_subpop_398 |   .1797475   .0431691      .0951373    .2643578
_subpop_399 |   .1108647   .0274573      .0570492    .1646802
_subpop_400 |   .1140728   .0378074      .0399712    .1881744
-------------+------------------------------------------------
var2      		   |
_subpop_401 |   .1220596   .0589177      .0065825    .2375366
_subpop_402 |   .2157274   .0447505      .1280177    .3034371
_subpop_403 |   .1552482   .0413938      .0741174     .236379
_subpop_404 |   .1245167   .0353381      .0552549    .1937784
_subpop_405 |   .2652598   .0646241      .1385983    .3919213
_subpop_406 |   .3227641   .0486081      .2274935    .4180346
_subpop_407 |   .2232845   .0563774      .1127863    .3337827
_subpop_408 |   .5213186   .0662963      .3913796    .6512576
_subpop_409 |   .0456947   .0271772     -.0075719    .0989613
_subpop_410 |   .2182514   .0586816       .103237    .3332659
_subpop_411 |   .0941627   .0298316      .0356936    .1526317
_subpop_412 |   .0862663   .0301828      .0271088    .1454238
_subpop_413 |   .2665844   .0511932      .1662471    .3669217
_subpop_414 |   .0594012   .0159516      .0281365     .090666
_subpop_415 |   .2183684   .0927226      .0366345    .4001023
_subpop_416 |   .1884436   .0212088      .1468749    .2300122
_subpop_417 |   .1430124   .0431999      .0583418    .2276831
_subpop_418 |   .1655449   .0323325      .1021739    .2289158
_subpop_419 |   .1219798   .1190783     -.1114105      .35537
_subpop_420 |   .3343809   .0653186      .2063581    .4624038
_subpop_421 |   .2974747   .0662865      .1675548    .4273945
_subpop_422 |   .2186971   .0443009      .1318686    .3055256
_subpop_423 |    .248453   .0750676      .1013225    .3955836
_subpop_424 |   .1507373   .0293883      .0931371    .2083376
_subpop_425 |   .1264791   .0589568      .0109253    .2420329
_subpop_426 |   .1943461   .0580817      .0805076    .3081846
_subpop_427 |    .048906   .0251299     -.0003479    .0981599
_subpop_428 |   .1955444   .0570189      .0837888    .3072999
_subpop_429 |   .1472326    .026584      .0951287    .1993364
_subpop_430 |   .2944994   .0681236       .160979    .4280198
_subpop_431 |   .3005097   .0592136      .1844525    .4165668
_subpop_432 |   .2941677   .0757431      .1457133    .4426222
  _subpop_1 |   .2737736   .0243363      .2260751    .3214721
  _subpop_2 |   .2566782   .0189196      .2195962    .2937602
  _subpop_3 |   .2863156   .0159561      .2550421    .3175891

[OUTPUT TRUNCATED]

_subpop_429 |   .2308088   .0369137      .1584589    .3031587
_subpop_430 |    .337545   .0700012      .2003444    .4747456
_subpop_431 |   .3898697   .0618927      .2685617    .5111777
_subpop_432 |   .4168595   .0767432      .2664447    .5672742
--------------------------------------------------------------
Note: strata with single sampling unit treated as certainty
     units.



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

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index