Learn R Programming

epinet (version 2.1.11)

priorcontrol: Set prior distributions and hyperparameters for epinet MCMC algorithm

Description

Sets the prior distributions and corresponding hyperparameters to be used in the epinet MCMC algorithm.

Usage

priorcontrol(bprior, tiprior, teprior, etaprior, kiprior, keprior, 
	priordists = "gamma", betapriordist = priordists, thetaipriordist = priordists, 
	thetaepriordist = priordists, etapriordist = "normal", kipriordist = priordists, 
	kepriordist = priordists, parentprobmult = 1)

Value

A list with arguments as components.

Arguments

bprior

parameters for beta prior.

tiprior

parameters for thetai prior.

teprior

parameters for thetae prior.

etaprior

parameters for eta priors.

kiprior

parameters for ki prior.

keprior

parameters for ke prior.

priordists

can be “uniform” or “gamma”.

betapriordist

can be “uniform” or “gamma”.

thetaipriordist

can be “uniform” or “gamma”.

thetaepriordist

can be “uniform” or “gamma”.

etapriordist

prior distribution for the network parameters.

kipriordist

can be “uniform” or “gamma”.

kepriordist

can be “uniform” or “gamma”.

parentprobmult

multiplier for prior probability placed on suspected parent node. Default is a uniform prior assumption.

Author

Chris Groendyke cgroendyke@gmail.com

Details

Auxiliary function that can be used to set prior distributions and parameter values that control the MCMC algorithm used by epinet to produce posterior samples. This function is only used in conjunction with the epinet function.

The type of prior distribution (default is gamma / inverse gamma) can be specified for all epidemic parameters (i.e., all parameters except the eta network parameters) using priordists or for each parameter individually. Either uniform or gamma / inverse gamma priors can be chosen. (The two theta parameters use inverse gamma prior distributions, while the other epidemic parameters use gamma priors.)

The parameters of the epidemic parameter prior distributions are given as vectors of (two) hyper-parameters. If the uniform prior is being used for a parameter, then the hyper-parameters are the lower and upper limits of the distribution. If the gamma distribution is being used with parameters \(c\) and \(d\), then the prior mean is \(c \cdot d\) and the prior variance is \(c \cdot d^2\). If the inverse gamma distribution is being used with parameters \(c\) and \(d\), then the prior mean is \(\frac{d}{c-1}\) and the prior variance is \(\frac{d^2}{(c-1)^2 \cdot (c-2)}\).

For the network parameters (the eta parameters), the only prior assumption currently implemented is a set of independent normal distributions.

etaprior contains the hyper-parameters for the prior distributions of the eta parameters. This is a vector of \(2k\) values, giving the mean and standard deviation of each distribution (i.e., the first two entries are the mean and standard deviation of the prior distribution for the first eta parameter, the next two entries are the mean and standard deviation of the prior distribution for the second eta parameter, etc.)

The default prior distribution for the parent of each node is uniform on all of the other nodes. To specify a non-uniform distribution, use column 2 of epidata and set parentpriormult to an integer multiplier greater than 1.

References

Groendyke, C. and Welch, D. 2018. epinet: An R Package to Analyze Epidemics Spread across Contact Networks, Journal of Statistical Software, 83-11.

See Also

epinet for generating posterior samples of the parameters and MCMCcontrol for specifying control parameters for the MCMC algorithm.

Examples

Run this code
# Simulate an epidemic through a network of 30
set.seed(3)
N <- 30
# Build dyadic covariate matrix (X)
# Have a single covariate for overall edge density; this is the Erdos-Renyi model
nodecov <- matrix(1:N, nrow = N)
dcm <- BuildX(nodecov)
# Simulate network and then simulate epidemic over network
examplenet <- SimulateDyadicLinearERGM(N, dyadiccovmat = dcm, eta = -1.8)
exampleepidemic <- SEIR.simulator(examplenet, N = 30, 
    beta = 0.3, ki = 2, thetai = 5, latencydist = "gamma")
# Set inputs for MCMC algorithm
mcmcinput <- MCMCcontrol(nsamp = 5000, thinning = 10, etapropsd = 0.2) 
priorcontrol <- priorcontrol(bprior = c(0, 1), tiprior = c(1, 3), teprior = c(1, 3), 
    etaprior = c(0, 10), kiprior = c(2, 8), keprior = c(2, 8), priordists = "uniform")
# Run MCMC algorithm on this epidemic
# Note: Not enough data or iterations for any real inference
examplemcmc <- epinet( ~ 1, exampleepidemic, dcm, mcmcinput, priorcontrol)

Run the code above in your browser using DataLab