Dear R-users, Recently I had to analyze a dataset from household survey. The sample design ensured, that each household in the population has the same probability of being sampled. However the data were gathered from only one adult individual in each household, who was randomly choosen by an interviewer (via "Kish grid"). To equalize the probabilities for each INDIVIDUAL a casewise weighting factor is introduced. It is proportional to the reciprocal of the number of adults in the household and rescaled so it's sum equals the sample size. This weighting factor is neccessery to perform inferences for population of individuals. I had no problems with estimating models which use count data, because I could construct contingency tables with something like: tapply(weight, a.bunch.of.factors, sum) Unfortunately I couldn't come up with a good way of building other kinds of models for those data. Is there some way (apart for writing new functions from scratch) to perform modelling tasks like lm(), that will take the weights into account? (As far as I know there are only basic functions weighted.mean() and cov.wt() for weighted means and weighted covariance/correlation matrices respectively.) Thank you in advance for any suggestions. Michal ~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~ Michal Bojanowski Institute for Social Studies University of Warsaw Poland http://www.iss.uw.edu.pl -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear Michal, As far as I know (and I'd be happy to be wrong), there's no *general* way of introducing case weights in R. The glm function, however, accommodates case weights via its weights argument, and this might be sufficient to do what you want to do. You'll have to be careful with inferences, though. Perhaps someone else on the list can provide additional information. John At 05:22 PM 11/14/2002 +0100, Michal Bojanowski wrote:>Recently I had to analyze a dataset from household survey. The sample design >ensured, that each household in the population has the same probability of >being >sampled. However the data were gathered from only one adult individual in each >household, who was randomly choosen by an interviewer (via "Kish grid"). To >equalize the probabilities for each INDIVIDUAL a casewise weighting factor is >introduced. It is proportional to the reciprocal of the number of adults >in the >household and rescaled so it's sum equals the sample size. This weighting >factor >is neccessery to perform inferences for population of individuals. > >I had no problems with estimating models which use count data, because I could >construct contingency tables with something like: > >tapply(weight, a.bunch.of.factors, sum) > >Unfortunately I couldn't come up with a good way of building other kinds of >models for those data. Is there some way (apart for writing new functions from >scratch) to perform modelling tasks like lm(), that will take the weights into >account? > >(As far as I know there are only basic functions weighted.mean() and cov.wt() >for weighted means and weighted covariance/correlation matrices respectively.)----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: jfox at mcmaster.ca phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox ----------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._