bugs
from the R2WinBUGS
package.
MCmcmc( data, bias = "linear", IxR = has.repl(data), linked = IxR, MxI = TRUE, matrix = MxI, varMxI = nlevels(factor(data$meth)) > 2, n.chains = 4, n.iter = 2000, n.burnin = n.iter/2, n.thin = ceiling((n.iter-n.burnin)/1000),
bugs.directory = getOption("bugs.directory"), debug = FALSE,
bugs.code.file = "model.txt", clearWD = TRUE, code.only = FALSE, ini.mult = 2, list.ini = TRUE, org = FALSE, program = "JAGS", Transform = NULL, trans.tol = 1e-6, ... )
"summary"( object, alpha=0.05, ...)
"print"( x, digits=3, alpha=0.05, ... )
"subset"( x, subset=NULL, allow.repl=FALSE, chains=NULL, ... )
"mcmc"( x, ... )
meth
, item
, repl
and y
, possibly a Meth
object.
y
represents a measurement on an item
(typically patient or sample) by method meth
, in replicate
repl
."none"
, "constant"
,
"linear"
and "proportional"
. Only the first three
letters are significant. Case insensitive.item
by repl
be included in the model.IxR
.meth
by item
effect be included
in the model?MxI
.bugs
.bugs
.bugs
.bugs
.bugs
. The default is to use a parameter from
options(). If you use this routinely, this is most conveniently set in
your .Rprofile
file.bugs
.bugs
.MCmcmc
just create a bugs code file and a set
of inits? See the list.ini
argument.TRUE
(the default), the function VC.est
will
be used to generate
initial values for the chains. list.ini
is a list of length
n.chains
. Each element of which is a list with the following
vectors as elements:
mu
alpha
beta
sigma.mi
sigma.ir
sigma.mi
sigma.res
If code.only==TRUE
, list.ini
indicates
whether a list of initial values is returned (invisibly) or not.
If code.only==FALSE
, list.ini==FALSE
is ignored.
TRUE
, the MCmcmc
object will have
an attribute, original
, with the posterior of the parameters
in the model actually simulated.BRugs
", "openbugs
",
"ob
" (openBUGS/BRugs), "winbugs
",
"wb
" (WinBUGS), "jags
" (JAGS). Case
insensitive. Defaults to "JAGS
" since: 1) JAGS
is available on all platforms and 2) JAGS seems to be
faster than BRugs on (some) windows machines.y
) before analysis.
See choose.trans
.bugs
.MCmcmc
objectMCmcmc
objectMCmcmc
object with
these numbers are selected. If character, each element of the
character vector is "grep"ed against the variable names, and
the matches are selected to the subset. If a list each element
is used in turn, numerical and character elements can be mixed.code.only==FALSE
, an object of class MCmcmc
which is
a mcmc.list
object of the relevant parameters, i.e. the
posteriors of the conversion parameters and the variance components transformed
to the scales of each of the methods.Furthermore, the object have the following attributes:
plot.MCmcmc
when plotting points.org=TRUE
, an mcmc.list
object
with the posterior of the original model parameters, i.e.
the variance components and the unidentifiable mean parameters.code.only==TRUE
, a list containing the initial values is
generated.
item
by repl
interaction (included if
"ir" %in% random
) and $c_mi$ is a random meth
by item
interaction (included if "mi" %in% random
). The $mu_i$'s are
parameters in the model but are not monitored --- only the $alpha$s,
$beta$s and the variances of $b_{ir}$,
$c_{mi}$ and $e_{mir}$ are monitored and
returned. The estimated parameters are only determined up to a linear
transformation of the $mu$s, but the linear functions linking
methods are invariant. The identifiable conversion parameters are:
$$\alpha_{m\cdot k}=\alpha_m - \alpha_k \beta_m/\beta_k, \quad
\beta_{m\cdot k}=\beta_m/\beta_k$$
The posteriors of these are derived and included in the posterior
, which
also will contain the posterior of the variance components (the SDs, that is).
Furthermore, the posterior of the point where the conversion lines intersects
the identity as well as the prediction SDs between any pairs of methods are
included. The function summary.MCmcmc
method gives estimates of the conversion
parameters that are consistent. Clearly,
$$\mathrm{median}(\beta_{1\cdot 2})=
1/\mathrm{median}(\beta_{2\cdot 1})$$
because the inverse is a monotone transformation, but there is no guarantee
that
$$\mathrm{median}(\alpha_{1\cdot 2})= \mathrm{median}(-\alpha_{2\cdot 1}/
\beta_{2\cdot 1})$$
and hence no guarantee that the parameters derived as posterior medians
produce conversion lines that are the same in both directions. Therefore,
summary.MCmcmc
computes the estimate for $alpha.2.1$ as
$$(\mathrm{median}(\alpha_{1\cdot 2})-\mathrm{median}(\alpha_{2\cdot 1})
/\mathrm{median}(\beta_{2\cdot 1}))/2$$
and the estimate of $alpha.1.2$ correspondingly. The
resulting parameter estimates defines the same lines.
BA.plot
,
plot.MCmcmc
,
print.MCmcmc
,
check.MCmcmc
data( ox )
str( ox )
ox <- Meth( ox )
# Writes the BUGS program to your console
MCmcmc( ox, MI=TRUE, IR=TRUE, code.only=TRUE, bugs.code.file="" )
### What is written here is not necessarily correct on your machine.
# ox.MC <- MCmcmc( ox, MI=TRUE, IR=TRUE, n.iter=100, program="JAGS" )
# ox.MC <- MCmcmc( ox, MI=TRUE, IR=TRUE, n.iter=100 )
# data( ox.MC )
# str( ox.MC )
# print( ox.MC )
Run the code above in your browser using DataLab