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

Recent Posts
 Itâ€™s not my consensus: Motivated reasoning and the sources of scientific illiteracy
 Negativity and Positivity Biases in Economic News Coverage: Traditional vs. Social Media
 Perceptions of health risks of cigarette smoking: A new measure reveals widespread misunderstanding
 Motivated Reasoning in Perceived Credibility of Public Opinion Polls
 _____________
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 RealLife Sample Surveys”. I have no reference or formulas for your functions to compare them to my own.
I wonder what your weighted ttest 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 pvalue 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.
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 non1 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.