Learn R Programming

MethComp (version 1.30.2)

BA.est: Bias and variance components for a Bland-Altman plot.

Description

A variance component model is fitted to method comparison data with replicate measurements in each method by item stratum. The purpose is to simplify the construction of a correct Bland-Altman-plot when replicate measurements are available, and to give the REML-estimates of the relevant variance components.

Usage

BA.est(
  data,
  linked = TRUE,
  IxR = has.repl(data),
  MxI = has.repl(data),
  corMxI = FALSE,
  varMxI = TRUE,
  IxR.pr = FALSE,
  bias = TRUE,
  alpha = 0.05,
  Transform = NULL,
  trans.tol = 1e-06,
  random.raters = FALSE,
  lmecontrol = lmeControl(msMaxIter = 300),
  weightfunction = c("mean", "median")
)

Value

BA.est returns an object of class c("MethComp","BA.est"), a list with four elements Conv, VarComp, LoA, RepCoef; VC.est returns (invisibly!) a list with elements Bias, VarComp, Mu, RanEff. These list components are:

Conv

3-dimensional array with dimensions "To", "From" and unnamed. The first two dimensions have the methods compared as levels, the last one c("alpha","beta","sd.pred","LoA: lower","upper"). It represents the mean conversions between methods and the prediction standard deviation.

Where "To" and "From" take the same value the value of the "sd" component is \(\sqrt{2}\) times the residual variation for the method. If IxR.pr=TRUE the variation between replicates are included too, i.e. \(\sqrt{2(\sigma_m^2+\omega^2)} \) sqrt[2(sigma_m^2+omega^2)].

VarComp

A matrix of variance components (on the SD scale) with methods as rows and variance components "IxR", "MxI" and "res" as columns.

LoA

Four-column matrix with mean difference, lower and upper limit of agreement and prediction SD. Each row in the matrix represents a pair of methods.

RepCoef

Two-column matrix of repeatability SDs and repeatability coefficients. The SDs are the standard deviation of the difference between two measurements by the same method on the item under identical circumstances; the repeatability coefficient the numerical extent of the prediction interval for this difference, i.e. \(2\sqrt{2}\) times the sd.

Mu

Estimates of the item-specific parameters.

RanEff

Estimates of the random effects from the model (BLUPS). This is a (possibly empty) list with possible elements named MxI and IxR according to whether these random effects are in the model.

The returned object has an attribute, Transform with the transformation applied to data before analysis, and its inverse --- see choose.trans.

Arguments

data

A Meth object representing method comparison data with replicate measurements, i.e. with columns meth, item, repl and y.

linked

Logical. Are replicates linked within item across methods?

IxR

Logical. Should an item by repl interaction be included in the model. This is needed when the replicates are linked within item across methods, so it is just another name for the linked argument. If linked= is given, this is ignored.

MxI

Logical. Should the method by item interaction (matrix effect) be included in the model.

corMxI

Logical. Should the method by item interaction allow coorelated effects within item. Ignored if only two methods are compared.

varMxI

Logical. Should the method by item interaction have a variance that varies between methods. Ignored if only two methods are compared.

IxR.pr

Logical. Should the item by repl interaction variation be included in the prediction standard deviation?

bias

Logical. Should a systematic bias between methods be estimated? If FALSE no bias between methods are assumed, i.e. \(\alpha_m=0, m=1,\ldots M\).

alpha

Numerical. Significance level. By default the value 2 is used when computing prediction intervals, otherwise the \(1-\alpha/2\) t-quantile is used. The number of d.f. is taken as the number of units minus the number of items minus the number of methods minus 1 (\(I-M-1\)).

Transform

Transformation applied to data (y) before analysis. See check.trans for possible values.

trans.tol

Numerical. The tolerance used to check whether the supplied transformation and its inverse combine to the identity.

random.raters

Logical. Should methods/raters be considered as random. Defaults to FALSE which corresponds to a fixed effect of methods/raters.

lmecontrol

A list of control parameters passed on to lme.

weightfunction

Function to weigh variance components for random raters. Defaults to mean but can also be median.

Author

Bendix Carstensen

Details

The model fitted is: $$y=\alpha_m + \mu_i + c_{mi} + a_{ir} + e_{mir}, $$$$ \quad \mathrm{var}(c_{mi})=\tau_m^2, $$$$ \quad \mathrm{var}(a_{ir})=\omega^2, $$$$ \quad \mathrm{var}(e_{mir})=\sigma_m^2, $$$$ y=alpha_m + mu_i + c_mi + a_ir + e_ir, var(c_mi)=tau_m^2, var(a_ir)=omega^2, var(e_mir)=sigma_m^2$$ We can only fit separate variances for the \(\tau s\) if more than two methods are compared (i.e. nM > 2), hence varMxI is ignored when nM==2.

The function VC.est is the workhorse; BA.est just calls it. VC.est figures out which model to fit by lme, extracts results and returns estimates. VC.est is also used as part of the fitting algorithm in AltReg, where each iteration step requires fit of this model. The function VC.est is actually just a wrapper for the functions VC.est.fixed that handles the case with fixed methods (usually 2 or three) i.e. the classical method comparison problem, and VC.est.random that handles the situation where "methods" are merely a random sample of raters from some population of raters; and therefore are regarded as random.

References

Carstensen, Simpson & Gurrin: Statistical models for assessing agreement in method comparison studies with replicate measurements, The International Journal of Biostatistics: Vol. 4 : Iss. 1, Article 16. https://bepress.com.

See Also

BA.plot, perm.repl

Examples

Run this code

data( ox )
ox <- Meth( ox )
summary( ox )
BA.est( ox )
BA.est( ox, linked=FALSE )
BA.est( ox, linked=TRUE, Transform="pctlogit" )
if (FALSE) {
data( sbp )
BA.est( sbp )
BA.est( sbp, linked=FALSE )
# Check what you get from VC.est
str( VC.est( sbp ) )}

Run the code above in your browser using DataLab