Learn R Programming

chords (version 0.67)

generate.sample: Generates a random respondent driven sample

Description

Generates a discrete-time respondent driven sample assuming the model in the reference. Typically used to test estimate.rds

Usage

generate.sample(theta, Njs, beta, sample.length, double.sampling.warning.thresh = 0.05)

Arguments

theta
See reference.
Njs
See reference.
beta
See reference.
sample.length
The duration of sampling in discrete time units.
double.sampling.warning.thresh
Warns when the parameters are such that the probability of double sampling in a single time step is non negligible.

Value

  • A numeric vector of the degree of the individual sampled at each time step.

References

Respondent Driven Sampling as an Epidemic Process Berchenko Y., Rosenblatt J.D., White R.G.,Frost S.D.W. (2012) ?

See Also

estimate.rds

Examples

Run this code
network.size<- 2000
network.density<- 0.002
neighbour.count<- lapply(seq(1, network.size), function(x) rbinom(1, network.size, network.density))

Njs<- table(unlist(neighbour.count[neighbour.count>0]))
theta<- 1
beta<- 9e-8 
degree.sampled.vec<- generate.sample(theta = theta, Njs = Njs, beta = beta, sample.length = 5000)
plot(degree.sampled.vec, type='h')

Run the code above in your browser using DataLab