nsum.mcmc(dat, known, N, indices.k = (length(known)+1):(dim(dat)[2]), iterations = 1000, burnin = 100, size = iterations, model = "degree", ...)
(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.
dat
representing the unknown subpopulations of interest, with defaults of all unknown subpopulations in dat
.
iterations
.
"degree"
, "barrier"
, "transmission"
, or "combined"
, with default "degree"
.
NK.start
d.start
mu.start
sigma.start
rho.start
tauK.start
q.start
(i,k)
-th entry is the starting value for the binomial probability of the number of people that the i
-th individual knows from the k
-th subpopulation, with defaults of simple proportions based on the known subpopulation sizes and the Killworth estimates for unknown population sizes.
mu.prior
c(3,8)
.
sigma.prior
c(1/4,2)
.
rho.prior
c(0,1)
.
tauK.prior
c(1,1)
.
NK.tuning
d.tuning
rho.tuning
tauK.tuning
q.tuning
(i,k)
-th entry is the standard deviation of the normal MCMC transitions for the binomial probability of the number of people that the i
-th individual knows from the k
-th subpopulation, with defaults of 0.25 times the starting values.
iterations
burnin
nsum.mcmc
allows for the estimation of the various parameters from a random degree model based upon the Network Scale Up Method (NSUM) by producing Markov chain Monte Carlo (MCMC) samples from their posterior distributions. Options allow for the inclusion of barrier and transmission effects, both separately and combined, resulting in four models altogether. A large number of iterations may be required for accurate inference due to slow mixing, so the resulting chain can be thinned using the size
argument. It should be noted that subpopulation size estimation in the presence of transmission bias can be greatly improved when the priors for the multipliers tauK
are highly informative.
killworth.start
## 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))
## estimate unknown population size
dat.bar <- sim.bar$y
mcmc <- with(McCarty, nsum.mcmc(dat.bar, known, N, model="barrier", iterations=100,
burnin=50))
## view posterior distribution of subpopulation sizes for the first subpopulation
hist(mcmc$NK.values[1,])
## view posterior distribution of barrier effect parameters for the first subpopulation
hist(mcmc$rho.values[1,])
Run the code above in your browser using DataLab