Package 'stansum'

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] , Derick S. Baum [aut], 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-0
Built: 2024-10-29 03:20:31 UTC
Source: https://github.com/coalesce-lab/stansum

Help Index


Datasets generated from ARD models

Description

Some artificial datasets simulated from various ARD models.

Usage

Fake_maltiel_RD

Format

Unless stated otherwise below all datasets are data frames with respondents in rows and subpopulations in columns.

Details

  • Fake_maltiel_RD is sampled from Maltiel et al (2015) Random Degree model assuming 1000 respondents and 3 subpopulations.

References

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 or get Stan model objects

Description

List Stan models available in this package or load them in the form of CmdStanModel objects as implemented in the cmdstanr package.

Usage

get_model(name, ...)

list_models()

Arguments

name

character; name of the model to load

...

arguments passed to instantiate::stan_package_model

Value

get_model returns an "CmdStanModel" object.

list_models returns a character vector of model names provided with the package.


Maltiel et al (2015) Barrier Effects Model

Description

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).

Usage

maltiel_bem_count(N, K, y, m, L, ...)

maltiel_bem_dichotomous(N, K, y, m, L, ...)

maltiel_bem_trichotomous(N, K, y, m, L, ...)

Arguments

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 cmdstanr::sample()

Details

Calling this function(s) will load the model object using get_model() and sample from the posterior using the cmdstanr::sample() method.

Value

Object of class cmdstanr::CmdStanMCMC containing the samples.

References

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

See Also

Use get_model() to return Stan model object of class cmdstanr::CmdStanModel without fitting it.

Other models in this package: maltiel_rdm, test_model(), zheng_bem, zheng_gp

Other models of Maltiel et al (2015): maltiel_rdm


Maltiel et al (2015) Random Degree Model

Description

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).

Usage

maltiel_rdm_count(N, K, y, m, L, ...)

maltiel_rd_dichotomous(N, K, y, m, L, ...)

Arguments

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 cmdstanr::sample()

Details

Calling this function(s) will load the model object using get_model() and sample from the posterior using the cmdstanr::sample() method.

Value

Object of class cmdstanr::CmdStanMCMC containing the samples.

References

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

See Also

Use get_model() to return Stan model object of class cmdstanr::CmdStanModel without fitting it.

Other models in this package: maltiel_bem, test_model(), zheng_bem, zheng_gp

Other models of Maltiel et al (2015): maltiel_bem


A simple Bernoulli model for testing purposes

Description

A test Bernoulli model taken from Stan documentation.

Usage

test_model(N, y, ...)

Arguments

N

integer; number of trials

y

integer; vector of Bernoulli outcomes

...

other arguments passed to cmdstanr::sample()

Details

Calling this function(s) will load the model object using get_model() and sample from the posterior using the cmdstanr::sample() method.

Value

Object of class cmdstanr::CmdStanMCMC containing the samples.

See Also

Use get_model() to return Stan model object of class cmdstanr::CmdStanModel without fitting it.

Other models in this package: maltiel_bem, maltiel_rdm, zheng_bem, zheng_gp


Zheng et al (2006) Barrier Effects Model

Description

Bayesian model for ARD...

  • zheng_bem_count – model for count responses

  • zheng_bem_dichotomous – model for dichotmous responses proposed by Baum & Marsden (2023).

  • zheng_bem_trichotomous – model for trichotomous responses proposed by Baum & Marsden (2023).

Usage

zheng_bem_count(N, K, y, ...)

zheng_bem_dichotomous(N, K, y, ...)

zheng_bem_trichotomous(N, K, y, ...)

Arguments

N

integer; sample size

K

integer; number of sub-populations

y

integer matrix; ARD

...

other arguments passed to cmdstanr::sample()

Details

Calling this function(s) will load the model object using get_model() and sample from the posterior using the cmdstanr::sample() method.

Value

Object of class cmdstanr::CmdStanMCMC containing the samples.

References

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

See Also

Use get_model() to return Stan model object of class cmdstanr::CmdStanModel without fitting it.

Other models in this package: maltiel_bem, maltiel_rdm, test_model(), zheng_gp

Other models of Zheng et al (2006): zheng_gp


Zheng et al (2006) Group Prevalence Model

Description

Bayesian model for ARD...

  • zheng_gp_count – model for count responses

  • zheng_gp_dichotomous – model for dichotmous responses proposed by Baum & Marsden (2023).

Usage

zheng_gp_count(N, K, y, ...)

zheng_gp_dichotomous(N, K, y, ...)

Arguments

N

integer; population size

K

integer; number of sub-populations

y

integer matrix; ARD

...

other arguments passed to cmdstanr::sample()

Details

Calling this function(s) will load the model object using get_model() and sample from the posterior using the cmdstanr::sample() method.

Value

Object of class cmdstanr::CmdStanMCMC containing the samples.

References

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

See Also

Use get_model() to return Stan model object of class cmdstanr::CmdStanModel without fitting it.

Other models in this package: maltiel_bem, maltiel_rdm, test_model(), zheng_bem

Other models of Zheng et al (2006): zheng_bem