Title: | Bayesian Semiparametric Models for Meta-Analysis |
---|---|
Description: | The main functions carry out Gibbs' sampler routines for nonparametric and semiparametric Bayesian models for random effects meta-analysis. |
Authors: | Deborah Burr |
Maintainer: | Deborah Burr <[email protected]> |
License: | GPL-2 |
Version: | 0.1-2 |
Built: | 2024-11-09 06:22:13 UTC |
Source: | CRAN |
Two functions carry out Gibbs' sampler routines to estimate the posterior distributions from either a non-parametric Bayesian model for random effects meta-analysis, or from a semi-parametric model. A group of three functions are used to compute Bayes factors to compare the two models. Three sample datasets are included. There are routines for graphing the posteriors and computing summary statistics.
Package: | bspmma |
Version: | 0.1-2 |
Date: | 2019-01-19 |
License: | GPL-2 |
LazyLoad: | yes |
Built: | R 2.9.2; ; 2012-07-13 19:04:37 UTC; unix |
Index:
bf.c Compute Bayes Factors for Comparing Values of the Dirichlet Precision Parameter in the Conditional Dirichlet Model bf.c.o Compute Bayes Factors for Conditional vs. Ordinary Dirichlet Models bf.o Compute Bayes Factors for Comparing Values of the Dirichlet Precision Parameter in the Ordinary Dirichlet Model bf1 Generate Chains for Computation of Bayes Factors bf2 Compute Constants for Multi-Chain Algorithm to Compute Bayes Factors breast.17 Aspirin and Breast Cancer: 17 studies bspmma-package bspmma: Bayesian Semiparametric Models for Meta-Analysis caprie.3grps CAPRIE Study: Three Risk Groups ddtm.s Decontamination of the Digestive Tract Mortality, Short Dataset describe.post Brief summary statistics of the posterior for convenient comparison of several models dirichlet.c Mixture of Conditional Dirichlet Model dirichlet.o Mixture of Ordinary Dirichlet Model draw.bf Plot Function for Bayes Factors draw.post Overlapping Plots of Posterior Distributions for Several Models print.dir.cond printing method for objects of class dir.cond print.dir.ord printing method for objects of class dir.ord
The main functions are explained in Burr (2012), and are
illustrated on the datasets breast.17
and ddtm.s
.
The function dirichlet.c
carries out the Markov chain Monte Carlo
(MCMC) algorithm to simulate data from the posterior distribution under
the conditional Dirichlet model described in Burr and Doss (2005).
The computation of Bayes factors is carried out in functions
bf1
, bf2
, bf.c
, bf.o
, and bf.c.o
,
which implement a multi-chain algorithm described in Doss (2012).
Deborah Burr
Maintainer: Deborah Burr <[email protected]>
Burr, Deborah (2012). “bspmma: An R package for Bayesian semi-parametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.
Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via Radon-Nikodym derivatives.” Statistica Sinica 22, 1–26.
This function carries out the final step in computing Bayes factors for
comparing a sequence of values of the Dirichlet precision parameter
for the conditional Dirichlet mixing model.
bf.c(df=-99, from=.4, incr=.1, to, cc, mat.list)
bf.c(df=-99, from=.4, incr=.1, to, cc, mat.list)
df |
degrees of freedom for the |
from |
is the starting value for the sequence of values of
the precision parameter |
incr |
is the amount by which to increment the values
of |
to |
is the ending value for the sequence of values
of |
cc |
is the vector of nine constants computed by |
mat.list |
list of nine matrices of MCMC output produced by
|
This function carries out the fourth and final step in the computation
of Bayes factors for the selection of in the conditional
Dirichlet mixing model. In the current version of the package, the
Bayes factors for
are computed relative to
the model with
. The sequence of steps implements a
multiple-chain version of Equation (2.6) of Burr (2012); the details
of the multiple-chain algorithm are given in Doss (2012).
Previous steps are two calls to
bf1
and a call to bf2
,
as illustrated in the Examples section and in Burr (2012).
A list with three named components, Mnew
, y
, and
yinfinity
, needed to produce the plot of Bayes factors via the
function draw.bf
. The vector Mnew
is the sequence of
(finite) values of . The vector
y
is the estimates of
the Bayes factors corresponding to the finite values of Mnew
,
and the object yinfinity
is the value of the Bayes factor for
at infinity, that is, for the parametric model.
Burr, Deborah (2012). “bspmma: An R package for Bayesian semiparametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.
Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via Radon-Nikodym derivatives.” Statistica Sinica 22, 1–26.
## Not run: ## CPU times are from runs of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. ## Preliminary steps data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object chain1.list <- bf1(breast.data) # 40.5 secs cc <- bf2(chain1.list) # 1.6 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf1(breast.data,seed=2) # 40.4 secs ## Compute and plot the Bayes factors breast.bfc <- bf.c(to=20, cc=cc, mat.list=chain2.list) draw.bf(breast.bfc) ## End(Not run)
## Not run: ## CPU times are from runs of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. ## Preliminary steps data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object chain1.list <- bf1(breast.data) # 40.5 secs cc <- bf2(chain1.list) # 1.6 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf1(breast.data,seed=2) # 40.4 secs ## Compute and plot the Bayes factors breast.bfc <- bf.c(to=20, cc=cc, mat.list=chain2.list) draw.bf(breast.bfc) ## End(Not run)
This function carries out the final step in computing Bayes factors for
comparing conditional and ordinary Dirichlet mixing models, for a
sequence of Dirichlet precision parameters .
bf.c.o(df=-99, from=.4, incr=.1, to, cc, mat.list)
bf.c.o(df=-99, from=.4, incr=.1, to, cc, mat.list)
df |
degrees of freedom for the |
cc |
is the vector of nine constants computed by |
from |
is the starting value for the sequence of values of
the precision parameter |
to |
is the ending value for the sequence of values
of |
incr |
is the amount by which to increment the values
of |
mat.list |
list of nine matrices of MCMC output produced by
|
This function carries out the fourth and final step in the computation
of Bayes factors for the conditional vs. ordinary Dirichlet mixing
models. It implements a multiple-chain version of Equation (2.7) of
Burr (2012); the details of the multiple-chain algorithm are given in
Doss (2012). Previous steps are two calls to bf1
and a call to
bf2
, as illustrated in the Examples section and in Burr (2012).
A list with two named components, Mnew
and y
. The
vector Mnew
is the sequence of (finite) values of .
The vector
y
is the estimates of the Bayes factors
corresponding to Mnew
.
Burr, Deborah (2012). “bspmma: An R package for Bayesian semiparametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.
Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via Radon-Nikodym derivatives.” Statistica Sinica22, 1–26.
## Not run: ## CPU times are from runs of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. ## Preliminary steps data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object chain1.list <- bf1(breast.data) # 40.5 secs cc <- bf2(chain1.list) # 1.6 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf1(breast.data,seed=2) # 40.4 secs ## OR load the chains and constants saved earlier load("breast-rdat-2lists-1000") load("breast-rdat-2lists-1000") ## Compute and plot the Bayes factors breast.bfco <- bf.c.o(to=20, cc=cc, mat.list=chain2.list) # 107 secs draw.bf(breast.bfco) ## End(Not run)
## Not run: ## CPU times are from runs of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. ## Preliminary steps data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object chain1.list <- bf1(breast.data) # 40.5 secs cc <- bf2(chain1.list) # 1.6 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf1(breast.data,seed=2) # 40.4 secs ## OR load the chains and constants saved earlier load("breast-rdat-2lists-1000") load("breast-rdat-2lists-1000") ## Compute and plot the Bayes factors breast.bfco <- bf.c.o(to=20, cc=cc, mat.list=chain2.list) # 107 secs draw.bf(breast.bfco) ## End(Not run)
This function carries out the final step in computing Bayes factors for
comparing a sequence of values of the Dirichlet precision parameter
for the ordinary Dirichlet mixing model.
bf.o(df=-99, from=.4, incr=.1, to, cc, mat.list)
bf.o(df=-99, from=.4, incr=.1, to, cc, mat.list)
df |
degrees of freedom for the |
from |
is the starting value for the sequence of values of
the precision parameter |
incr |
is the amount by which to increment the values
of |
to |
is the ending value for the sequence of values
of |
cc |
is the vector of nine constants computed by |
mat.list |
list of nine matrices of MCMC output produced by
|
This function carries out the fourth and final step in the computation
of Bayes factors for the selection of in the ordinary
Dirichlet mixing model. In the current version of the package, the
Bayes factors for
are computed relative to
the model with
. The sequence of steps implements a
multiple-chain version of Equation (2.7) of Burr (2012); the details
of the multiple-chain algorithm are given in Doss (2012).
Previous steps are calls to
bf1
, bf2
, and bf1
again, in that order, as illustrated in the Examples section and in
Burr (2012).
A list with three named components, Mnew
, y
, and
yinfinity
, needed to produce the plot of Bayes factors via the
function draw.bf
. The vector Mnew
is the sequence of
(finite) values of . The vector
y
is the estimates of
the Bayes factors corresponding to the finite values of Mnew
,
and the object yinfinity
is the value of the Bayes factor for
at infinity, that is, for the parametric model.
Burr, Deborah (2012). “bspmma: An R package for Bayesian semi-parametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.
Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via Radon-Nikodym derivatives.” Statistica Sinica 22, 1–26.
## Not run: ## CPU times are from runs of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. ## Preliminary steps data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object chain1.list <- bf1(breast.data) # 40.5 secs cc <- bf2(chain1.list) # 1.6 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf1(breast.data,seed=2) # 40.4 secs ## Compute and plot the Bayes factors breast.bfo <- bf.o(to=20, cc=cc, mat.list=chain2.list) #51 secs draw.bf(breast.bfo) ## End(Not run)
## Not run: ## CPU times are from runs of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. ## Preliminary steps data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object chain1.list <- bf1(breast.data) # 40.5 secs cc <- bf2(chain1.list) # 1.6 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf1(breast.data,seed=2) # 40.4 secs ## Compute and plot the Bayes factors breast.bfo <- bf.o(to=20, cc=cc, mat.list=chain2.list) #51 secs draw.bf(breast.bfo) ## End(Not run)
Generate nine matrices of MCMC output under the ordinary Dirichlet
model, for nine fixed values of the precision parameter .
This MCMC output is needed for computing Bayes factors.
bf1(data,seed=1,ncycles=2000,d=c(.1,.1,0,1000),K=10,burnin=1000)
bf1(data,seed=1,ncycles=2000,d=c(.1,.1,0,1000),K=10,burnin=1000)
data |
is a two-column matrix with a row for each study in the meta-analysis. The first column is the log of estimate of relative risk, often a log(odds ratio). The second column is the true or estimated standard error of the log(odds ratio). |
seed |
is the value of the seed for starting the random number
generator, which will be used before each of the nine calls to the
function |
ncycles |
is the number of cycles of the Markov chain. |
d |
is a vector of length four with the values of the
hyperparameters, in order, the location and scale of the Gamma
inverse prior, mean and variance multiplier for the normal prior
on |
K |
is the number of summands to include when one uses
Sethuraman's (1994) representation for getting the parameter
|
burnin |
is the number of Markov chain cycles to drop. |
Doss (2012) describes a method for estimating Bayes
factors for many values in a Dirichlet mixing model;
the method requires judicious selection of multiple hyperparameter
points at which to estimate the posterior distribution by MCMC under
the ordinary Dirichlet model. The function
bf1
is used for
estimating Bayes factors for conditional vs.\ ordinary Dirichlet
models, and for comparing values of in the conditional
model or in the ordinary model, for a range of the precision parameter
which cover the range of values of interest in most
practical problems. The function
bf1
generates the MCMC
output for a hard-wired selection of hyperparameters which work
well to give low-variance estimates of Bayes factors of interest
in practice. Chains are generated for nine values of the Dirichlet
precision parameter :
,
and
.
The rest of the Dirichlet model is specified by the parameters of the
normal/inverse Gamma prior, which by default are
.
List with nine matrix components. Each matrix has
rows and
columns, where
ncycles
burnin
,
(number of studies)
for the row label,
the individual study parameter values, and the three overall
parameters,
,
, and
.
Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via Radon-Nikodym derivatives.” Statistica Sinica, 22, 1–26.
Sethuraman, J. (1994). “A constructive definition of Dirichlet priors.” Statistica Sinica 4, 639–650.
## Not run: ## Set up the data. data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object ## Default values ncycles=2000, burnin=1000, seed=1 ## CPU time is given from a run of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux chain1.list <- bf1(breast.data) # 40.5 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf2(breast.data, seed=2) # 40.4 secs ## Perhaps save for another time. save(chain1.list,chain2.list,file="breast-rdat-2lists-1000",compress=TRUE) ## later session load("breast-rdat-2lists-1000") ## End(Not run)
## Not run: ## Set up the data. data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object ## Default values ncycles=2000, burnin=1000, seed=1 ## CPU time is given from a run of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux chain1.list <- bf1(breast.data) # 40.5 secs ## Next get a second set of 9 chains, with a different seed chain2.list <- bf2(breast.data, seed=2) # 40.4 secs ## Perhaps save for another time. save(chain1.list,chain2.list,file="breast-rdat-2lists-1000",compress=TRUE) ## later session load("breast-rdat-2lists-1000") ## End(Not run)
This function computes nine constants needed in the multi-chain
algorithm for Bayes factors comparing conditional and ordinary
Dirichlet mixing models, and for Bayes factors comparing Dirichlet
precision parameter () values for the conditional model,
or for the ordinary model.
bf2(chain.list)
bf2(chain.list)
chain.list |
is a list of nine matrices of MCMC output produced by function bf1 |
This function computes the constants needed for the denominator of the left-side of Eqn. (2.5) of Doss (2012). This is the step in which Radon-Nikodym derivatives are evaluated for each line of MCMC output and then averaged to estimate the constants. The actual algorithm is a little more complicated than that to make use of output from multiple chains. Nine constants are computed in this way.
A vector of nine constants which is needed in the next step of the computation of the Bayes factors. Burr (2012) gives detailed explanations of the algorithm and illustrates the steps in the algorithm.
Burr, Deborah (2012). “bspmma: An R package for Bayesian semi-parametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.
Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via Radon-Nikodym derivatives.” Statistica Sinica, 22, 1–26.
## Not run: ## Get the two sets of chains saved from runs of bf1 from ## the breast cancer example in the help file for bf1. load("breast-rdat-2lists-1000") ## Default values ncycles=2000, burnin=1000 ## CPU time is from a run of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. cc <- bf2(chain1.list) #1.6 secs ## Perhaps save for another time. save(cc,file="breast-rdat-constants",compress=TRUE) ## Next session load("breast-rdat-constants") ## End(Not run)
## Not run: ## Get the two sets of chains saved from runs of bf1 from ## the breast cancer example in the help file for bf1. load("breast-rdat-2lists-1000") ## Default values ncycles=2000, burnin=1000 ## CPU time is from a run of the R command system.time() on an ## Intel $2.8$ GHz Q$9550$ running Linux. cc <- bf2(chain1.list) #1.6 secs ## Perhaps save for another time. save(cc,file="breast-rdat-constants",compress=TRUE) ## Next session load("breast-rdat-constants") ## End(Not run)
This dataset gives log odds of breast cancer for long-term aspirin users, and its standard error, derived from 17 cohort and case-control studies.
data(breast.17)
data(breast.17)
A data frame with seventeen rows, corresponding to the seventeen
papers. There are two columns: psi.hat (numeric, the log odds ratio),
and se.psi.hat (numeric, estimated SE of the log odds ratio).
The rownames
attribute gives the first author of the paper
and the citation number of the study in Harris et.\ al. (2005).
Harris, R., Beebe-Donk, J., Doss, H., and Burr, D. (2005). “Aspirin, ibuprofen, and other non-steroidal anti-inflammatory drugs in cancer prevention: A critical review of non-selective COX-2 blockade (Review).” Oncology Reports 13 559-583.
Gonzalez-Perez, A., Rodriguez, L., and Lopez-Ridaura, R. (2003). “Effects of non-steroidal anti-inflammatory drugs on cancer sites other than the colon and rectum: a meta-analysis.” BMC Cancer 3 28.
Khuder, S. and Mutgi, A. (2001). “Breast cancer and NSAID use: a meta-analysis.” British Journal of Cancer 84, 1188–1192.
From the CAPRIE study comparing clopidogrel versus Aspirin, this dataset gives risk ratios and their SEs separately for patients who had stroke, heart attack (myocardial infarction or MI), and peripheral arterial disease (PAD).
data(caprie.3grps)
data(caprie.3grps)
A data frame with three rows, corresponding to the three risk groups. There are three columns: study (character, for the risk groups), psi.hat (numeric, the log odds ratio, and se.psi.hat (numeric, estimated SE of the log odds ratio).
CAPRIE Steering Committee (1996), A randomized, blinded trial of clopidogrel versus aspirin in patients at risk of ischaemic events (CAPRIE), Lancet, 348, 1329–1339.
Burr and Doss (2005) state how the SEs for the log odds ratios for the three risk groups are obtained from data on p.\ 1334 of the CAPRIE article.
Burr, D. and Doss, H. (2005). A Bayesian semi-parametric model for random effects meta analysis. The Journal of the American Statistical Association,100, 242–251.
This dataset gives number of deaths and number of subjects in treatment vs. control groups in 14 studies from a meta-analysis of studies on antiobiotics to reduce infection in intensive-care units.
data(ddtm.s)
data(ddtm.s)
A data frame with fourteen rows, corresponding to fourteen different, unidentified studies. There are four columns: number of deaths in the treatment group, sample size in the treatment group, number of deaths in the control group, sample size in the control group.
Burr and Doss (2005) give the background for this dataset.
Selective Decontamination of the Digestive Tract Trialists' Collaborative Group (1993). “Meta-analysis of randomised controlled trials of selective decontamination of the digestive tract.” British Medical Journal 307 525–532.
Burr, D. and Doss, H. (2005). “A Bayesian semiparametric model for random-effects meta-analysis.” Journal of the American Statistical Association 100 242–251.
Compute, print posterior means and posterior P(odds ratio < 1) for the individual study parameters and hyperparameters of the model.
describe.post(mcout,burnin=1000)
describe.post(mcout,burnin=1000)
mcout |
is a list. Each item in the list is a matrix of MCMC
output, corresponding to different values of |
burnin |
is the number of initial chains to omit from the estimates. |
List with two named components, means.table and probs.table, returned invisibly.
## Not run: ## Set up the data. data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object ## Generate at least two chains, from models which are the same except ## for different \eqn{M} values. set.seed(1) # initialize the seed at 1 breast.c1 <- dirichlet.c(breast.data, ncycles=4000, M=5) breast.c2 <- dirichlet.c(breast.data,ncycles=4000, M=1000) ## Create list object. breast.c1c2 <- list("5"=breast.c1$chain, "1000"= breast.c2$chain) ## Decide on some number of initial runs to omit from the analysis. describe.post(breast.c1c2, burnin=100) ## End(Not run)
## Not run: ## Set up the data. data(breast.17) # the breast cancer dataset breast.data <- as.matrix(breast.17) # put data in matrix object ## Generate at least two chains, from models which are the same except ## for different \eqn{M} values. set.seed(1) # initialize the seed at 1 breast.c1 <- dirichlet.c(breast.data, ncycles=4000, M=5) breast.c2 <- dirichlet.c(breast.data,ncycles=4000, M=1000) ## Create list object. breast.c1c2 <- list("5"=breast.c1$chain, "1000"= breast.c2$chain) ## Decide on some number of initial runs to omit from the analysis. describe.post(breast.c1c2, burnin=100) ## End(Not run)
MCMC generation of posterior distributions for the
conditional Dirichlet mixing distribution model, using
-cycle Gibbs sampler
dirichlet.c(data, ncycles=10, M=1,d=c(.1,.1,0,1000), start=NULL)
dirichlet.c(data, ncycles=10, M=1,d=c(.1,.1,0,1000), start=NULL)
data |
is a two-column matrix with a row for each study in the meta-analysis. The first column is the log of estimate of relative risk, often a log(odds ratio). The second column is the true or estimated standard error of the log(odds ratio). |
ncycles |
is the number of cycles of the Markov chain. |
M |
is the precision parameter of the Dirichlet process prior. |
d |
is a vector of length four with the values of the
hyperparameters, in order, the location and scale of the Gamma
inverse prior, mean and variance multiplier for the normal prior
on |
start |
is an optional vector containing starting values for the
parameters, |
This function generates MCMC output for the posterior distribution for
the parameters
where
is the number of
studies in the meta-analysis,
and
,
in the conditional Dirichlet mixing model for random-effects
meta-analysis. Notation is taken from Burr (2012),
Model
.
The MCMC algorithm for estimating the posterior under this model is
given in Burr and Doss (2005). The chain is a
-cycle Gibbs sampler which cycles through
the vector of
's and the pair
,
, and
the main part of the computational burden is in the first part of the
cycle, the generation of the vector of
's.
If starting values are not specified via the argument start
,
the default values are used, which are based on the data. The study
estimates are the starting values for the ,
and the mean and standard deviation of the study estimates are the
starting values for
and
, respectively.
call |
the call that resulted in this object |
ncycles |
the number of cycles in the Markov chain |
M |
the value of the precision parameter for the conditional Dirichlet model |
prior |
the vector length four of hyperparameters |
chain |
A matrix with |
start.user |
logical, TRUE if the user supplied initial values of
the parameter vector, FALSE if input argument |
start |
vector of initial parameter values used in the MCMC algorithm, whether this was the default or was user-supplied |
Burr, Deborah (2012). “bspmma: An R package for Bayesian semi-parametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.
Burr, D. and Doss, H. (2005). “A Bayesian semiparametric model for random-effects meta-analysis.” Journal of the American Statistical Association 100 242–251.
Sethuraman, J. (1994). “A constructive definition of Dirichlet priors.” Statistica Sinica 4, 639–650.
## Not run: data(breast.17) # the dataset breast.data <- as.matrix(breast.17) # put data in matrix object set.seed(1) # initialize the seed at 1 for test purposes breast.c1 <- dirichlet.c(breast.data, ncycles=4000, M=5) breast.c2 <- dirichlet.c(breast.data,ncycles=4000, M=1000) ## End(Not run)
## Not run: data(breast.17) # the dataset breast.data <- as.matrix(breast.17) # put data in matrix object set.seed(1) # initialize the seed at 1 for test purposes breast.c1 <- dirichlet.c(breast.data, ncycles=4000, M=5) breast.c2 <- dirichlet.c(breast.data,ncycles=4000, M=1000) ## End(Not run)
MCMC generation of posterior distributions for the
usual (unconditional) Dirichlet mixing distribution model, using
an -cycle Gibbs sampler
dirichlet.o(data, ncycles=10, M=1,d=c(.1,.1,0,1000), start=NULL,K=100)
dirichlet.o(data, ncycles=10, M=1,d=c(.1,.1,0,1000), start=NULL,K=100)
data |
is a two-column matrix with a row for each study in the meta-analysis. The first column is the log of estimate of relative risk, often a log(odds ratio). The second column is the true or estimated standard error of the log(odds ratio). |
ncycles |
is the number of cycles of the Markov chain. |
M |
is the precision parameter of the Dirichlet process prior. |
d |
is a vector of length four with the values of the hyperparameters, in order, the location and scale of the Gamma inverse prior, mean and variance multiplier for the normal prior on mu. |
start |
is an optional vector containing starting values for the
parameters, |
K |
is the number of summands to include when one uses
Sethuraman's (1994) representation for getting the parameter
|
This function generates MCMC output for the posterior distribution for
the parameters where
is the number of
studies in the meta-analysis,
,
, and
in the ordinary Dirichlet mixing model for random-effects
meta-analysis. Notation is taken from Burr (2012),
Model
and
.
The MCMC algorithm for estimating the posterior under this model is
given in Burr and Doss (2005). The chain is a
-cycle Gibbs sampler which cycles through
the vector of
's and the triple
,
,
, and the main part of the computational burden is in the
first part of the cycle, the generation of the vector of
's.
call |
the call that resulted in this object |
ncycles |
the number of cycles in the Markov chain |
M |
the value of the precision parameter for the conditional Dirichlet model |
prior |
the vector length four of hyperparameters |
chain |
A matrix with |
start.user |
logical, TRUE if the user supplied initial values of
the parameter vector, FALSE if input argument |
start |
vector of initial parameter values, whether default or user-supplied |
Burr, Deborah (2012). “bspmma: An R package for Bayesian semi-parametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.
Burr, D. and Doss, H. (2005). “A Bayesian semiparametric model for random-effects meta-analysis.” Journal of the American Statistical Association 100 242–251.
Sethuraman, J. (1994). “A constructive definition of Dirichlet priors.” Statistica Sinica 4, 639–650.
## Not run: data(breast.17) # the dataset breast.data <- as.matrix(breast.17) # put data in matrix object set.seed(1) # initialize the seed at 1 diro <- dirichlet.o(breast.data, ncycles=4000, M=5) ## a short description of the model and Markov chain print(diro1) ## the last mcmc cycle diro$mcmc[4001,] ## End(Not run)
## Not run: data(breast.17) # the dataset breast.data <- as.matrix(breast.17) # put data in matrix object set.seed(1) # initialize the seed at 1 diro <- dirichlet.o(breast.data, ncycles=4000, M=5) ## a short description of the model and Markov chain print(diro1) ## the last mcmc cycle diro$mcmc[4001,] ## End(Not run)
This function plots the output from function bf.c.o.
draw.bf(obj,line.lwd=2, ...)
draw.bf(obj,line.lwd=2, ...)
obj |
is a list with two elements, the vectors x and y to be
plotted in a scatterplot, which are produced by function |
line.lwd |
graphical parameter; the relative thickness of the plotted line |
... |
additional graphical parameters for the overall plot |
Draw overlapping kernel density estimates of the posterior
distributions of the parameters of the conditional or ordinary
Dirichlet model, where the posteriors arise from different values
of the Dirichlet precision parameter .
draw.post(mcout,burnin=1000,ind.par=NULL,adjust=1,...)
draw.post(mcout,burnin=1000,ind.par=NULL,adjust=1,...)
mcout |
is a list. Each item in the list is a matrix of MCMC
output, corresponding to different values of |
burnin |
is the number of initial chains to omit from the
estimates, must be no larger than |
ind.par |
an integer vector, containing indices of which columns
of |
adjust |
is the bin width argument for the call to the R base package function density. |
... |
additional arguments to plot may be supplied. |
## Not run: ## Conditional Dirichlet model ## Set up the breast cancer dataset. data(breast.17) breast.data <- as.matrix(breast.17) # Data must be a matrix object. ## Generate at least two chains, from models which are the same except ## for different \eqn{M}{M} values. set.seed(1) # initialize the seed at 1 for test purposes breast.c1 <- dirichlet.c(breast.data, ncycles=4000, M=5) breast.c2 <- dirichlet.c(breast.data,ncycles=4000, M=1000) ## Create list object. breast.c1c2 <- list("5"=breast.c1$chain, "1000"= breast.c2$chain) ## Decide on some number of initial runs to omit from the analysis. draw.post(breast.c1c2, burnin=100) # plots for hyperparameters only ## End(Not run)
## Not run: ## Conditional Dirichlet model ## Set up the breast cancer dataset. data(breast.17) breast.data <- as.matrix(breast.17) # Data must be a matrix object. ## Generate at least two chains, from models which are the same except ## for different \eqn{M}{M} values. set.seed(1) # initialize the seed at 1 for test purposes breast.c1 <- dirichlet.c(breast.data, ncycles=4000, M=5) breast.c2 <- dirichlet.c(breast.data,ncycles=4000, M=1000) ## Create list object. breast.c1c2 <- list("5"=breast.c1$chain, "1000"= breast.c2$chain) ## Decide on some number of initial runs to omit from the analysis. draw.post(breast.c1c2, burnin=100) # plots for hyperparameters only ## End(Not run)
gives limited info
## S3 method for class 'dir.cond' print(x,digits=max(3,getOption("digits") -3),...)
## S3 method for class 'dir.cond' print(x,digits=max(3,getOption("digits") -3),...)
x |
object of class dir.cond |
digits |
positive integer, number of digits for printing |
... |
place holder |
gives limited info
## S3 method for class 'dir.ord' print(x,digits=max(3,getOption("digits") -3),...)
## S3 method for class 'dir.ord' print(x,digits=max(3,getOption("digits") -3),...)
x |
object of class dir.ord |
digits |
positive integer, number of digits for printing |
... |
place holder |