1

I'm trying to weight survey data in R. I'm using Stata code as a reference.

The code used on that program to weight my data was:

svyset [iw=wgtp], vce(sdr), sdrweight(wgtp1-wgtp80) mse

I translated that code into R code like this:

svydesign(ids = ~1, data = house.data, weights = (~wgtp1-wgtp80))

However I am unsure whether this is a correct translation and if I am applying this correctly in R. Any insight and suggestions would be greatly appreciated!

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
Matt
  • 11
  • 2
  • 1
    hi, that doesn't look correct.. maybe see table two of https://journal.r-project.org/archive/2009-2/RJournal_2009-2_Damico.pdf and also the note on pdf page 63 of https://cran.r-project.org/web/packages/survey/survey.pdf ? – Anthony Damico Oct 15 '17 at 14:52

1 Answers1

0

With the current version of 'survey', you want

svrepdesign(data=house.data, weights=~wgtp, repweights="wgtp[1-9]+",type="successive-difference")

That is svrepdesign for a survey with replicate weights, sampling weights wgtp, and replicate weights wgtp1-wgtp80, and "successive difference" weights.

Thomas Lumley
  • 1,893
  • 5
  • 8