Learn R Programming

chords (version 0.95.4)

makeRdsSample: Generate a synthetic (simulated) RDS sample.

Description

Generates a sample from the sampling process assumed in the reference. Well, actually, only the sufficient statistics required by Estimate.b.k are returned.

Usage

makeRdsSample(N.k, b.k, sample.length)

Arguments

N.k
An integer vector with the population frequency of each degree.
b.k
A numeric vector of the sampling rates of each degree.
sample.length
The length of the sample. Specified as the number of recruitees before termination.

Value

An object of class rds-object suitable for applying Estimate.b.k.

References

[1] Berchenko, Y., Rosenblatt J.D., and S.D.W. Frost. "Modeling and Analyzing Respondent Driven Sampling as a Counting Process." arXiv:1304.3505

See Also

Estimate.b.k

Examples

Run this code
# Generate data:
true.Nks <- rep(0,100); true.Nks[c(2,100)] <- 1000
theta <- 1e-1
true.log.bks <- rep(-Inf, 100);true.log.bks[c(2,100)] <- theta*log(c(2,100))
sample.length <- 1000L
rds.simulated.object <- makeRdsSample(
  N.k =true.Nks , 
  b.k = exp(true.log.bks),
  sample.length = sample.length)

# Estimate:
Estimate.b.k(rds.object = rds.simulated.object )
chords:::compareNkEstimate(rds.simulated.object$estimates$Nk.estimates, true.Nks)

Run the code above in your browser using DataLab