dsizeprior: Prior distributions for the size of a hidden population

View source: R/dsizeprior.R

dsizepriorR Documentation

Prior distributions for the size of a hidden population

Description

dsizeprior computes the prior distribution of the population size of a hidden population. The prior is intended to be used in Bayesian inference for the population size based on data collected by Respondent Driven Sampling, but can be used with any Bayesian method to estimate population size.

Usage

dsizeprior(
  n,
  type = c("beta", "nbinom", "pln", "flat", "continuous", "supplied"),
  mean.prior.size = NULL,
  sd.prior.size = NULL,
  mode.prior.sample.proportion = NULL,
  median.prior.sample.proportion = NULL,
  median.prior.size = NULL,
  mode.prior.size = NULL,
  quartiles.prior.size = NULL,
  effective.prior.df = 1,
  alpha = NULL,
  beta = NULL,
  maxN = NULL,
  log = FALSE,
  maxbeta = 120,
  maxNmax = 2e+05,
  supplied = list(maxN = maxN),
  verbose = TRUE
)

Arguments

n

count; the sample size.

type

character; the type of parametric distribution to use for the prior on population size. The options are "beta" (for a Beta-type prior on the sample proportion (i.e. n/N), "nbinom" (Negative-Binomial), "pln" (Poisson-log-normal), "flat" (uniform), continuous (the continuous version of the Beta-type prior on the sample proportion). The last option is "supplied" which enables a numeric prior to be specified. See the argument supplied for the format of the information. The default type is beta.

mean.prior.size

scalar; A hyperparameter being the mean of the prior distribution on the population size.

sd.prior.size

scalar; A hyperparameter being the standard deviation of the prior distribution on the population size.

mode.prior.sample.proportion

scalar; A hyperparameter being the mode of the prior distribution on the sample proportion n/N.

median.prior.sample.proportion

scalar; A hyperparameter being the median of the prior distribution on the sample proportion n/N.

median.prior.size

scalar; A hyperparameter being the mode of the prior distribution on the population size.

mode.prior.size

scalar; A hyperparameter being the mode of the prior distribution on the population size.

quartiles.prior.size

vector of length 2; A pair of hyperparameters being the lower and upper quartiles of the prior distribution on the population size. For example,
quartiles.prior.size=c(1000,4000) corresponds to a prior where the lower quartile (25%) is 1000 and the upper (75%) is 4000.

effective.prior.df

scalar; A hyperparameter being the effective number of samples worth of information represented in the prior distribution on the population size. By default this is 1, but it can be greater (or less!) to allow for different levels of uncertainty.

alpha

scalar; A hyperparameter being the first parameter of the Beta prior model for the sample proportion. By default this is NULL, meaning that 1 is chosen. it can be any value at least 1 to allow for different levels of uncertainty.

beta

scalar; A hyperparameter being the second parameter of the Beta prior model for the sample proportion. By default this is NULL, meaning that 1 is chosen. it can be any value at least 1 to allow for different levels of uncertainty.

maxN

integer; maximum possible population size. By default this is determined from an upper quantile of the prior distribution.

log

logical; return the prior or the the logarithm of the prior.

maxbeta

integer; maximum beta in the prior for population size. By default this is determined to ensure numerical stability.

maxNmax

integer; maximum possible population size. By default this is determined to ensure numerical stability.

supplied

list; If the argument type="supplied" then this should be a list object, typically of class sspse. It is primarily used to pass the posterior sample from a separate size call for use as the prior to this call. Essentially, it must have two components named maxN and sample. maxN is the maximum population envisaged and sample is random sample from the prior distribution.

verbose

logical; if this is TRUE, the program will print out additional information, including goodness of fit statistics.

Value

dsizeprior returns a list consisting of the following elements:

x

vector; vector of degrees 1:N at which the prior PMF is computed.

lpriorm

vector; vector of probabilities corresponding to the values in x.

N

scalar; a starting value for the population size computed from the prior.

maxN

integer; maximum possible population size. By default this is determined from an upper quantile of the prior distribution.

mean.prior.size

scalar; A hyperparameter being the mean of the prior distribution on the population size.

mode.prior.size

scalar; A hyperparameter being the mode of the prior distribution on the population size.

effective.prior.df

scalar; A hyperparameter being the effective number of samples worth of information represented in the prior distribution on the population size. By default this is 1, but it can be greater (or less!) to allow for different levels of uncertainty.

mode.prior.sample.proportion

scalar; A hyperparameter being the mode of the prior distribution on the sample proportion n/N.

median.prior.size

scalar; A hyperparameter being the mode of the prior distribution on the population size.

beta

scalar; A hyperparameter being the second parameter of the Beta distribution that is a component of the prior distribution on the sample proportion n/N.

type

character; the type of parametric distribution to use for the prior on population size. The possible values are beta (for a Beta prior on the sample proportion (i.e. n/N), nbinom (Negative-Binomial), pln (Poisson-log-normal), flat (uniform), and continuous (the continuous version of the Beta prior on the sample proportion. The default is beta.

Details on priors

The best way to specify the prior is via the hyperparameter mode.prior.size which specifies the mode of the prior distribution on the population size. You can alternatively specify the hyperparameter median.prior.size which specifies the median of the prior distribution on the population size, or mode.prior.sample proportion which specifies the mode of the prior distribution on the proportion of the population size in the sample.

References

Gile, Krista J. (2008) Inference from Partially-Observed Network Data, Ph.D. Thesis, Department of Statistics, University of Washington.

Gile, Krista J. and Handcock, Mark S. (2010) Respondent-Driven Sampling: An Assessment of Current Methodology, Sociological Methodology 40, 285-327.

Gile, Krista J. and Handcock, Mark S. (2014) sspse: Estimating Hidden Population Size using Respondent Driven Sampling Data R package, Los Angeles, CA. Version 0.5, https://hpmrg.org/sspse/.

Handcock MS (2003). degreenet: Models for Skewed Count Distributions Relevant to Networks. Statnet Project, Seattle, WA. Version 1.2, https://statnet.org/.

Handcock, Mark S., Gile, Krista J. and Mar, Corinne M. (2014) Estimating Hidden Population Size using Respondent-Driven Sampling Data, Electronic Journal of Statistics, 8, 1, 1491-1521

Handcock, Mark S., Gile, Krista J. and Mar, Corinne M. (2015) Estimating the Size of Populations at High Risk for HIV using Respondent-Driven Sampling Data, Biometrics.

See Also

network, statnet, degreenet

Examples


prior <- dsizeprior(n=100,
                    type="beta",
                    mode.prior.size=1000)


sspse documentation built on Aug. 8, 2023, 9:07 a.m.