B2ZM_SIR: Bayesian Two-Zone Models: using SIR sampler

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

B2ZM_SIR obtains random samples from the posterior distribution of the parameters and exposure concentrations for the Bayesian two-zone model proposed by Zhang et al. (2009) using Sampling Importance Resampling (SIR). The user can choose whether the near and far field measurement error processes are dependent or not. In the independent model, 5 parameters are considered: 1) Beta: Interzonal air flow rate (m3); 2) Q: supply and exhaust flow rate (m3/min); 3) G: contaminant emission rate (mg/min); 4) Tau_N: variance of the measurement error at the near field; 5)Tau_F; variance of the measurement error at the far field. In the dependent model (default), one more parameter is considered: 6) Tau_NF: covariance between the measurements at the near and far field. Any prior distribution for Beta, Q and G can be chosen. In the independent model, the prior distributions for Tau_N and Tau_F are inverse gamma distributions; in the dependent model, the prior joint distribution of Tau_N, Tau_NF and Tau_F is the Inverse Wishart Distribution (see the Details section for more information on the parameterization of these distributions). The output from B2ZM_SIR is a list that belongs to the class sir. This output is valid as an input for the functions summary and plot.

Usage

1
2
3
4
5
6
7
B2ZM_SIR(data, priorBeta, priorQ, priorG, 
        v, S, tauN.sh, tauN.sc,
        tauF.sh, tauF.sc,  VN,
        VF, indep.model = FALSE, 
        cred = 95,  m = 10000, 
        figures = list(save = FALSE, type =c("ps", 
        "eps","pdf", "png", "jpg"))) 

Arguments

data

A 3-column matrix where the columns are time, concentrations at the near field, and concentrations at the far field, respectively. The time must be scaled in minutes (min), and the concentrations must be scaled in miligrams per cubic meter (mg/m3)

priorBeta

A string defining the prior distribution for the parameter Beta. To declare the prior distribution of Beta, use standard R nomenclature for probability distributions. For example, if the prior of Beta is a Uniform(0,20), declare it with "unif(0,20)"; if it is a Normal(0,1), declare it with "norm(0,1)". DO NOT put an "d" or "r" in front the name of the distributions. The options are: "unif(a,b)", "gamma(a,b)", "exp(a)", "norm(a,b)", "t(a)", "weibull(a,b)", "f(a,b)", "chisq(a,b)", "cauchy(a,b)" and "lnorm(a,b)".

priorQ

A string defining the prior distribution for Q (use the nomenclature as for priorBeta).

priorG

A string defining the prior distribution for G (use the nomenclature as for priorBeta).

v

Degrees of freedom for the Inverse Wishart distribution (prior joint distribution for Tau_N, Tau_NF and Tau_F in the dependent model).

S

A 2x2 positive definite matrix for the Inverse Wishart (prior joint distribution for Tau_N, Tau_NF and Tau_F in the dependent model).

tauN.sh

The shape parameter in the inverse gamma distribution (prior distribution for Tau_N in the independent model).

tauN.sc

The scalar parameter in the inverse gamma distribution (prior distribution for Tau_N in the independent model).

tauF.sh

The shape parameter in the inverse gamma distribution (prior distribution for Tau_F in the independent model).

tauF.sc

The scalar parameter in the inverse gamma distribution (prior distribution for Tau_F in the independent model).

VN

Volume of the near field in cubic meters (m3).

VF

Volume of the far field in cubic meters (m3).

indep.model

A logical value indicating whether the independent model should be considered. The default is FALSE.

cred

A scalar between 0 and 100 indicating the credibility level for the posterior intervals of the parameters.

m

Number of samplings. The default is 10,000.

figures

The command plot(obj) produces several plots, where obj is the output from B2ZM_SIR. Using figures, those plots are built internally and saved as eps, pdf, ps, png or jpg format. figures is a list containing the following parameters:

save:

a logical value indicating that the figures are to be saved. The default is FALSE.

type:

a string that indicates the image file type. The default is "ps".

Details

Parameterization priors: The inverse gamma distribution with shape a and scale b has mean b/(a-1) (a>1) and variance (b^2)/((a-1)^2(a-2)) (a>2). The inverse Wishart with v degrees of freedom and scalar matrix S has mean S/(v-p-1), where p is the number of rows of S.

