Displaying 2 results from an estimated 2 matches for "surveydesign".
2010 Jul 27
0
Multiple Strata Sampling in R Survey
...oportional
to size (pps) estimates for a dataset I have. The data has 2 strata,
weights, and cluster IDs. However, I can't find a way to use multiple
strata in the svydesign function. Currently, I'm ditching the weights
and using the second strata as a weighting mechanism (outlined below).
surveyDesign<-svydesign(id=~EstID, strata=~strataOne,
weights=~strataTwoMod, data=regressionData, nest=T)
But that really doesn't meet the needs of this project. I've also
tried it with strata=(~strataOne + strataTwo), but that didn't work
either. Does anyone know if its a) possible to do mutipl...
2011 Mar 30
1
sampling design runs with no errors but returns empty data set
...use.value.labels=FALSE)
missing_data<-subset(ces1, !is.na(ces08_NATWGT))
weight_test<-svydesign(id=~0, weights=~ces08_NATWGT, data=missing_data)
Note: this is some reproducible code that creates a data set that is a very stripped down version of what I'm working with, but with this, the surveydesign function appears to work properly.
mydat<-data.frame(ces08_HHWGT=runif(3000, 0.5, 5), ces08_PROVWGT=runif(3000, 0.6, 1.2), party=sample(c("NDP", "BQ", "Lib", "Con"), 3000, replace=TRUE), age=sample(seq(18, 72,1), 3000, replace=TRUE), income=sample(seq(21,...