This function simulates data from one of the four NSUM models.
1  nsum.simulate(n, known, unknown, N, model = "degree", ...)

n 
a nonnegative integer, the number respondents in the sample. 
known 
a vector of positive numbers, the sizes of known subpopulations. 
unknown 
a vector of positive numbers, the sizes of unknown subpopulations. 
N 
a positive number, the (known) total population size. 
model 
a character string, the model to be simulated from. This must be one of 
... 
additional arguments to be passed to methods, such as starting values, prior parameters, and tuning parameters. Many methods will accept the following arguments:

The function nsum.simulate
allows for the simulation of data from a random degree model based upon the Network Scale Up Method (NSUM). Options allow for the inclusion of barrier and transmission effects, both separately and combined, resulting in four models altogether. Each call to the function results in the simulation of a single realization of data.
A list with two components:
y 
a matrix of nonnegagtive integers, the 
d 
a vector of positive numbers, the network degrees of the individuals. Only the integer parts were used for simulation. 
Rachael Maltiel and Aaron J. Baraff
Maintainer: Aaron J. Baraff <ajbaraff at uw.edu>
Maltiel, R., Raftery, A. E., McCormick, T. H., and Baraff, A. J., "Estimating Population Size Using the Network Scale Up Method." CSSS Working Paper 129. Retrieved from https://www.csss.washington.edu/Papers/2013/wp129.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  ## load data
data(McCarty)
## simulate from model with barrier effects
sim.bar < with(McCarty, nsum.simulate(100, known, unknown, N, model="barrier",
mu, sigma, rho))
## simulate from model with both barrier effects and transmission biases
sim.comb < with(McCarty, nsum.simulate(100, known, unknown, N, model="combined",
mu, sigma, rho, tauK))
## extract data for use in MCMC
dat.bar < sim.bar$y
## view degree distribution
hist(sim.bar$d)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.