David Remotti
2016-Aug-29 16:48 UTC
[R] how to prepare my data to be used in the "survey" package
Looking for some help in using the "survey" package I have gone through the documentation but still find problems in understanding how to prepare my data to be analyzed wih this package. In particular I dont understand how to prepare the fpc data. The documentation provides a "small survey example" where 6 variables are given: stratid,psuids,weight,nh,Nh and x My survey is a two stage stratified sampling so I have for each stratum the number of primary and secondary units in the sample and in the population, and using these data I can prepare such data frame, except for the last variable "x". I cant understand what does it means and which information I have to put there. A second (minor) problem is that my stratification is based on two variables, but it looks like it is only possible to give 1 variable as strata parameter. Is it possible to give two ? thanks in advance for any indication David Remotti Rome Italy
David Winsemius
2016-Aug-29 18:29 UTC
[R] how to prepare my data to be used in the "survey" package
> On Aug 29, 2016, at 9:48 AM, David Remotti <david at agros.it> wrote: > > Looking for some help in using the "survey" package > I have gone through the documentation but still find problems in understanding how to prepare my data to be analyzed wih this package. > > In particular I dont understand how to prepare the fpc data. > The documentation provides a "small survey example" where 6 variables are given: > stratid,psuids,weight,nh,Nh and x > > My survey is a two stage stratified sampling so I have for each stratum the number of primary > and secondary units in the sample and in the population, and using these data I can prepare such > data frame, except for the last variable "x". > I cant understand what does it means and which information I have to put there. > > A second (minor) problem is that my stratification is based on two variables, but it looks like it is only possible to give 1 variable as strata parameter. > Is it possible to give two ?This tutorial by Lumley illustrates both data preparation and the use of a two-stage clustered design: https://www.unc.edu/courses/2010spring/ecol/562/001/docs/lectures/lecture20.htm#svydesign Found with a google search on "primary sampling unit secondary sampling unit r survey package lumley" -- David Winsemius Alameda, CA, USA