[R] Drawing a sample based on certain condition
Brian Smith
br|@n@m|th199312 @end|ng |rom gm@||@com
Mon Apr 14 13:26:45 CEST 2025
Hi,
For my analytical work, I need to draw a sample of certain sample size
from a denied population, where population members are marked by
non-negative integers, such that sum of sample members if fixed. For
example,
Population = 0:100
Sample_size = 10
Sample_Sum = 20
Under this setup if my sample members are X1, X2, ..., X10 then I
should have X1+X2+...+X10 = 20
Sample drawing scheme may be with/without replacement
Is there any R function to achieve this? One possibility is to employ
naive trial-error approach, but this doesnt seem to be practical as it
would take long time to get the final sample with desired properties.
Any pointer would be greatly appreciated.
More information about the R-help
mailing list