Description Usage Arguments Details Value Author(s) Examples
Creates a dataframe with columns meth
, item
, (repl
) and
y
.
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 | Meth( data=NULL,
meth="meth", item="item", repl=NULL, y="y",
print=!is.null(data), keep.vars=!is.null(data) )
## S3 method for class 'Meth'
summary( object, ... )
## S3 method for class 'Meth'
plot(x, which = NULL,
col.LoA = "blue", col.pt = "black", cex.name = 2,
var.range,
diff.range,
var.names = FALSE,
pch = 16,
cex = 0.7,
Transform,
... )
## S3 method for class 'Meth'
mean(x, na.rm=TRUE, simplify=TRUE, ... )
## S3 method for class 'Meth'
sort(x, ... )
## 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`, ... )
|
data |
A dataframe. |
meth |
Vector of methods, numeric, character or factor.
Can also be a number or character referring to a column in
|
item |
Vector of items, numeric, character or factor.
Can also be a number or character referring to a column in
|
repl |
Vector of replicate numbers, numeric, character or factor.
Can also be a number or character referring to a column in
|
y |
Vector of measurements. Can also be a character
or numerical vector pointing to columns in |
print |
Logical: Should a summary result be printed? |
keep.vars |
Logical. Should the remaining variables from the dataframe
|
object |
A |
x |
A |
which |
A vector of indices or names of methods to plot. If
|
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 both 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. |
pch |
Plot character for points. |
cex |
Plot charcter expansion for points. |
Transform |
Transformation used to the measurements prior to
plotting. Function or character, see
|
na.rm |
Logical. Should |
simplify |
Should a |
how |
Character. What sampling strategy should be used, one of
|
N |
How many observations should be sampled? |
_data |
A |
... |
Ignored by the |
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: summary
- tabulation, plot
- plotting and a couple of
analysis methods.
If there are replicates in the values of item
it is assumed
that those observations represent replicate measurements and different
replicate numbers are given to those.
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 and replicate numbers are kept. If
how=="item"
, items are sampled with replacement, and their
observations are included the sampled numner of times.
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 mean.Meth
returns a Meth
object where means have
been computed over replicates, and put in a variable mean.y
. If
simplify=TRUE
, a smaller Meth
object will be returned
with only one row per (meth,item), and the means in the variable
y
. This is useful if the definition of a particular measurement
method is the mean of a specified number of replicate measuements.
The functions mean.Meth
, median.Meth
, max.Meth
, and
min.Meth
behaves similarly, whereas sort.Meth
just sorts
the replicates within each (meth,item), and puts the results in a
variable sort.y
added Meth
object.
The subset.Meth
returns a subset of the Meth
rows. If a
subset of the methods is selected, the new meth
variable will
have levels equal to the actually present levels of meth
in the
new Meth
object. This is not the case if subsetting is done
using "[
".
Bendix Carstensen, bxc@steno.dk
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 | data(fat)
# Different ways of selecting columns and generating replicate numbers
Sub1 <- Meth(fat,meth=2,item=1,repl=3,y=4,print=TRUE)
Sub2 <- Meth(fat,2,1,3,4,print=TRUE)
Sub3 <- Meth(fat,meth="Obs",item="Id",repl="Rep",y="Sub",print=TRUE)
summary( Sub3 )
plot( Sub3 )
# Use observation in different columns as methods
data( CardOutput )
head( CardOutput )
sv <- Meth( CardOutput, y=c("Svo2","Scvo2") )
# Note that replicates are generated if a non-unique item-id is used
sv <- Meth( CardOutput, y=c("Svo2","Scvo2"), item="Age" )
str( sv )
# A summary is not created if the the first argument (data=) is not used:
sv <- Meth( y=CardOutput[,c("Svo2","Scvo2")], item=CardOutput$VO2 )
summary(sv)
# Sample items
ssv <- sample.Meth( sv, how="item", N=8 )
# 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( meth=dev, item=item, repl=d.ana-d.samp, y=y, print=TRUE ) )
hb2 <- with( subset(hba1c,type=="Cap"),
Meth( meth=dev, item=item, repl=d.ana-d.samp, y=y, print=TRUE ) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.