Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Too many weights" error message

    Hello,

    I ran across this error message ("too many weights") after drawing a stratified random sample from a large, administrative dataset (N=803903). The problem surfaces after trying to svyset the data. This is pretty straightforward sampling. Does anyone out there see a quick solution or an obvous source of error? Thanks.

    Here's the syntax, which specifies two strata:

    use "C:\dataset.dta", clear

    gen strata=1
    replace strata=2 if variable ==1
    sort strata
    by strata: count

    set seed 354354
    by strata: sample 1

    sort strata
    by strata: count

    gen pw=387895/3879 if strata==1
    replace pw=416008/4160 if strata==2

    gen fpc = 387895 if strata==1
    replace fpc = 416008 if strata==1

    svyset [pweight=pw], strata[strata] fpc(fpc)

    Error message: "too many weights"
    r(198)

  • #2
    The problem is that you used square bracket characters,, [ ], instead of parentheses to specify the strata option. The parser got confused and interpreted the [] as meaning that you were specifying more weights. Just change them to parentheses, (), // BUT LEAVE [pweight=pw] AS IS // and you'll be ok.

    That said, -replace fpc = 416008 if strata==1- appears to be an error: I think you mean -if strata == 2- here. (But this has nothing to do with the error message you were getting.)

    Finally, I'm a little worried about

    Code:
    gen strata=1
    replace strata=2 if variable ==1
    If variable is a dichotomous variable, then just -strata(variable)- in the -svyset- statement will suffice and there is no need to create a separate variable. If variable is not a dichotomy, then you are, in effect, re-organizing the strata in your data. You can't really do that. The strata are not just arbitrary designations you make: they reflect the way in which sampling was carried out and, in general, you have to take them the way they come to you in order to get correct standard errors. (In a situation where you have some strata with only a single PSU, you may be forced to combine those strata with others--but that is clearly not what you are doing here.)

    Comment


    • #3
      Thanks for your comments and critiques! I corrected the errors and everything is fine. Also, I was using a dichotomous variable to stratify, but appreciate your insights into generating standard errors. These data are administrative records, so I'm essentially imposing an artificial design in order to draw smaller, representative samples to work with.

      Comment

      Working...
      X