I'm using the Survey package of R and, when doing some svymean()
, what returns is warning :
Design has only one primary sampling unit.
I'm using the Survey package of R and, when doing some svymean()
, what returns is warning :
Design has only one primary sampling unit.
No code is difficult to help you with, but this error is usually associated with variance calculation (which obviously requires more than one observation). You can work around this by changing the action option to 'lonely PSU' through options(survey.lonely.psu = )
, which accepts the options:
Handling of strata with a single PSU that is not certainty PSUs is controlled by 'options ("survey.lonely.psu")'. The default setting is '' Fail '', which gives an error. Use '' remove '' to ignore that PSU for variance computation, '' adjust '' to center the stratum at the population mean rather than the stratum mean, and '"average"' to replace the variance contribution of the stratum by the average variance contribution across strata. As of version 3.4-2 'as.svrepdesign' also use this option.
This probably means that you have stated your sample design as having conglomerates when in fact it does not. If this is the case, when you declare the sample drawing in the svydesign()
function, use the value '1' for the id parameter. For example:
design <- svydesign(id =~ 1, strata =~ estrato, weights =~ pesos, data = dados)
Another possibility is that its conglomeration variable (the id parameter in the svdesign function) has a single value. In this case, if you really have conglomeration in your sample plan, you indicate in that variable which conglomerate each element in your data set belongs to.
In any case, send the code, as Daniel and Athos have suggested, so that we can diagnose this better.