imputation_LOD: Imputation of LOD

View source: R/imputation-lod.R

imputation_LODR Documentation

Imputation of LOD

Description

Limit Of Detection (LOD) is the minimum detectable value. (blank signal + 3SD)

Usage

imputation_LOD(x, ...)

## Default S3 method:
imputation_LOD(
  x,
  lod = NULL,
  threshold = 0.0707,
  na.replace = TRUE,
  force.lod = TRUE,
  accuracy = 1,
  ...
)

## S3 method for class 'data.frame'
imputation_LOD(
  x,
  lod = NULL,
  threshold = 0.0707,
  na.replace = TRUE,
  force.lod = TRUE,
  accuracy = 1,
  remove.lod = 1/2,
  ...
)

Arguments

x

numeric vector to round

...

platzhalter

lod

Limit of detection if NULL lod = min - 3sd

threshold

default 1/sqrt(2) replace NA and x < lod by lod * threshold

na.replace

should NA be replaced by the lod * threshold

force.lod

should all values smaller than the LOD be replaced?

accuracy

significant digits for rounding

remove.lod

NULL or fraction

Details

Replace NA by LOD*threshold and round to the next order of magnitude

https://github.com/jranke/chemCal

Value

vector, data.frame

Examples


 x <-
c(.00049001,.0035648,.01,.0112,
  .023212548,.00541257,.004041257,.458,.500)
y <-
  c(43.01,49.156,678.00112458964,789.023212548,
    674.00049001,634.00541257,76.004041257,789.458,500
  )

data.frame(x = signif(x, 3), x.lod = imputation_LOD(x,  lod = .0035648))

data.frame(y = signif(y, 3), y.lod = imputation_LOD(y,  lod = 49.156))


#' #require(stp25tools)

DF <-
  data.frame(x=rnorm(10), y=rnorm(10), z=rnorm(10)) |>
  Label( x ="Asp", y ="Trp", z ="Leu")
DF[1,1] <- NA

# imputation_LOD(DF, lod =c(-.2, .2, .05), accuracy=3)
# imputation_LOD(DF, lod = c(-.2, .2, .05), accuracy = 3, na.replace =FALSE)
 #  Error in imputation_LOD.data.frame(DF, lod = c(-0.2, 0.2, 0.05), accuracy = 3) : 
 #  Negative LOD machen Physikalisch keinen Sinn.


stp4/stp25tools documentation built on Feb. 27, 2025, 11:14 p.m.