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 |
This function is a wrapper for the reshape2::melt() function and splits column of Day, Operator, and Replicate information into 3 separate columns.
assayMelt(assay.df, exp.name)
assayMelt(assay.df, exp.name)
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(). |
A melted data.frame
Emma Gail
assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1') head(assay.df.melted)
assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1') head(assay.df.melted)
The function calculates the mean, standard deviation and coefficient of variation for replicates of an immunoassay.
calcCvStats(assay.obj, cv.threshold = 20)
calcCvStats(assay.obj, cv.threshold = 20)
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) |
An object of the class ImmunoAssay with calculated CV stats in the cv.table
slot
Emma Gail
assay.obj <- importAssay(lognormAssay) assay.obj <- calcCvStats(assay.obj)
assay.obj <- importAssay(lognormAssay) assay.obj <- calcCvStats(assay.obj)
This function calculates the values needed for the output of the scp() data.frame
calcScpValues( assay.values, conf.level = 0.95, distrib = c("nonparametric", "normal"), transf.method = c("log10", "ln") )
calcScpValues( assay.values, conf.level = 0.95, distrib = c("nonparametric", "normal"), transf.method = c("log10", "ln") )
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. |
A data.frame cotaining the values: "mean", "sd", "distrib", "cp", "mean.conf.int1", "mean.conf.int2", "cp.conf.int1", "cp.conf.int2"
Emma Gail
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')
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')
This function produces a boxplot based on the variable chosen in order to visualize any analytical variability.
evalBoxplot(assay.obj, var = c("Day", "Operator"))
evalBoxplot(assay.obj, var = c("Day", "Operator"))
assay.obj |
An ImmunoAssay object imported by importAssay |
var |
Variable to examine in the plot. Either "Day" or "Operator". |
A boxplot as generated by ggplot2
Emma Gail
assay.obj <- importAssay(lognormAssay, exp.name = 'Experiment1') evalBoxplot(assay.obj,var='Day') #visualize days on boxplot
assay.obj <- importAssay(lognormAssay, exp.name = 'Experiment1') evalBoxplot(assay.obj,var='Day') #visualize days on boxplot
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".
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 )
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 )
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. |
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.
Emma Gail
assay.obj <- importAssay(lognormAssay, exp.name = 'Experiment1') assay.obj <- evalNorm(assay.obj, category = 'Experiment1', data.transf = TRUE, transf.method = 'log10')
assay.obj <- importAssay(lognormAssay, exp.name = 'Experiment1') assay.obj <- evalNorm(assay.obj, category = 'Experiment1', data.transf = TRUE, transf.method = 'log10')
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.
excludeOutliers( assay.df.melted, data.transf = FALSE, transf.method = c("log10", "ln") )
excludeOutliers( assay.df.melted, data.transf = FALSE, transf.method = c("log10", "ln") )
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'. |
A melted data.frame
Emma Gail
assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1') excludeOutliers(assay.df.melted, data.transf = TRUE, transf.method = 'log10')
assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1') excludeOutliers(assay.df.melted, data.transf = TRUE, transf.method = 'log10')
This stores the data that is used for screening cut point analysis.
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
Function to import assay information into an ImmunoAssay object for analysis.
importAssay(assay.df, exp.name = NULL)
importAssay(assay.df, exp.name = NULL)
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'. |
An object of the class ImmunoAssay
Emma Gail
assay.df <- importAssay(assay.df = lognormAssay)
assay.df <- importAssay(assay.df = lognormAssay)
This is a simulated dataset that using a lognormal distribution
data(lognormAssay)
data(lognormAssay)
An object of class data.frame
with 100 rows and 20 columns.
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.
mixedModel(assay.df.melted, var = c("Operator", "Day"))
mixedModel(assay.df.melted, var = c("Operator", "Day"))
assay.df.melted |
A data.frame produced by assayMelt() |
var |
Variable to look at. Either "Day" or "Operator". |
A data.frame with the following columns: "Parameter", "Estimate", "LowerCI", "UpperCI", "Tstat"
Emma Gail
Lidija Turkovic
assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1') mixedModel(assay.df.melted, var = 'Day')
assay.df.melted <- assayMelt(assay.df = lognormAssay, exp.name = 'Experiment1') mixedModel(assay.df.melted, var = 'Day')
This function will calculate the screening cut point from the melted assay.df
scp( assay.obj, category = NULL, distrib = c("normal", "nonparametric"), data.transf = FALSE, transf.method = c("log10", "ln"), rm.out = FALSE )
scp( assay.obj, category = NULL, distrib = c("normal", "nonparametric"), data.transf = FALSE, transf.method = c("log10", "ln"), rm.out = FALSE )
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? |
An object of the class ImmunoAssay
Emma Gail
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)
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)
This function creates a forest plot of the calculated screening cut points. The scp function must be called prior to this function.
scpForestPlot(assay.obj, ...)
scpForestPlot(assay.obj, ...)
assay.obj |
An ImmunoAssay object imported by importAssay |
... |
Additional arguments for forestplot() function |
A forestplot
Emma Gail
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)
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)