2
I am using the R Survey package and, while performing some svymean()
, what returns is the Warning:
Design has only one Primary sampling Unit.
2
I am using the R Survey package and, while performing some svymean()
, what returns is the Warning:
Design has only one Primary sampling Unit.
1
This probably means that you declared your sample design as having conglomerates when in reality it does not. If this is the case, when you declare the sample design in the function svydesign()
, use the value '1' for the parameter id. For example:
design <- svydesign(id =~ 1, strata =~ estrato, weights =~ pesos, data = dados)
Another possibility is that its conglomerization variable (the id parameter in the svdesign function) has a single value. In this case, if you actually have conglomerization in your sampling plan, you indicate in this variable which cluster each element in your data set belongs to.
Anyway, send the code, like Daniel and Athos suggested, so we can diagnose it better.
1
Without code it is difficult to help you, but this error is usually associated with the variance calculation (which obviously needs more than one observation). It is possible to circumvent this by changing the action option to 'Lonely PSU' through the options(survey.lonely.psu = )
, that accepts the options:
Handling of strata with a single PSU that are 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 uses this option.
Browser other questions tagged r
You are not signed in. Login or sign up in order to post.
Henrique, it is easier to answer if you send an example of code in which this happens. I am not able to reproduce your error.
– Daniel Falbel
It has little information msm, but I guess the problem must be in some calculation that requires degrees of freedom, such as variance. Does the result involve variance? If yes, there must be some partitioning that isolates a single observation, making the variance calculation indefinite. One attempt would be to consider fewer control variables (kicking q they exist).
– Athos