Package 'rADA'

Title: Statistical Analysis and Cut-Point Determination of Immunoassays
Description: Systematically transform immunoassay data, evaluate if the data is normally distributed, and pick the right method for cut point determination based on that evaluation. This package can also produce plots that are needed for reports, so data analysis and visualization can be done easily.
Authors: Emma Gail [cre, aut], Lidija Turkovic [aut], Anil Dolgun [ctb], Monther Alhamdoosh [ctb], Milica Ng [ctb]
Maintainer: Emma Gail <[email protected]>
License: GPL-3
Version: 1.1.9
Built: 2024-12-12 07:10:22 UTC
Source: CRAN

Help Index


Melt Assay Dataset

Description

This function is a wrapper for the reshape2::melt() function and splits column of Day, Operator, and Replicate information into 3 separate columns.

Usage

assayMelt(assay.df, exp.name)

Arguments

assay.df

Imported data.frame consisting of the following columns: 'ID','Lot', and columns identifying the Day, Operator and Replicate like so: 'D1_Op2_3' to indicate Day 1, operator 2, replicate 3.

exp.name

Experiment name (as a string). To be used to distinguish between experiments for when melted assays are combined using rbind().

Value

A melted data.frame

Author(s)

Emma Gail

Examples

assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1')
head(assay.df.melted)

Calculate Coefficient of Variation

Description

The function calculates the mean, standard deviation and coefficient of variation for replicates of an immunoassay.

Usage

calcCvStats(assay.obj, cv.threshold = 20)

Arguments

assay.obj

An ImmunoAssay object imported by importAssay

cv.threshold

Threshold for re-calculation of means and standard deviation based on coefficient of variation. The default threshold is 20 (i.e., 20% CV)

Value

An object of the class ImmunoAssay with calculated CV stats in the cv.table slot

Author(s)

Emma Gail

Examples

assay.obj <- importAssay(lognormAssay)
assay.obj <- calcCvStats(assay.obj)

Calculate screening cut point values for scp()

Description

This function calculates the values needed for the output of the scp() data.frame

Usage

calcScpValues(
  assay.values,
  conf.level = 0.95,
  distrib = c("nonparametric", "normal"),
  transf.method = c("log10", "ln")
)

Arguments

assay.values

List of selected values from the assay data.frame such as selected values from assayMelt()

conf.level

Decimal describing level of confidence to be used for confidence interval calculation. Defaults to 0.95

distrib

Distribution selection to determine the cut point calculation. Two options: 'nonparametric' or 'normal'

transf.method

Transformation method used. The inverse will be calculated as part of the output.

Value

A data.frame cotaining the values: "mean", "sd", "distrib", "cp", "mean.conf.int1", "mean.conf.int2", "cp.conf.int1", "cp.conf.int2"

Author(s)

Emma Gail

Examples

assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1')
assay.values <- assay.df.melted[assay.df.melted$DayOperator == 'D1Op1',]$value
#This function assumes that the data has already been transformed.
scp.df <- calcScpValues(assay.values = log10(assay.values), distrib = 'normal',
transf.method = 'log10')

Evaluate the Assays with Boxplots

Description

This function produces a boxplot based on the variable chosen in order to visualize any analytical variability.

Usage

evalBoxplot(assay.obj, var = c("Day", "Operator"))

Arguments

assay.obj

An ImmunoAssay object imported by importAssay

var

Variable to examine in the plot. Either "Day" or "Operator".

Value

A boxplot as generated by ggplot2

Author(s)

Emma Gail

Examples

assay.obj <- importAssay(lognormAssay, exp.name = 'Experiment1')
evalBoxplot(assay.obj,var='Day') #visualize days on boxplot

Normality Evaluation

Description

This function evaluates the normality of the melted immunoassay dataset. In order to determine whether or not the distribution is normal, two tests are performed: the Shapiro Wilk test for normality and the test for skewness. See shapiro.test and skewness for details. In order to for a "nonparametric" recommendation to be made, the SW test must be significant (below desire value) and the absolute value skewness must be above the desired value. If only one or neither of these conditions are met, then the recommendation will be "normal".

Usage

evalNorm(
  assay.obj,
  category = NULL,
  data.transf = FALSE,
  transf.method = c("log10", "ln"),
  excl.outliers = FALSE,
  hist = TRUE,
  p.val = 0.05,
  skew = 1,
  return.object = TRUE
)

Arguments

assay.obj

An ImmunoAssay object imported by importAssay

category

If assay.df.melted consists of more than 1 dataset, choose the category here to split dataset

data.transf

Should the data should be transformed before normality is evaluated

transf.method

If data.transf is TRUE, which method should be used. Can choose between 'log10' and 'ln'.

excl.outliers

Should outliers be excluded from this analysis? If TRUE, data points which lie beyond the extremes of the whiskers in boxplot will be excluded, see boxplot.stats for details.

hist

Should a histogram be outputted? TRUE/FALSE

p.val

Value to be used for cutoff for Shapiro-Wilks test. Defaults to 0.05.

skew

Value to be used to determine skewness. Defaults to 1.