Value

B2ZM_SIR returns a list that belongs to the class sir. The output from B2ZM_SIR contains the objects:

Beta

a vector containing the sampled values from the joint posterior distribution for the parameter Beta.

Q

a vector containing the sampled values from the joint posterior distribution for the parameter Q.

G

a vector containing the sampled values from the joint posterior distribution for the parameter G.

tauN

a vector containing the sampled values from the joint posterior distribution for the parameter Tau_N.

tauF

a vector containing the sampled values from the joint posterior distribution for the parameter Tau_F.

tauNF

a vector containing the sampled values from the joint posterior distribution for the parameter Tau_NF (if the dependent model is used).

Y

a matrix containing the log of the observed concentrations.

DIC

deviance information criterion.

pD

effective number of parameters.

Dbar

Deviance expectation.

ESS

effective sample size.

indep

a logical value indicating whether the independent model was used.

times

a vector containing the times when the observed concentrations were measured.

cred

credibility of the posterior intervals.

prop

proportion of different points in the sampled values from the joint posterior distribution.

weigths

weights used in the SIR method.

maxw

maximum weight used in the SIR method.

Methods defined for B2ZM_SIR object are summary and plot.

Note

In the Examples section, m is small just for a quick demonstration. We suggest that m be greater than 15,000.

Author(s)

Joao Vitor Dias Monteiro, Sudipto Banerjee and Gurumurthy Ramachandran.

References

Monteiro, J. V. D., Banerjee, S. and Ramachandran, G. (2011). B2Z: An R Package for Bayesian Two-Zone Models. Journal of Statistical Software 43 (2) 1–23. http://www.jstatsoft.org/v43/i02/

Zhang, Y., Banerjee, S., Yang,R., Lungu,C. and Ramachandran, G. (2009). Bayesian Modeling of Exposure and Airflow Using Two-Zone Models. The Annals of Occupational Hygiene, 53, 409-424. http://www.biostat.umn.edu/~sudiptob/ResearchPapers/ZBYLR.pdf

See Also

B2Z, B2ZM, B2ZM_BCLT, B2ZM_IMIS, B2ZM_MCMC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
##################
#Dependent Model#
################

#Data 1:  100 simulated concentrations during the times 
#between 0 and 4, using the parameters Beta = 5, Q = 13.8,
#G = 351.5, VN = pi*10^-3, VF = 3.8, Tau_N = 1, 
#Tau_NF = 0.5 and Tau_F = 0.64. 

data(ex1)

r <- B2ZM_SIR(data = ex1,  priorBeta = "unif(0,10)",   
     priorQ="unif(11,17)", priorG = "unif(281,482)", S = diag(10,2), 
     v = 4, VN = pi*10^-3, VF = 3.8, m = 100 )

#plot(r)
#summary(r)

#Saving figures with .png extension
## Not run: 
r <- B2ZM_SIR(data = ex1, priorBeta = "unif(0,10)",    
     priorQ = "unif(11,17)", priorG = "unif(281,482)", 
     S = diag(10,2), v = 4, VN = pi*10^-3, VF = 3.8, 
     m = 10000, figures = list(save = TRUE, type ="png"))

## End(Not run)


#####################
#Independent Model #
###################

#Data 2:  100 simulated concentrations during the times 
#between 0 and 4, using the parameters Beta = 5, Q = 13.8,
#G = 351.5, VN = pi*10^-3, VF = 3.8, Tau_N = 1, 
#Tau_NF = 0 and Tau_F = 0.64. 

## Not run: 
data(ex2)

r <- B2ZM_SIR(data = ex2, indep.model = TRUE, 
     priorBeta = "unif(0,10)", priorQ="unif(11,17)", 
     priorG = "unif(281,482)", tauN.sh = 5 , tauN.sc = 4 , 
     tauF.sh = 5, tauF.sc = 7 , VN = pi*10^-3, 
     VF = 3.8, m = 100)

plot(r)
summary(r)

## End(Not run)

B2Z documentation built on May 2, 2019, 6:33 a.m.