Certain columns are expected of the input data frame:
analyte Identifies a type of bead. Beads can be named after the substance that is recognized by the antibody that coats the bead, or they can be named by the protein that coats the bead.
This is also known as analyte or antigen in different contexts. To be retro-compatible, this column can also be named analyte
well_role Defines the role of a well. This should be from Standard, Unknown, .... Standard wells are used to generate standard curves, and concentrations of the substance in the Unknown well will be estimated
assay_id Identifies an assay, which is defined to be a collection of Standard and non-Standard wells. Measured fi from the Standard wells are used to create a set of standard curves, one of each bead type.
Based on the standard curves and the measured fi from the non-Standard wells, concentrations of the substance in the non-Standard wells will be estimated.
An assay can be a plate, if every plate has Standard wells; or it can be multiple plates run by one technician at one time, if there are only one set of Standard wells on these plates
dilution Standard samples are often prepared by starting with one sample and doing serial dilutions.
Unknown samples may be measured at several dilutions so that one of the dilutions may fall into the more reliable region of the standard curve
replicate Index of technical replicates for a sample. Typical values are 1 or 2. May be used in plotting. Optional
sample_id Identifies a non-Standard sample. One sample may be measured in replicates and/or in several dilutions. Should be defined meaningfully for Unknowns
If no formula is specified, we also expect
fi Fluorescence intensity
starting_conc Standard samples are often prepared by starting with one sample and doing serial dilutions. This column does not apply to non-Standard samples
expected_conc Standard sapmles have expected concentrations. If this column is present, the dilution and starting_conc are optional and will not be used. This column does not apply to non-Standard samples
The program processes each assay separately. For each assay, each bead_type is processed separately. First fit.drc() is called to fit dose-response curves using information from the Standard wells. A plot of the fitted curve is generated.
Then for each non-Standard sample, the number of dilutions is determined. For each dilution, log(fi) from replicate wells are averaged and used to compute the estimated concentration and the standard error of the estimate.
Bad fits can happen for three reasons. 1) An error occurs in drm. 2) Estimated variance for some curve parameter is negative. 3) A goodness of fit statistics is above a pre-set threshold.
When a bad fit happens, by default we plot the observed fi, not the fitted curve, and do not proceed to estimation of concentration.
However, when force.fit is set to TRUE, in the latter two cases of bad fits, we will proceed to plot the fitted curve and use it to estimate concentrations.
In the second case, the standard errors of the estimated concentrations are set to NA. In the third case, standard errors will be computed.
The default value for force.fit is set to FALSE to promote caution.
An important factor affecting the success of the fitting procedure is the choice of self start function. In addition to trying the default self start function in the most current drc package, we also try a self start function that
is based on four parameter log-logistic model, and the self start function in version 1.5.2 of the drc package.
Standard errors convey the uncertainty we have about estimated concentrations. Standard error profiles show the relationship between standard errors and estimated concentrations.
A sequence of hypothetical fi between the expected fi for the smallest and largest concentrations on the Standard curve are generated. The number of hypothetical fi is controlled by the variable grid.len.
For each hypothetical fi, the estimated concentration and associated standard error are compuated.
There are two sources of uncertainty in an estimated concentration. One part of the uncertainty, we call replication-sensitive, comes from the fact that the measured fi has measurement error in it. It can be reduced by doing
replicates of the non-Standard samples. The number of replicates used in computing standard error profile is controlled by the variable rep.se.profile.
The other part, we call replication-insensitive, comes from the fact that there are uncertainty about the Standard curve as well.
The total uncertainty is plotted in black, the replication-sensitive in red, and the replication-insensitive in blue.
The two parts of uncertainty add up to the total not on the standard error scale, but on the variance scale, which is the square of standard errors.
We choose to plot on the standard error scale because this scale is more comparable to the estimated concentration.
When unk.replicate is NULL (default), the program sets it to the number of replicates of the first non-Standard sample it encounters; if there is no non-Standard sample, it is set to 1. This value is only used in the computation of LOD. It does not affect se of unknown sample conc estimate.
When find.best.dilution is false, the estimated concentrations for all dilutions (after adjusting for dilutions) are returned; otherwise, the best dilution, determined as the dilution having the smallest standard error, is returned.
When plot is FALSE, no plot is made. When plot is TRUE, but plot.rep.profile is false, only fitted curves are plotted.
When auto.layout is TRUE, bcrm will choose a layout that makes sense for showing one analyte per page. For example, if plot.se.profile is TRUE, it will be 2x2.
When test.LOD is true, estimated concentration will be tested against the null hypothesis that it is not different from the extremem data points of the standard samples
The difference between Inf and NA for se: Inf is if the fi is outside certain ranges, NA is if the s.e. is bad for some reason.
find.LOD, return an attribute "LOD", that is the lowest and highest concentration detectable, defined in the sense that ...
plot.se.profile also leads to the return of an attribute "LOQ", that is the lowest and highest concentration at which percent cv is at 20
drm requires that weights are evaluated in the global env. drm.weights (drm.fit.R) is our answer to that.