Weights

Currently in version 0.70, the weights package in R provides basic tools for quickly analyzing survey data and producing weighted statistics.

This entry was posted in Software. Bookmark the permalink.

3 Responses to Weights

  1. Brent says:

    Your weights package would be extremely useful to me – if there was documentation on how weighted statistics are calculated or at least references in the help documentation. My own code to produce weighted chi square tests of independence gives slightly different results than wtd.chi.sq(). I wrote the code using Dorofeev and Grant, “Statistics for Real-Life Sample Surveys”. I have no reference or formulas for your functions to compare them to my own.

  2. Tim says:

    I wonder what your weighted t-test is doing: I notice that your code doesn’t give the same answer for proportional weights. If you use the same data, but multiply the weights by some constant other than one, the p-value completely changes. That’s not what I would expect to see from a weighted analysis. What are the weights supposed to mean? Are they supposed to have mean equal to 1? If so, it would be nice if this were explained in the documentation.

    • Josh Pasek says:

      The package is designed to calculate weights where N is equal to the sum of the weights. Hence, if the weights are not set to mean to 1, it will assume that the non-1 value is correct and will use that value. This is sometimes used for datasets where researchers catalog the number of cases with a particular set of values rather than using the weights to solely correct for demographic differences. I’ll try to add in a default option that sets the mean to 1 and allows researchers to turn that off in the next iteration.

Leave a Reply