Learn R Programming

MethComp (version 1.30.2)

DA.reg: Make a regression of differences on averages

Description

For each pair of methods in data, a regression of the differences on the averages between methods is made and a linear relationship between methods with prediction standard deviations is derived.

Usage

DA.reg(
  data,
  Transform = NULL,
  trans.tol = 1e-06,
  print = TRUE,
  random.raters = FALSE,
  DA.slope = TRUE
)

Value

DA.reg returns a MethComp object, i.e. a list with three components, Conv, VarComp, and data. Conv is a three-dimensional array, with dimensions To, From (both with levels equal to the methods in data) and an unnamed dimension with levels "alpha", "beta", "sd.pred", "beta=1", referring to the linear relationship of To to From, "int(t-f)", "slope(t-f)", "sd(t-f)", referring to the regression of the differences on the averages, and "int(sd)", "slope(sd)", and "s.d.=K", referring to the regression of the absoulte residuals on the averages, and LoA-lo, LoA-hi, the limits of agreement.

Converting from method \(l\) to method \(k\) using $$y_{k|l}=\alpha+\beta y_l$$ with prediction standard deviation \(\sigma\), just requires the entries [k,l,c("alpha","beta","sd.pred")], if we assume the s.d. is constant.

The next entry is the p-values for the hypothesis \(\beta=1\), intercept and slope of the SD of the differences as a linear function of the average and finally p-value of the hypothesis that standard errors are constant over the range. The latter three are derived by regressing the absolute values of the residuals on the averages, and can be used to produce LoA where the s.d. increases (or decreases) by the mean, using the function DA2y.

The VarComp element of the list is NULL, and only present for compatibility with the print method for MethComp objects.

The data element is the input dataframe. The measurements in y

are left un-transformed, even if data are transformed (i.e. if the Transform attribute of the object is non-null).

DA2y returns a 2 by 3 matrix with rownames c("y1|2","y2|1")

and columnnames c("int","slope","sd"), calculated under the assumption that the differences were formed as D <- y1 - y2.

y2DA returns a 3-component vector with names c("DA-int","DA-slope","DA-sd"), referring to differences D=y1-y2 as a linear function of A=(y1+y2)/2.

Arguments

data

A Meth object. May also be a data frame with columns meth, item and y.

Transform

A character string, or a list of two functions, each other's inverse. The measurements are transformed by this before analysis. Possibilities are: "exp", "log", "logit", "pctlogit" (transforms percentages by the logit), "sqrt", "sq" (square), "cll" (complementary log-minus-log), "ll" (log-minus-log). For further details see choose.trans.

trans.tol

The tolerance used to check whether the supplied transformation and its inverse combine to the identity. Only used if Transform is a list of two functions.

print

Should the results be printed?

random.raters

If methods really are a random selection of raters, neither intercept nor slope different from 0 are sensible, so if this is TRUE, intercept and slope in the regression of difference on averages are fixed to 0. Meaning that we are essentially looking at the raw differences as residuals.

DA.slope

If this is TRUE, a slope of the differences in the verages is estimated, otherwise the relationship is assumed constant.

Author

Bendix Carstensen, Steno Diabetes Center, bendix.carstensen@regionh.dk, https://BendixCarstensen.com/MethComp/

Details

If the input object contains replicate measurements these are taken as separate items in the order they appear in the dataset.

References

B. Carstensen: Comparing methods of measurement: Extending the LoA by regression. Stat Med, 29:401-410, 2010.

Examples

Run this code

data( milk )
DA.reg( milk )
data( sbp )
print( DA.reg(sbp), digits=3 )
# Slope, intercept : y1 = 0.7 + 1.2*y2 (0.4)
A <- c(0.7,1.2,0.4)
( y2DA( A ) )
( DA2y( y2DA( A ) ) )

Run the code above in your browser using DataLab