return.object

If FALSE, only the plot is returned and the stats are returned as a list.

Value

If return.object==FALSE, only the plot is returned and the stats are returned as a list. Otherwise, an object of the class ImmunoAssay is returned.

Author(s)

Emma Gail

Examples

assay.obj <- importAssay(lognormAssay, exp.name = 'Experiment1')
assay.obj <- evalNorm(assay.obj, category = 'Experiment1',
data.transf = TRUE, transf.method = 'log10')

Exclude Outliers from Melted Assay Dataframe

Description

This function excludes outliers from the assay dataframe based on grDevices::boxplot.stats(). This outlier removal method is based on Tukey's test where outliers are removed if outside the established interquartile range.

Usage

excludeOutliers(
  assay.df.melted,
  data.transf = FALSE,
  transf.method = c("log10", "ln")
)

Arguments

assay.df.melted

A data.frame produced by assayMelt()

data.transf

Should the data should be transformed before normality is evaluated

transf.method

If data.transf is TRUE, which method should be used. Can choose between 'log10' and 'ln'.

Value

A melted data.frame

Author(s)

Emma Gail

Examples

assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1')
excludeOutliers(assay.df.melted, data.transf = TRUE, transf.method = 'log10')

Define ImmunoAssay class

Description

This stores the data that is used for screening cut point analysis.

Slots

data

Imported data as is, used for CV analysis

melted.data

Data used for most functions

exp.name

Experiment name

stats

List of statistics, results gathered from both coefficient of variation analysis as well as plot generation

outlier.rm

Has any outlier analysis been performed on this dataset?

outlier.rm.method

If outlier removal has been performed, what method was used?

scp.table

Table of cut point information

cv.table

Table derived from coefficient of variation analysis


Import assay as ImmunoAssay object

Description

Function to import assay information into an ImmunoAssay object for analysis.

Usage

importAssay(assay.df, exp.name = NULL)

Arguments

assay.df

Pathname to (.csv or .xlsx files accepted) or imported data.frame consisting of the following columns: 'ID','Lot', and columns identifying the Day, Operator and Replicate like so: 'D1_Op2_3' to indicate Day 1, operator 2, replicate 3.

exp.name

Experiment name. If stays NULL, will automatically name experiment as 'experiment1'.

Value

An object of the class ImmunoAssay

Author(s)

Emma Gail

Examples

assay.df <- importAssay(assay.df = lognormAssay)

Simulated Lognormal Dataset

Description

This is a simulated dataset that using a lognormal distribution

Usage

data(lognormAssay)

Format

An object of class data.frame with 100 rows and 20 columns.


Mixed model wrapper for assay dataframe

Description

This function is a wrapper for the lmer() function to produce a table of results. Here, the sample ID is included as a random intercept effect, then the results of the fixed effect model estimates are reported together with 95% confidence intervals and t statistics.

Usage

mixedModel(assay.df.melted, var = c("Operator", "Day"))

Arguments

assay.df.melted

A data.frame produced by assayMelt()

var

Variable to look at. Either "Day" or "Operator".

Value

A data.frame with the following columns: "Parameter", "Estimate", "LowerCI", "UpperCI", "Tstat"

Author(s)

Emma Gail

Lidija Turkovic

Examples

assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1')
mixedModel(assay.df.melted, var = 'Day')

Calculate screening cut point

Description

This function will calculate the screening cut point from the melted assay.df

Usage

scp(
  assay.obj,
  category = NULL,
  distrib = c("normal", "nonparametric"),
  data.transf = FALSE,
  transf.method = c("log10", "ln"),
  rm.out = FALSE
)

Arguments

assay.obj

An ImmunoAssay object imported by importAssay

category

If assay.obj consists of more than 1 dataset, choose the category here to split dataset

distrib

Distribution selection to determine the cut point calculation. Two options: 'nonparametric' or 'normal'

data.transf

Should the data should be transformed before the cut point is calculated

transf.method

If data.transf is TRUE, which method should be used. Can choose between 'log10' and 'ln'.

rm.out

Should outliers be excluded from this analysis?

Value

An object of the class ImmunoAssay

Author(s)

Emma Gail

Examples

assay.obj <- importAssay(assay.df = lognormAssay, exp.name = 'Experiment1')
assay.obj <- scp(assay.obj, category = 'Experiment1', distrib = 'normal',
data.transf = TRUE, transf.method = 'log10', rm.out = FALSE)

Generate forest plot of SCP values

Description

This function creates a forest plot of the calculated screening cut points. The scp function must be called prior to this function.

Usage

scpForestPlot(assay.obj, ...)

Arguments

assay.obj

An ImmunoAssay object imported by importAssay

...

Additional arguments for forestplot() function

Value

A forestplot

Author(s)

Emma Gail

Examples

assay.obj <- importAssay(assay.df = lognormAssay, exp.name = 'Experiment1')
assay.obj <- scp(assay.obj, category = 'Experiment1', distrib = 'normal',
data.transf = TRUE, transf.method = 'log10', rm.out = FALSE)
scpForestPlot(assay.obj)