if (FALSE) {
library(SamplingStrata)
data(swisserrors)
data(swissstrata)
# suggestion
solutionKmean <- KmeansSolution(strata=swissstrata,
errors=swisserrors,
nstrata=NA,
showPlot=TRUE)
# number of strata to be obtained in each domain
nstrat <- tapply(solutionKmean$suggestions,
solutionKmean$domainvalue,
FUN=function(x) length(unique(x)))
# optimisation of sampling strata
solution <- optimStrata (
method = "atomic",
errors = swisserrors,
strata = swissstrata,
nStrata = nstrat,
suggestions = solutionKmean
)
}
Run the code above in your browser using DataLab