| Title: | Bayesian Models for Aggregated Relational Data and Network Scale-Up Method |
|---|---|
| Description: | Interface to various precompiled Stan models for Aggregated Relational Data that estimate, among other things, network degrees. Includes models by Zheng et al (2006) <doi:10.1198/016214505000001168>, Maltiel et al (2015) <doi:10.1214/15-AOAS827>, Baum & Marsden (2023) <doi:10.1016/j.socnet.2023.02.001>. |
| Authors: | Michal Bojanowski [aut, cre] (ORCID: <https://orcid.org/0000-0001-7503-852X>), Derick S. Baum [aut] (ORCID: <https://orcid.org/0000-0001-7539-6749>), European Research Council [fnd] (Supported MB through grant 101020038 (PI Miranda Lubbers) <http://patchwork-erc.eu/en>) |
| Maintainer: | Michal Bojanowski <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.1 |
| Built: | 2026-10-10 15:32:40 UTC |
| Source: | https://github.com/coalesce-lab/stansum |
Some artificial datasets simulated from various ARD models.
Fake_maltiel_RDFake_maltiel_RD
Unless stated otherwise below all datasets are data frames with respondents in rows and subpopulations in columns.
Fake_maltiel_RD is sampled from Maltiel et al (2015) Random
Degree model assuming 1000 respondents and
3 subpopulations.
Maltiel, R., Raftery, A. E., McCormick, T. H., & Baraff, A. J. (2015). Estimating Population Size Using the Network Scale Up Method. The Annals of Applied Statistics, 9(3), 1247–1277. https://doi.org/10.1214/15-AOAS827
List Stan models available in this package or load them in the form of
CmdStanModel objects as implemented in the cmdstanr package.
get_model(name, ...) list_models()get_model(name, ...) list_models()
name |
character; name of the model to load |
... |
arguments passed to instantiate::stan_package_model |
get_model returns an "CmdStanModel" object.
list_models returns a character vector of model names provided
with the package.
Bayesian model for ARD including parameters capturing barrier effects.
maltiel_bem_count – model for count responses
maltiel_bem_dichotomous – model for dichotmous responses
proposed by Baum & Marsden (2023).
maltiel_bem_trichotomous – model for trichotomous responses
proposed by Baum & Marsden (2023).
maltiel_bem_count(N, K, y, m, L, ...) maltiel_bem_dichotomous(N, K, y, m, L, ...) maltiel_bem_trichotomous(N, K, y, m, L, ...)maltiel_bem_count(N, K, y, m, L, ...) maltiel_bem_dichotomous(N, K, y, m, L, ...) maltiel_bem_trichotomous(N, K, y, m, L, ...)
N |
integer; population size |
K |
integer; number of sub-populations |
y |
integer matrix; ARD |
m |
numeric; vector of fractional sizes of sub-populations |
L |
numeric; lower bound on degree |
... |
other arguments passed to |
Calling this function(s) will load the model object using
get_model() and sample from the posterior using the cmdstanr::sample()
method.
Object of class cmdstanr::CmdStanMCMC containing the samples.
Baum, D. S., & Marsden, P. V. (2023). Uses and limitations of dichotomous aggregate relational data. Social Networks, 74, 42–61. doi:10.1016/j.socnet.2023.02.001
Maltiel, R., Raftery, A. E., McCormick, T. H., & Baraff, A. J. (2015). Estimating Population Size Using the Network Scale Up Method. The Annals of Applied Statistics, 9(3), 1247–1277. doi:10.1214/15-AOAS827
Use get_model() to return Stan model object of class
cmdstanr::CmdStanModel without fitting it.
Other models in this package:
maltiel_cm,
maltiel_rdm,
maltiel_tbm,
test_model(),
zheng_bem,
zheng_gp
Other models of Maltiel et al (2015):
maltiel_cm,
maltiel_rdm,
maltiel_tbm
Bayesian model for ARD with both barrier effect and transmission bias parameters.
maltiel_cm_count – combined model for count responses, as
described in section 2.4 of Maltiel et al (2015). It carries both the
per-sub-population overdispersion rho_k of the barrier effects model and
the transmission bias tau_k of the transmission bias model:
y_ik ~ Binomial(d_i, tau_k * q_ik) with d_i ~ LogNormal(mu, sigma^2)
and q_ik ~ Beta(m_k, rho_k). Multiplying q_ik by tau_k breaks the
Beta-Binomial conjugacy, so – unlike maltiel_bem_count() – the latent
q_ik cannot be integrated out and are sampled together with the
remaining parameters. This adds N * K parameters, so fits are
substantially slower than for the component models.
maltiel_cm_count(N, K, y, m, L, eta, v, ...)maltiel_cm_count(N, K, y, m, L, eta, v, ...)
N |
integer; population size |
K |
integer; number of sub-populations |
y |
numeric matrix; ARD counts (N x K) |
m |
numeric vector; fractional sub-population sizes (length K) |
L |
numeric vector; lower bounds on individual degrees (length N).
Must satisfy |
eta |
numeric vector; Beta prior shape 1 for each transmission bias (length K) |
v |
numeric vector; Beta prior shape 2 for each transmission bias (length K) |
... |
other arguments passed to |
Calling this function(s) will load the model object using
get_model() and sample from the posterior using the cmdstanr::sample()
method.
The transmission biases tau_k and the degrees d_i are only
weakly identified from ARD alone: scaling tau_k down and the degrees up
leaves the reported counts largely unchanged. The eta / v prior on
tau is what resolves this, so an uninformative eta = v = 1 will
typically pull the posterior for tau below 1 and inflate the estimated
degrees. Supply an informative prior reflecting what is known about
transmission for each sub-population.
Object of class cmdstanr::CmdStanMCMC containing the samples.
Maltiel, R., Raftery, A. E., McCormick, T. H., & Baraff, A. J. (2015). Estimating Population Size Using the Network Scale Up Method. The Annals of Applied Statistics, 9(3), 1247–1277. doi:10.1214/15-AOAS827
Use get_model() to return Stan model object of class
cmdstanr::CmdStanModel without fitting it.
Other models in this package:
maltiel_bem,
maltiel_rdm,
maltiel_tbm,
test_model(),
zheng_bem,
zheng_gp
Other models of Maltiel et al (2015):
maltiel_bem,
maltiel_rdm,
maltiel_tbm
data("Fake_maltiel_RD", package = "stansum") y <- data.matrix(Fake_maltiel_RD)[1:50, ] K <- ncol(y) r <- maltiel_cm_count( N = nrow(y), K = K, y = y, m = rep(0.01, K), L = apply(y, 1, max), eta = rep(1, K), v = rep(1, K), chains = 1, iter_warmup = 200, iter_sampling = 10 )data("Fake_maltiel_RD", package = "stansum") y <- data.matrix(Fake_maltiel_RD)[1:50, ] K <- ncol(y) r <- maltiel_cm_count( N = nrow(y), K = K, y = y, m = rep(0.01, K), L = apply(y, 1, max), eta = rep(1, K), v = rep(1, K), chains = 1, iter_warmup = 200, iter_sampling = 10 )
Bayesian model for ARD with random degree parameters.
maltiel_rdm_count – model for count responses
maltiel_rdm_dichotomous – model for dichotmous responses
proposed by Baum & Marsden (2023).
maltiel_rdm_count(N, K, y, m, L, ...) maltiel_rd_dichotomous(N, K, y, m, L, ...)maltiel_rdm_count(N, K, y, m, L, ...) maltiel_rd_dichotomous(N, K, y, m, L, ...)
N |
integer; population size |
K |
integer; number of sub-populations |
y |
integer matrix; ARD |
m |
numeric; vector of fractional sizes of sub-populations |
L |
numeric; lower bound on degree |
... |
other arguments passed to |
Calling this function(s) will load the model object using
get_model() and sample from the posterior using the cmdstanr::sample()
method.
Object of class cmdstanr::CmdStanMCMC containing the samples.
Baum, D. S., & Marsden, P. V. (2023). Uses and limitations of dichotomous aggregate relational data. Social Networks, 74, 42–61. doi:10.1016/j.socnet.2023.02.001
Maltiel, R., Raftery, A. E., McCormick, T. H., & Baraff, A. J. (2015). Estimating Population Size Using the Network Scale Up Method. The Annals of Applied Statistics, 9(3), 1247–1277. doi:10.1214/15-AOAS827
Use get_model() to return Stan model object of class
cmdstanr::CmdStanModel without fitting it.
Other models in this package:
maltiel_bem,
maltiel_cm,
maltiel_tbm,
test_model(),
zheng_bem,
zheng_gp
Other models of Maltiel et al (2015):
maltiel_bem,
maltiel_cm,
maltiel_tbm
Bayesian model for ARD with transmission bias parameters.
maltiel_tbm_count – transmission bias model for count
responses. All tau_k are estimated from the data.
maltiel_tbm_count(N, K, y, m, L, eta, v, ...)maltiel_tbm_count(N, K, y, m, L, eta, v, ...)
N |
integer; population size |
K |
integer; number of sub-populations |
y |
numeric matrix; ARD counts (N x K) |
m |
numeric vector; fractional sub-population sizes (length K) |
L |
numeric vector; lower bounds on individual degrees (length N).
Must satisfy |
eta |
numeric vector; Beta prior shape 1 for each transmission bias (length K) |
v |
numeric vector; Beta prior shape 2 for each transmission bias (length K) |
... |
other arguments passed to |
Calling this function(s) will load the model object using
get_model() and sample from the posterior using the cmdstanr::sample()
method.
Object of class cmdstanr::CmdStanMCMC containing the samples.
Maltiel, R., Raftery, A. E., McCormick, T. H., & Baraff, A. J. (2015). Estimating Population Size Using the Network Scale Up Method. The Annals of Applied Statistics, 9(3), 1247–1277. doi:10.1214/15-AOAS827
Use get_model() to return Stan model object of class
cmdstanr::CmdStanModel without fitting it.
Other models in this package:
maltiel_bem,
maltiel_cm,
maltiel_rdm,
test_model(),
zheng_bem,
zheng_gp
Other models of Maltiel et al (2015):
maltiel_bem,
maltiel_cm,
maltiel_rdm
data("Fake_maltiel_RD", package = "stansum") K <- ncol(Fake_maltiel_RD) r <- maltiel_tbm_count( N = nrow(Fake_maltiel_RD), K = K, y = data.matrix(Fake_maltiel_RD), m = rep(0.01, K), L = apply(data.matrix(Fake_maltiel_RD), 1, max), eta = rep(1, K), v = rep(1, K), chains = 1, iter_warmup = 200, iter_sampling = 10 )data("Fake_maltiel_RD", package = "stansum") K <- ncol(Fake_maltiel_RD) r <- maltiel_tbm_count( N = nrow(Fake_maltiel_RD), K = K, y = data.matrix(Fake_maltiel_RD), m = rep(0.01, K), L = apply(data.matrix(Fake_maltiel_RD), 1, max), eta = rep(1, K), v = rep(1, K), chains = 1, iter_warmup = 200, iter_sampling = 10 )
A test Bernoulli model taken from Stan documentation.
test_model(N, y, ...)test_model(N, y, ...)
N |
integer; number of trials |
y |
integer; vector of Bernoulli outcomes |
... |
other arguments passed to |
Calling this function(s) will load the model object using
get_model() and sample from the posterior using the cmdstanr::sample()
method.
Object of class cmdstanr::CmdStanMCMC containing the samples.
Use get_model() to return Stan model object of class
cmdstanr::CmdStanModel without fitting it.
Other models in this package:
maltiel_bem,
maltiel_cm,
maltiel_rdm,
maltiel_tbm,
zheng_bem,
zheng_gp
Bayesian model for ARD...
zheng_bem_count – model for count responses
zheng_bem_count2 – model for count responses with different parametrization for omega and different priors
zheng_bem_dichotomous – model for dichotmous responses
proposed by Baum & Marsden (2023).
zheng_bem_trichotomous – model for trichotomous responses
proposed by Baum & Marsden (2023).
zheng_bem_count(N, K, y, ...) zheng_bem_count2(N, K, y, ...) zheng_bem_dichotomous(N, K, y, ...) zheng_bem_trichotomous(N, K, y, ...)zheng_bem_count(N, K, y, ...) zheng_bem_count2(N, K, y, ...) zheng_bem_dichotomous(N, K, y, ...) zheng_bem_trichotomous(N, K, y, ...)
N |
integer; sample size |
K |
integer; number of sub-populations |
y |
integer matrix; ARD |
... |
other arguments passed to |
Calling this function(s) will load the model object using
get_model() and sample from the posterior using the cmdstanr::sample()
method.
Object of class cmdstanr::CmdStanMCMC containing the samples.
Baum, D. S., & Marsden, P. V. (2023). Uses and limitations of dichotomous aggregate relational data. Social Networks, 74, 42–61. doi:10.1016/j.socnet.2023.02.001
Zheng, T., Salganik, M. J., & Gelman, A. (2006). How Many People Do You Know in Prison? Using Overdispersion in Count Data to Estimate Social Structure in Networks. Journal of the American Statistical Association, 101(474), 409–423. doi:10.1198/016214505000001168
Use get_model() to return Stan model object of class
cmdstanr::CmdStanModel without fitting it.
Other models in this package:
maltiel_bem,
maltiel_cm,
maltiel_rdm,
maltiel_tbm,
test_model(),
zheng_gp
Other models of Zheng et al (2006):
zheng_gp
Bayesian model for ARD...
zheng_gp_count – model for count responses
zheng_gp_dichotomous – model for dichotmous responses
proposed by Baum & Marsden (2023).
zheng_gp_count(N, K, y, ...) zheng_gp_dichotomous(N, K, y, ...)zheng_gp_count(N, K, y, ...) zheng_gp_dichotomous(N, K, y, ...)
N |
integer; population size |
K |
integer; number of sub-populations |
y |
integer matrix; ARD |
... |
other arguments passed to |
Calling this function(s) will load the model object using
get_model() and sample from the posterior using the cmdstanr::sample()
method.
Object of class cmdstanr::CmdStanMCMC containing the samples.
Baum, D. S., & Marsden, P. V. (2023). Uses and limitations of dichotomous aggregate relational data. Social Networks, 74, 42–61. doi:10.1016/j.socnet.2023.02.001
Zheng, T., Salganik, M. J., & Gelman, A. (2006). How Many People Do You Know in Prison? Using Overdispersion in Count Data to Estimate Social Structure in Networks. Journal of the American Statistical Association, 101(474), 409–423. doi:10.1198/016214505000001168
Use get_model() to return Stan model object of class
cmdstanr::CmdStanModel without fitting it.
Other models in this package:
maltiel_bem,
maltiel_cm,
maltiel_rdm,
maltiel_tbm,
test_model(),
zheng_bem
Other models of Zheng et al (2006):
zheng_bem