Learn R Programming

NSUM (version 1.0)

nsum.simulate: Simulate NSUM Data

Description

This function simulates data from one of the four NSUM models.

Usage

nsum.simulate(n, known, unknown, N, model = "degree", ...)

Arguments

n
a non-negative 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 "degree", "barrier", "transmission", or "combined", with default "degree".
...
additional arguments to be passed to methods, such as starting values, prior parameters, and tuning parameters. Many methods will accept the following arguments:
mu
a real number, the location parameter for the log-normal distribution of network degrees, with default 5.

sigma
a positive number, the scale parameter for the log-normal distribution of network degrees, with default 1.

rho
a vector of numbers between 0 and 1 with length equal to the total number of subpopulations, known and unknown, the dispersion parameters for the barrier effects, with defaults 0.1.

tauK
a vector of numbers between 0 and 1 with length equal to the total number of unknown subpopulations, the multipliers for the transmission biases, with defaults 1.

Value

A list with two components:
y
a matrix of non-negagtive integers, the (i,k)-th entry represents the number of people that the i-th individual knows from the k-th subpopulation with the columns representing known subpopulations coming before the columns representing unknown subpopulations.
d
a vector of positive numbers, the network degrees of the individuals. Only the integer parts were used for simulation.

Details

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.

References

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

See Also

nsum.mcmc

Examples

Run this code
## 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)

Run the code above in your browser using DataLab