Announcement

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

  • Error 504 when using Epctile with svy option

    I'm using data from IPUMS USA, and I'm trying to find the median of a numeric variable for income with the person weight applied. So, I found the epctile command. I am using four different data sets with different subsets of the larger sample, and am using the IPUMS USA person weight (perwt). When I use the epctile command, it has worked fine with three of the datasets, but with one, it has given back the error "estimates post: matrix has missing values" when using the epctile command. There are no missing values though. I also tried the same syntax with other numeric variables in this particular dataset and it gives back the same error. This is the syntax I used and Stata's response:

    Code:
     svyset cluster [pweight=perwt], strata(strata)
    
    Sampling weights: perwt
    VCE: linearized
    Single unit: missing
    Strata 1: strata
    Sampling unit 1: cluster
    FPC 1: <zero>
    Code:
     epctile inctot, p(50) svy
    estimates post: matrix has missing values
    r(504);
    I also included an example of the data for the variable I am using below. Any help with this issue would be appreciated--Thank you!
    -Claire


    Example of some data from the inctot variable using dataex:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long inctot
    15100
    12000
    14000
    36000
    870
    14000
    30000
    14000
    870
    40000
    12000
    7200
    10000
    870
    12000
    14000
    12000
    7200
    14000
    12000
    7000
    6400
    7200
    40000
    18000
    18000
    98000
    65000
    3200
    48000
    19300
    27000
    20600
    30000
    55000
    50000
    70000
    7200
    70000
    62000
    0
    27000
    10000
    58000
    68000
    29000
    55000
    9900
    25000
    110000
    52000
    43000
    33000
    43800
    17000
    22000
    24000
    7300
    35000
    29000
    5400
    30000
    21000
    40000
    4600
    20800
    45000
    4600
    19600
    80000
    43500
    79300
    32000
    40000
    35700
    10000
    60000
    40000
    15000
    23000
    58000
    40000
    14180
    30700
    25500
    25000
    32000
    40800
    28000
    25000
    22000
    40700
    26500
    29000
    118000
    9000
    95600
    50000
    33800
    9300
    end
    Last edited by Claire Connacher; 06 Jul 2023, 14:58.

  • #2
    epctile is from http://staskolenikov.net/stata (FAQ Advice #12).


    epctile from http://staskolenikov.net/stata
    epctile -- estimation and inference for percentiles / / Author: Stas
    Kolenikov, skolenik at gmaildotcom / epctile is an e-class version of
    pctiles that produces / standard errors in addition to point estimates, /
    including standard errors for complex survey data.
    From the command's description, the command estimates point estimates and standard errors and for one reason or another, it is not able to do so with your final dataset. One reason in survey data as addressed in the following linked Stata FAQ is the existence of stratum with single sampling unit: https://www.stata.com/support/faqs/s...se-of-stratum/. So check out what is peculiar about your data. But essentially, you will get the error if you try to store the coefficient vector (b) and variance-covariance matrix (V) into Stata's system, and either or both of these contain missing values.

    Code:
    mat b= J(1, 3, .)
    mat V= J(3, 3, .)
    mat l b
    mat l V
    ereturn post b V
    Res.:

    Code:
    . mat b= J(1, 3, .)
    
    .
    . mat V= J(3, 3, .)
    
    .
    . mat l b
    
    b[1,3]
        c1  c2  c3
    r1   .   .   .
    
    .
    . mat l V
    
    symmetric V[3,3]
        c1  c2  c3
    r1   .
    r2   .   .
    r3   .   .   .
    
    .
    . ereturn post b V
    estimates post: matrix has missing values
    r(504);
    
    .

    Comment


    • #3
      Thank you! I followed the article about strata with a single sampling units and found there were two strata with single sampling units in my data set, so I followed the solution using the option
      Code:
      singleunit(certainty)
      to the command svyset, and that seemed to do the trick. Thanks!
      -Claire

      Comment

      Working...
      X