Meth {MethComp}R Documentation

Create a Meth object representing a method comparison study

Description

Creates a dataframe with columns meth, item, (repl) and y.

Usage

Meth( meth,
      item,
      repl,
         y,
       ...,
      print = FALSE)
## S3 method for class 'Meth':
summary( object, ... )
## S3 method for class 'Meth':
plot(
      x, y = NULL,
          col.LoA = "blue",
           col.pt = "black",
         cex.name = 2,
        var.range,
       diff.range,
        var.names = FALSE,
                      ... )
## S3 method for class 'Meth':
subset(x, ... )
## S3 method for class 'Meth':
sample( x,
                     how = "random",
                       N = if( how=="items" ) nlevels( x$item ) else nrow(x),
                     ... )
## S3 method for class 'Meth':
transform(`_data`, ... )

Arguments

meth Vector of methods, numeric, character or factor. May also be a dataframe. If this has columns, meth, item, (repl) and y, these are used.
item Vector of items. If meth is a dataframe, item is taken as the columns of the meth dataframe to use as vectors of meth, item, (repl) and y.
repl Vector of replicate numbers.
y Vector of measurements. If y is a numeric or character vector and length(y) > 1, it is assumed that the dataframe meth is in wide form, and the corresponding column names are taken as method names. In this case item can be omitted in which case items are just taken as the names If y is a list it is assumed (and checked) that the list elements are numerical vectors of the same lengt as the meth, item and repl vectors. For the plot method the argument is either a vector of indices or names of methods to plot.
print Logical: Should a summary result be printed?
object A Meth object.
x A Meth object.
col.LoA What color should be used for the limits of agreement.
col.pt What color should be used for the points.
cex.name Character expansion factor for plotting method names
var.range The range of the axes in the scatter plot and the x-axis in the Bland-Altman plot be?
diff.range The range of yaxis in the Bland-Altman plot. Defaults to a range as the x-axis, but centered around 0.
var.names If logical: should the individual panels be labelled with the variable names?. If character, then the values of the character will be used to label the methods.
how What sampling strategy should be used. Charater strion, one of "random", "linked" or "item". Only the first letter is significant. See details for explanation.
N How many observations should be sampled?
_data A Meth object.
... Ignored by the Meth and the summary and sample functions. In the plot function, parameters passed on the panel function plotting methods against each other, as well as those plotting differences against means.

Details

In order to perform analyses of method comparisons it is convenient to have a dataframe with classifying factors , meth, item, and possibly repl and the response variable y. This function creates such a dataframe, and gives it a class, Meth, for which there is a number of methods: tab - tabulation, plot - plotting and a couple of analysis methods (not fixed yet).

sample.Meth samples a Meth object with replacement. If how=="random", a random sample of the rows are sampled, the existing values of meth, item and y are kept but new replicate numbers are generated. If how=="linked", a random sample of the linked observations (i.e. observations with identical item and repl values) are sampled with replacement.

Value

The Meth function returns a Meth object which is a dataframe with columns meth, item, (repl) and y. summary.Meth returns a table classified by method and no. of replicate measurements, extended with columns of the total number of items, total number of observations and the range of the measurements. The subset returns a subset of the Meth object with complete interformtion a sample of the items. sample

Author(s)

Bendix Carstensen, bxc@steno.dk

Examples

data(fat)
# Different ways of selecting columns and generating replicate numbers
Sub1 <- Meth(fat,c(2,1,3,4),print=TRUE)
Sub2 <- Meth(fat,c(2,1,NA,4),print=TRUE)
Sub3 <- Meth(fat,c(2,1,4),print=TRUE)
summary( Sub3 )
plot( Sub3 )
# More than two methods
data( sbp )
plot( Meth( sbp ) )
# Creating non-unique replicate numbers per (meth,item) creates a warning:
data( hba1c )
hb1  <- with(        hba1c,              Meth( dev, item, d.ana-d.samp, y, print=TRUE ) )
hb2  <- with( subset(hba1c,type=="Cap"), Meth( dev, item, d.ana-d.samp, y, print=TRUE ) )
summary( hb1 )
summary( hb2 )
  

[Package MethComp version 0.7.1 Index]