3
$\begingroup$

I am working with the SIPP data set and they use replicate weights. They offer advice here for what code you should use in Stata or SAS for applying their replicate weights correctly. Specifically they suggest:

svyset [pw=wpfinwgt], brrweight(repwgt1-repwgt240) fay(.5) vce(brr) mse

I am trying to do the same thing in R. I've gotten pretty close. But I'm not sure if what I'm doing is correct. This is the code I'm using for R:

svrepdesign(data = sippHH, weights = ~wpfinwgt, repweights = "repwgt[1-240]+",
              type = "Fay", rho = .5 , mse=TRUE)

This gets me the exact same point estimate for a key variable's mean but slightly different standard error (like 3-4% difference). If I specify the type in R as "BRR" I get standard errors that are about half the Stata standard errors.

Is this just a subtle difference in computation or am I specifying the use of weights wrong in R?

$\endgroup$
1

1 Answer 1

3
$\begingroup$

You've got the regular expression for the weights wrong. The example "wt[1-9]+" in the help page already matches any name starting with wt then a digit from 1 to 9. So you want repwgt[1-9]+. I think you're getting just names that have repwgt then a 1, 2, or 4.

If that's the problem then when you print the object the number of replicates should be wrong

$\endgroup$
1
  • $\begingroup$ Yep that was it. Thanks! $\endgroup$
    – Daniel
    Commented May 10 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.