ldr: Linear Dynamic Range (LDR)

View source: R/ldr.R

ldrR Documentation

Linear Dynamic Range (LDR)

Description

Take grouped tibble with x and y colnames, also rsq_min value. Return same tibble with each group truncated to the linear dynamic range.

Usage

ldr(
  dildata,
  x = "dil",
  y = "intb",
  rsq = 0.95,
  min_dils = 3,
  force_origin = FALSE
)

Arguments

x

name of independent variable, e.g. concentration or dilution

y

name of dependent variable, e.g. into or intb

rsq

minimum R^2 at which signal is considered linear

min_dils

minimum number of unique x values (dilutions) that must be present for a group

force_origin

Force regression through the origin? Set T for pre-blanked data, otherwise F.

Value

a named list: $y_max: maximum y for which R^2 >= rsq $n_dils: number of dilutions used in the linreg $rr: R^2 of the linreg # NTS: can put slope and intercept in here too, if need be

Examples

# use inside a dplyr::summarise() call
ldrs_roi <- areas_all %>%
  group_by(roi) %>%
  ldr(rsq = 0.95, min_dils = 4)


octopode/tidychrom documentation built on Nov. 2, 2022, 1:32 a.m.