MethComp {MethComp}R Documentation

Fit a model for method comparison studies using WinBUGS

Description

A model linking each of a number of methods of measurement linearly to the "true" value is set up in BUGS and run via the function bugs from the R2WinBUGS package.

Usage

MethComp( data,
        random = c("mi", "ir"),
          beta = TRUE,
      n.chains = 3,
        n.iter = 2000,
      n.burnin = n.iter/2,
        n.thin = ceiling((n.iter - n.burnin)/1000),
bugs.directory = options("bugs.directory")[[1]],
         debug = FALSE,
       clearWD = TRUE,
bugs.code.file = "qwzx.bug",
     code.only = FALSE,
           ... )
## S3 method for class 'MethComp':
summary(object, ...)
## S3 method for class 'MethComp':
print(x, across=TRUE, dec=3, ... )

Arguments

data Data frame with variables meth, item, repl and y. y represents a measurement on an item (typically patient or sample) by method meth, in replicate repl.
random Which random effects should be included in the model?. Enter NULL if none is desired.
beta Logical. Should a slope other than 1 be allowed? If FALSE the bias between methods will be assumed constant.
n.chains How many chains should be run by WinBUGS — passed on to WinBUGS.
n.iter How many total iterations — passed on to WinBUGS.
n.burnin How many of these should be burn-in — passed on to WinBUGS.
n.thin How many should samples — passed on to WinBUGS.
bugs.directory Where is WinBUGS (>=1.4) installed — passed on to WinBUGS. The default is to use a parameter from options(). If you use this routinely, this is most conveniently set in your .Rprofile.
debug Should WinBUGS remain open after running — passed on to WinBUGS.
clearWD Should the working directory be cleared for junk files after the running of WinBUGS — passed on to WinBUGS.
bugs.code.file Where should the bugs code go?
code.only Should MethComp just create a bugs code file and a set of inits?
... Additional arguments passed on to bugs.
object A MethComp object
x A MethComp object
across Should the summary of conversion formulae be printed with $α$, $β$ and prediction sd. across or down?
dec Number of decimals used for printing of the conversion formulae.

Details

The model set up for an observation $y_mir$ is:

y_mir = alpha_m + beta_m*(mu_i+b_ir+c_mi) + e_mir

where $b_{ir}$ is a random 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 alphas, betas 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 mus, but the linear functions linking methods are invariant. The identifiable conversion parameters are:

alpha_m|k=alpha_m-alpha_k beta_m/beta_k, beta_m|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 sd's, that is). Furthermore, the posterior of the point where the conversion lines intersects the identity as well as the prediction sd's between any pairs of methods are included.

Value

If code.only==FALSE, an object of class MethComp which is a list with three components. The object has attributes "random" giving which random effects was in the model, and methods, a character vector of method names. The components of the list are:

summary Matrix with a summary of the posterior of the variance components and the parameters linking the methods.
posterior Dataframe with the posterior samples of the interesting parameters.
org.summary Summary of the original parameters as monitored by WinBUGS.

If code.only==TRUE, a list containing the initial values generated.

Author(s)

Bendix Carstensen, Steno Diabetes Center, http://www.biostat.ku.dk/~bxc, Lyle Gurrin, University of Melbourne, http://www.epi.unimelb.edu.au/about/staff/gurrin-lyle.

References

B Carstensen: Comparing and predicting between several methods of measurement, Biostatistics, 5, pp 399-413, 2004

See Also

BA.plot

Examples

data( ox )
str( ox )
MethComp( ox, code.only=TRUE, bugs.code.file="ox-ex.bug", random=c("mi") )
shell( "type ox-ex.bug" ) # only works on windows

### These next lines only work if you properly name the path to WinBUGS
### What is written here is not necessarily correct on your machine.
library(R2WinBUGS)
# options( bugs.directory="c:/Program Files/WinBUGS14/" )
options( bugs.directory="c:/Stat/Bugs/WinBUGS14/")
ox.res <- MethComp( ox, random=c("mi"), n.iter=100 )
str( ox.res )
str( ox.res[[2]] )
print( ox.res )

[Package MethComp version 0.1.1 Index]