Package `pla`

Package ‘pla’
September 9, 2015
Type Package
Title Parallel Line Assays
Version 0.2
Date 2015-09-09
Author Jens Henrik Badsberg
Depends R (>= 3.1.0), methods
Maintainer Jens Henrik Badsberg <[email protected]>
Description Parallel Line Assays: Completely randomized design,
Randomized Block design, and Latin squares design.
Balanced data are fitted as described in the Ph.Eur.
In the presence of missing values complete data analysis can be
performed (with computation of Fieller's confidence intervals for
the estimated potency), or imputation of values can be applied.
The package contains a script such that a pdf-document with a
report of an analysis of an assay can be produced from an input file
with data of the assay. Here no knowledge of R is needed by the user.
License GPL (>= 2)
NeedsCompilation no
Repository CRAN
Date/Publication 2015-09-09 21:19:32
R topics documented:
pla-package . . . . .
AgarDiffusionAssay
assayModel-class . .
assayTable2frame . .
Corticotrophin . . . .
data2assayFrame . .
Diphteria . . . . . .
Erythromycin . . . .
Erythropoietin . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
5
6
8
10
11
13
14
15
2
pla-package
FactorIX . . . . .
Fiellers . . . . .
HeparinSodium .
HepatitisB . . . .
HepatitisBvaccine
HumanHepatitis .
IPV . . . . . . .
jitterSteps . . . .
Nystatin . . . . .
pheur325 . . . .
pla.fit . . . . . .
pla.plots . . . . .
plotSamples . . .
potency . . . . .
readAssayTable .
Turbidimetric . .
Vancomycin . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Index
pla-package
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
16
16
17
18
19
19
20
21
21
22
23
26
28
30
30
37
38
39
Parallel Line Assays
Description
Parallel Line Models:
Completely Randomized Design, Randomized Block Design, and Latin Squares Design.
Balanced data are fitted as described in the Ph.Eur.
In the presence of missing values complete data analysis can be performed (with computation of
Fieller’s confidence intervals for the estimated potency), or imputation of values can be applied.
The package contains a script such that a pdf-document with a report of an analysis of an assay can
be produced from an input file with data of the assay just by entering the name of the input-file. Here
no knowledge of R is needed by the user. This tool requires R and Tex (e.g. MikTex) to be installed.
The .BAT- and .csh-files for this is found in .../pla/scripts/ of your installed pla package.
You can of course modify the "skeleton" (.../pla/scripts/Skeleton/Skeleton-xtable.Rnw)
Sweave program of this script. You should not (only) place your data in .../pla/scripts/data,
but copy the content of the directory .../pla/scripts/ to some place not effected by updates of
R and the pla-package.
Details
Package:
Type:
Version:
Date:
License:
pla
Package
0.2
2015-09-09
GPL (>= 2)
pla-package
3
Contents:
• readAssayTable: Reads (.txt) files with responses of assays, entered as matrices with rows of
measurements by columns of factors and variables, or entered as tables (arrays) of responses.
The result has methods as.data.frame, as.array, and as.table. Many examples of input data are
found in the folder .../pla/vignettes/'Source'/data/.
– assayTable2frame: An array with the responses of an assay is transformed to a data.frame
for pla.fit and pla.plots.
– data2assayFrame: Check and prepare a data.frame for pla.fit and pla.plots.
• pla: Functions for defining and creating parallel line assay models. Imputation of missing
values is performed, as an option.
• pla.fit or fit on pla-model: Estimation in parallel line models, with listing of results.
– pheur325: Estimation of potency and confidence limits as described at page 480 in the
Ph.Eur.
• pla.plots or plot on pla-model: Make plots for parallel line models.
– plotSamples: One scatter plot for parallel line models.
– jitterSteps: Compute a perturbed version of the concentration-variable.
• Examples from Ph.Eur.:
– 5.1.1. Two-dose multiple assay with completely randomized design; An assay of corticotrophin by subcutaneous injection in rats: Corticotrophin
– 5.1.2. Three-dose latin square design; Antibiotic agar diffusion assay using a rectangular
tray: AgarDiffusionAssay.
– 5.1.3. Four-dose randomized block design; Antibiotic turbidimetric assay: Turbidimetric.
– 5.1.4. Five-dose multiple assay with completely randomized design; An in-vitro assay of
three hepatitis B vaccines against a standard: HepatitisB.
• From CombiStats - EDQM, Council of Europe http://combistats.edqm.eu:
– Example 1 - Three-dose parallel line assay; completely randomized; square transformation; explicit volume units; Diphteria,
– Example 2 - Three-dose parallel line assay; randomized block; explicit content notation;
Erythropoietin,
– Example 3 - Four-dose parallel line assay; completely randomized; logarithmic transformation; explicit ratio notation; FactorIX,
– Example 5 - Three-dose parallel line assay; completely randomized; custom transformation; explicit content notation; HeparinSodium,
– Example 7 - Five-dose parallel line assay; completely randomized; logarithmic transformation; explicit ratio notation; HepatitisBvaccine,
– Example 8 - Four-dose parallel line assay; completely randomized; square root transformation; explicit content notation; HumanHepatitis (Human Hepatitis A immunoglobulin),
– Example 10 - Four-dose parallel line assay; completely randomized; logarithmic transformation; explicit ratio notation; IPV (Inactivated Poliomyelitis Vaccine).
– Example 15 - Five-dose multiple assay; randomized block design; explicit ratio notation
Nystatin,
4
pla-package
– Example 22 - Three-dose parallel line assay at three independent occasions; randomized
block; symbolic notation; Erythromycin,
• Other example: Vancomycin.
The two main functions are pla.fit and pla.plots, which expects data in the format as returned by
assayTable2frame or data2assayFrame. But the function readAssayTable is also very useful.
One way to understand (and to reproduce) the structure of the expected input of pla.fit and pla.plots
is to look into data2assayFrame and AgarDiffusionAssay. The column names Response, Dilution,
Sample, Replicate, Row, and Column of the input for data2assayFrame cannot be changed. Row
and Column are used for "Latin squares".
Replicate is used for "blocks" and completely random designs.
pheur325 is designed to be called from pla.fit, and plotSamples is designed to be called from
pla.plots.
The input dataframe for pla.plots and pla.fit should be ordered by Sample and "DilutionStep".
The output listing is designed for "R CMD Sweave" and "pdflatex".
Acknowledgment: Thanks to CombiStats for permitting the presentation of the data of CombiStats
in this package. The statistical analyses of this data are also performed by the CombiStats program,
and the results can be found on http://combistats.edqm.eu/.
Author(s)
Jens Henrik Badsberg <[email protected]>
References
Ph.Eur.: Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014;
607–635 (475-504 in version 5.0, 2004).
Coward, Katrine Hope, Kassner, Elsie Woodward (1941): A Comparison between Interlitter and
Intralitter variation in rats with respect to the healing of rachitic bones by vitamin D. Pharmaceutical
Society, London.
Fieller, E.C.: The biological standardization of insulin. Supplement to the Journal of the Royal
Statistical Society. 1940; Vol. VII., No. 1.
Bliss, C.I. (1952): The Statistics of Bioassay - with special reference to the vitamin. Academic
Press, New York.
Arthur Linder, Genova, Switzerland (1964): Statistics of Bioassays, Notes on lectures held during
the spring semester (1964) at the Statistics Department, University of North Carolina, Chapel Hill,
N. C.
Finney, David J. (1978): Statistical Method in Biological Assay. Charles Griffin & Company Ltd.
Third Edition.
Examples
data(Corticotrophin); Data <- Corticotrophin
Design <- "crd"
Data <- readAssayTable(paste(system.file(package = "pla"),
AgarDiffusionAssay
5
"vignettes/PhEur/data/Corticotrophin.txt",
sep = "/"))
Frame <- as.data.frame(Data)
fits <- pla.fit(Frame, design = Design, sampleLabels = c("S", "T", "U"),
dr = 4, returnPotencyEstimates = TRUE)
plots <- pla.plots(Frame, design = Design, sampleLabels = c("S", "T", "U"),
colTst = c("blue", "red"), showRho = FALSE,
main = "PhEur: Corticotrophin; Subcutaneous Injection In Rats",
tests = fits@tests,)
## Alternative on object of class 'pla':
plaModel <- plaCRD(Data,
assayTitle = "PhEur: Corticotrophin; Subcutaneous Injection In Rats")
Fits <- fit(plaModel)
AgarDiffusionAssay
Antibiotic agar diffusion assay using a rectangular tray
Description
5.1.2. THREE-DOSE LATIN SQUARE DESIGN
Usage
data("AgarDiffusionAssay")
Details
From Ph.Eur.:
The standard has an assigned potency of 4855 IU/mg. The test preparation has an assumed potency
of 5600 IU/mg. For the stock solutions 25.2 mg of the standard is dissolved in 24.5 ml of solvent and
21.4 mg of the test preparation is dissolved in 23.95 ml of solvent. The final solutions are prepared
by first diluting both stock solutions to 1/20 and further using a dilution ratio of 1.5. A Latin square
is generated with the method described in Section 8.6 (see Table 5.1.2.-I). The responses of this
routine assay are shown in Table 5.1.2.-II (inhibition zones in mm x 10). The treatment mean
values are shown in Table 5.1.2.-III. A graphical representation of the data (see Figure 5.1.2.-I)
gives no rise to doubt the normality or homogeneity of variance of the data.
Source
The example can also be found at CombiStats - EDQM, Council of Europe (http://combistats.
edqm.eu): http://combistats.edqm.eu/content/view/187/199/
References
Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014; 607-635.
6
assayModel-class
Examples
data(AgarDiffusionAssay); Agar <- AgarDiffusionAssay
Agar <- read.table(paste(system.file(package = "pla"),
"vignettes/PhEur/data/AntibioticAgarDiffusionAssay.txt",
sep = "/"), header = TRUE)
select
<- c("Row", "Column", "Sample", "Dilution", "Response")
PHframe <- data2assayFrame(Agar[, select])
plaModel <- pla(Agar, design = "lsd",
assayTitle = "PhEur: Antibiotic agar diffusion assay")
plots
<- plot(plaModel, plots = "all", mfrow = c(3, 4))
assayModel-class
Create a parallel line assay model
Description
Create a parallel line assay model, with optional imputation of data.
Usage
pla(data,
alpha
= 0.05,
indexOfReference = 1,
StdName
= sampleLabels[indexOfReference],
sampleLabels
= "data",
imputeMissing
= FALSE,
dfAdjustment
= NA,
dilutionRatio
= NA,
factor
= NA,
selectFun
= function (array) NULL,
echoData
= TRUE,
colors
= "default",
projectTitle
= "",
assayTitle
= "",
design
= "", ...)
plaCRD(data, alpha = 0.05, imputeMissing = FALSE, dfAdjustment = NA,
dilutionRatio = NA, factor = NA, echoData = TRUE,
colors = "default", projectTitle = "", assayTitle = "")
plaRBD(data, alpha = 0.05, imputeMissing = FALSE, dfAdjustment = NA,
dilutionRatio = NA, factor = NA, echoData = TRUE,
colors = "default", projectTitle = "", assayTitle = "")
plaLSD(data, alpha = 0.05, imputeMissing = FALSE, dfAdjustment = NA,
dilutionRatio = NA, factor = NA, echoData = TRUE,
colors = "default", projectTitle = "", assayTitle = "")
assayModel-class
7
Arguments
data
An object of class assayData-class (returned from readAssayTable) or a data.frame
as returned from data2assayFrame or assayTable2frame.
sampleLabels
A vector of character strings giving the labels of the samples. By default,
"data", the labels are extracted from the data. If the resulting column "Sample"
from data has one of these values, then these rows are used in fits and plots.
indexOfReference
Index of the reference among the samples given by sampleLabels.
StdName
A character string identifying the reference among the Samples of the input data
data. By default, this is sampleLabels[indexOfReference].
imputeMissing
A boolean. If TRUE then imputation is used for missing values.
alpha
A numeric, the level of significance for test of validity, and also used for confidence intervals, default 0.05. See pla.fit.
dfAdjustment
The needed adjustment of the number of degrees of freedom, if e.g. data are corrected for blocks, rows or columns before applying the model of the completely
randomized design on block designs.
dilutionRatio
The dilution ratio of the "equally spaced" dilutions.
factor
A numeric to multiply on the estimated potency.
selectFun
A function taking as argument the array of all read factors, and returning the
three-dimensional array of the model. Factors and dimensions can be deleted,
or treatments (samples and/or doses) selected.
echoData
A boolean. If TRUE then the data table is printed.
colors
A vector of text strings for the colors of preparations.
projectTitle
A character string.
assayTitle
A character string.
design
"crd", "rbd" or "lsd" for respectively "completely randomized design", "randomized block design", and "latin squares design".
...
Arguments for impute: epsilon, maxit, and trace.
Details
assayTable2frame and data2assayFrame returns an object of class data.frame. readAssayTable returns an object of class assayFrame-class or assayTable-class, which both also are of (contains)
class assayData-class.
Objects of classes assayData-class and data.frame are turned into models by the functions plaCRD,
plaRBD, and plaLSD for respectively completely randomized design, randomized block design,
and latin squares design.
The functions print, show, plot, and fit are available for returned objects of class pla-class of these
functions. The returned object of fit has the usual methods of lm plus the function potency.
pla (also called by plaCRD, plaRBD, and plaLSD) does the job of checking the input data, and
adding necessary variables for pla.fit and pla.plots. The model is specified by the design argument,
or slot of the argument data object. Similar for dfAdjustment, factor, and dilutionRatio. The
preference here is that if the argument is given to pla, the value of this argument is used. Else, if
8
assayTable2frame
the value is found in the argument object data, that value is used. If the argument is not given, and
the value neither is found in the argument object with data, then a default value, "crd", 0 or 1, is
used. Also the significance level, and default colors and titles for plots are set.
Last but not least, imputation of data is performed in pla, if this is wanted, by setting imputeMissing
to TRUE. Thus the imputed data in the resulting object can be inspected before the model is fitted,
and the imputation is performed separated from the reading the data. The imputation is performed
as described in Ph.Eur. (EUROPEAN PHARMACOPOEIA). See also Bliss (1952).
Value
Object of class pla-class, plaCRD-class, plaLSD-class, or plaRBD-class.
Note
data2assayFrame is called from pla, if a data.frame is found as the argument, or as the relevant slot
in an argument with this slot.
Author(s)
Jens Henrik Badsberg
References
Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014; 607-635.
Bliss, C.I. (1952): The Statistics of Bioassay - with special reference to the vitamin. Academic
Press, New York.
See Also
pla-package
assayTable2frame
Expand table to matrix of measurements by variables - for pla.fit and
pla.plots
Description
A table, that is, a 2-dimensional array, with the responses of an experiment is transformed for into
a matrix, a data.frame, with rows for the individual measurements and columns the variables and
factors of the assay - for pla.fit and pla.plots.
Usage
assayTable2frame(table,
dr = 2,
Z = log((1/dr)^(max(Dilution) - Dilution)),
byOrder = TRUE,
echoData = TRUE,
...)
assayTable2frame
9
Arguments
table
A table in an object of class array. This is here usually in this tool the result of
as.array on the result of readAssayTable.
dr
The dilution ratio of the geometric dilution serie with equally spaced dilutions
(constant ratio between any adjacent dilutions) on the logarithmic scale. See
also data2assayFrame.
Z
The ’concentration’, by default computed as log((1/dr)(max(Dilution)−Dilution) ),
where Dilution is dilution step. See also data2assayFrame.
byOrder
If TRUE then the order of the columns defines the order and values of the dilution
steps - for tables read by readAssayTable with the single repetition over several
lines. If FALSE then the 'dose' is extracted from the dimnames of the table
and as well Dilution and Z is given this value.
echoData
If TRUE then the data is shown with means, standard deviations and coefficients
of variations of columns.
...
For additional arguments.
Details
This function is used on table of data read by readAssayTable. The table of responses is transformed into a data.frame with the relevant columns Response, Dilution, Sample, and Replicate.
The rows of the input table are replicates, and the columns of the input table are the cross
classification samples and dilutions.
Value
A data.frame with rows of individual observations and columns of treatments, dilution step numbers, replicate numbers (blocks), response-values, etc.
Note
If, e.g., "1. form" of table layout is used for the input file, see readAssayTable:
Dilution steps (and concentrations) are determined by the order of the columns in table, not the
column-names of the table (by default) - for tables read with the single repetition over several lines.
Thus the value of the dose in the label of the columns of the table is ignored - if not the argument
byOrder is set to FALSE.
Sample names (and "doses") are extracted from the second item of dimnames of the table. If this
second component of the dimnames of the table does not contain text strings with the character
":", then the sample name is the first character of each name. If the names contains the character
":", the sample name is the first item, when splitting according to ":".
If byOrder is set to TRUE (default) then Dilution step is the index of the column of the dilutionstep
among the columns for the sample in the table.
If byOrder is set to FALSE then "dose" is the last item (when splitting according to ":") of each
name of the header dimnames of the table.
- Similar, if the doses and/or samples are given in rows.
The first meet sample in the sample column is the reference (by default) in pla.fit and pla.plots.
10
Corticotrophin
Author(s)
Jens Henrik Badsberg
Examples
data(HepatitisB); Data <- HepatitisB
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/PhEur/data/HepatitisB.txt",
sep = "/"), fun = log)
Frame <- assayTable2frame(as.array(Data))
Corticotrophin
An assay of corticotrophin by subcutaneous injection in rats
Description
5.1.1. TWO-DOSE MULTIPLE ASSAY WITH COMPLETELY RANDOMIZED DESIGN
Usage
data("Corticotrophin")
Details
From Ph.Eur.:
The standard preparation is administered at 0.25 and 1.0 unit per 100 g of body mass. 2 preparations
to be examined are both assumed to have a potency of 1 unit per milligram and they are administered
in the same quantities as the standard. The individual responses and means per treatment are given
in Table 5.1.1.-I. A graphical presentation (Figure 5.1.1.I) gives no rise to doubt the homogeneity
of variance and normality of the data, but suggests problems with parallelism for preparation U.
Source
The example can also be found at CombiStats - EDQM, Council of Europe (http://combistats.
edqm.eu): http://combistats.edqm.eu/content/view/186/199/
References
Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014; 607-635.
data2assayFrame
11
Examples
data(Corticotrophin); Data <- Corticotrophin
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/PhEur/data/Corticotrophin.txt",
sep = "/"))
plaModel <- plaCRD(Data,
assayTitle =
"PhEur: Corticotrophin; Subcutaneous Injection In Rats")
plaModel
plots
<- plot(plaModel, plots = "all", mfrow = c(3, 4))
# A few plots you cannot ask for in 'pla.plots' and 'plot':
cbbPalette <- c("#000000", "#009E73", "#e79f00", "#9ad0f3",
"#0072B2", "#D55E00", "#CC79A7", "#F0E442")
pchs <- 14 + as.numeric(plots$data[,"Replicate"])
colors <- c("grey", "blue", "red")[as.numeric(plots$data[, "Sample"])]
colors <- colors <- c("grey", cbbPalette[2:3])[as.numeric(plots$data[, "Sample"])]
# Boxplot af residuals by replicate:
plot(Residual ~ factor(plots$data[,"Replicate"]), pch = pchs, col = colors,
xlab = "Replicate", ylab = "Residuals, Restricted model",
cex.lab = 0.75, sub = "Restricted Model", data = plots$data)
# Boxplot of residuals by dose:
plot(Residual ~ factor(Z), pch = pchs, col = colors,
xlab = "Dose", ylab = "Residuals, Restricted model",
cex.lab = 0.75, sub = "Restricted Model", data = plots$data)
data2assayFrame
Check dataframe for pla.fit
Description
Check and prepare a dataframe with data for pla, pla.fit, and pla.plots.
Usage
data2assayFrame(dataframe,
dr = 1.5,
Z = log((1/dr)^(max(Dilution) - Dilution)),
design = "lsd")
12
data2assayFrame
Arguments
dataframe
dataframe with the columns Response, Dilution, Sample, and Replicate (or
Row and Column).
dr
The dilution ratio of the geometric dilution serie with equally spaced dilutions
(constant ratio between any adjacent dilutions) on the logarithmic scale.
Z
The ’concentration’, by default computed as log((1/dr)(max(Dilution)−Dilution) ),
where Dilution is a columns of the argument dataframe.
design
If "lsd", then Row and Column has to be columns of the dataframe, and a column
Replicate is copied from Row. Replicate and Row is also used for 'block'
and 'plate'. Column is for "lsd" ("Latin Square Design") used for the ’other’
factor. For the designs "crd" and "rbd" Replicate has to be a column of the
argument dataframe.
Details
This function is used internally in pla to check the dataframe that can be given with the data for
pla.fit. It can also be used to prepare a dataframe for direct call of pla.fit. Relevant columns are
added for pla.fit, and the dataframe is sorted for pla.plots.
Value
A data.frame.
Note
The slope for the potency is computed relative to the added column Z for complete data analysis. Z
is NOT used when computing the potency for data without missing values by the method of Ph.Eur.
The dilution ratio dr is also used in the function pheur325 for computing the slope and potency
(when the design is complete, i.e. there are no missing values). Thus if a geometric dilution serie
not is used, the anova-table and plots might be useful, but not the slope and potency computed by
pheur325 and thus by pla.fit.
Sample and Step are transformed to numerics from possible factors (with the orderings of the
levels of these factors), and the order of Sample and Step are then reverted. This might give some
confusion. data2assayFrame is called from pla, if a data.frame is found as the argument, or as the
relevant slot in an argument with this slot. Use as.data.frame on the pla-object to view data data as
going into the fitting and plotting functions - for debugging.
Author(s)
Jens Henrik Badsberg
Examples
# Example 1:
require(graphics)
Dilution <- 2 + log(ToothGrowth["dose"]) / log(2)
Diphteria
13
names(Dilution) <- "Dilution"
Replicate <- rep(1:10, 6)
Data
<- cbind(ToothGrowth, Replicate, Dilution)
dimnames(Data)[[2]] <- c("Response", "Sample", "Dose", "Replicate", "Dilution")
Design
<- "crd"
Frame
<- data2assayFrame(Data, dr = 2, design = Design)
Fits
<- pla.fit(Frame, sampleLabels = c("VC", "OJ"), dr = 2,
design = Design, main = "ToothGrowth", show = TRUE)
pla.plots(Frame, design = Design,
sampleLabels = c("VC", "OJ"), main = "ToothGrowth")
# Example 2:
data(AgarDiffusionAssay)
# Agar
#
Agar
Design
select
Frame
fits
<- read.table("./pla/vignettes/PhEur/data/AntibioticAgarDiffusionAssay.txt",
header = TRUE)
<- AgarDiffusionAssay
<- "lsd"
<- c("Row", "Column", "Sample", "Dilution", "Response")
<- data2assayFrame(Agar[, select])
<- pla.fit(Frame, design = Design, sampleLabels = c("S", "T"),
dr = 1.5, returnPotencyEstimates = TRUE)
## Alternative on object of class 'pla':
plaModel <- plaLSD(Agar)
Fits <- fit(plaModel)
Diphteria
Diphteria vaccine - Intradermal challenge
Description
Example 01 - Three-dose parallel line assay; completely randomized; square transformation; explicit volume units, from CombiStats - EDQM, Council of Europe (http://combistats.edqm.
eu).
Usage
data("Diphteria")
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/Diphtheria%20intradermal.pdf
14
Erythromycin
Examples
Example <- "Example 1"
data(Diphteria); Data <- Diphteria
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/Diphteria.txt",
sep = "/"), fun = function(x) x^2,
rows = "Dilutions & Samples", columns = "Replicates")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel)
Erythromycin
Erythromycin - Assay 1
Description
Example 22 - Three-dose parallel line assay at three independent occasions; randomized block;
symbolic notation, from CombiStats - EDQM, Council of Europe (http://combistats.edqm.eu).
Usage
data("Erythromycin")
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/Erythromycin.pdf
Examples
Example <- "Example 22"
data(Erythromycin); Data <- Erythromycin
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/Erythromycin.txt",
sep = "/"),
rows = "Block", columns = "Dilutions & Samples")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel)
Erythropoietin
Erythropoietin
15
Erythropoietin rDNA - Normocythaemic assay in mice
Description
Example 02 - Three-dose parallel line assay; randomized block; explicit content notation, from
CombiStats - EDQM, Council of Europe (http://combistats.edqm.eu).
Usage
data("Erythropoietin")
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/Erythropoeitin%20rDNA.pdf
Examples
Example <- "Example 2"
data(Erythropoietin); Data <- Erythropoietin
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/Erythropoietin.txt",
sep = "/"),
rows = "Block", columns = "Dilutions & Samples")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel, plots = "all", mfrow = c(3, 4))
# A few plots you cannot ask for in 'pla.plots' and 'plot':
cbbPalette <- c("#000000", "#009E73", "#e79f00", "#9ad0f3",
"#0072B2", "#D55E00", "#CC79A7", "#F0E442")
pchs <- 14 + as.numeric(plots$data[, "Replicate"])
colors <- c("grey", "blue", "red")[as.numeric(plots$data[, "Sample"])]
colors <- colors <- c("grey", cbbPalette[2:3])[as.numeric(plots$data[, "Sample"])]
plot(Residual ~ factor(plots$data[, "Replicate"]), pch = pchs, col = colors,
xlab = "Block", ylab = "Residuals, Restricted model",
cex.lab = 0.75, sub = "Restricted Model", data = plots$data)
plot(Residual ~ factor(Z), pch = pchs, col = colors,
xlab = "log(Dosis)", ylab = "Residuals, Restricted model",
cex.lab = 0.75, sub = "Restricted Model", data = plots$data)
16
Fiellers
FactorIX
Factor IX - Coagulation
Description
Example 03 - Four-dose parallel line assay; completely randomized; logarithmic transformation;
explicit ratio notation, from CombiStats - EDQM, Council of Europe (http://combistats.edqm.
eu).
Usage
data("FactorIX")
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/Factor%20IX.pdf
Examples
Example <- "Example 3"
data(FactorIX); Data <- FactorIX
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/FactorIX.txt",
sep = "/"), fun = log10,
rows = "Dilutions & Samples", columns = "Replicates")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel)
Fiellers
Fiellers confidence interval
Description
Computes Fiellers confidence interval for the ratio of two normal.
Usage
Fiellers(model,
Which = 1:length(which(b)),
sample = "Sample",
factor = paste0("factor(", sample, ")"),
independent = "Z",
df = summary(model)$df[2],
alpha = 0.05)
HeparinSodium
17
Arguments
model
An object of class lm.
Which
The indices of the ’intercepts’ to divide by the slope.
sample
The names, factor levels, of the intercepts.
factor
The names of the parameters for intercepts in the coef of the linear model.
independent
The name of the independent variable for the slope.
df
An integer.
alpha
A real number, preferable between 0 and 1.
Author(s)
Jens Henrik Badsberg <[email protected]>
References
Fieller, E.C.: The biological standardization of insulin. Supplement to the Journal of the Royal
Statistical Society. 1940; Vol. VII., No. 1.
HeparinSodium
Heparin Sodium - European Pharmacopoeia (1997), 2.7.5
Description
Example 05 - Three-dose parallel line assay; completely randomized; custom transformation; explicit content notation, from CombiStats - EDQM, Council of Europe (http://combistats.edqm.
eu).
Usage
data("HeparinSodium")
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/Heparin%20sodium.pdf
Examples
Example <- "Example 5"
data(HeparinSodium); Data <- HeparinSodium
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/HeparinSodium.txt",
sep = "/"),
fun = function(x)
apply(array(x, dim = c(6, 2, 2)), c(1, 3), mean),
18
HepatitisB
log = 10,
rows = "Dilutions & Samples",
columns = "Inner & Replicates")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel)
HepatitisB
An in-vitro assay of three hepatitis B vaccines against a standard
Description
5.1.4. FIVE-DOSE MULTIPLE ASSAYWITH COMPLETELY RANDOMIZED DESIGN
Usage
data("HepatitisB")
Details
From Ph.Eur.:
3 independent two-fold dilution series of 5 dilutions were prepared from each of the vaccines. After
some additional steps in the assay procedure, absorbance’s were measured. They are shown in
Table 5.1.4.-I. The logarithms of the optical densities are known to have a linear relationship with
the logarithms of the doses. The mean responses of the ln-transformed optical densities are listed
in Table 5.1.4.-II. No unusual features are discovered in a graphical presentation of the data.
Source
The example can also be found at CombiStats - EDQM, Council of Europe (http://combistats.
edqm.eu): http://combistats.edqm.eu/content/view/189/199/
References
Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014; 607-635.
Examples
data(HepatitisB); Data <- HepatitisB
cbbPalette <- c("#000000", "#009E73", "#e79f00", "#9ad0f3",
"#0072B2", "#D55E00", "#CC79A7", "#F0E442")
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/PhEur/data/HepatitisB.txt",
sep = "/"), fun = log)
plaModel <- plaCRD(Data,
assayTitle =
"PhEur: HepatitisB; Three hepatitis B vaccines against a standard")
HepatitisBvaccine
19
plaModel
plots
<- plot(plaModel)
HepatitisBvaccine
Hepatitis B vaccine
Description
Example 07 - Five-dose parallel line assay; completely randomized; logarithmic transformation;
explicit ratio notation, from CombiStats - EDQM, Council of Europe (http://combistats.edqm.
eu).
Usage
data("HepatitisBvaccine")
Source
EDQM Combistats: http://combistats.edqm.eu/images/stories/Examples/Hepatitis%20B.
pdf
Examples
Example <- "Example 7"
data(HepatitisBvaccine); Data <- HepatitisBvaccine
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/HepatitisBvaccine.txt",
sep = "/"), fun = log,
rows = "Dilutions & Samples", columns = "Replicates")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel)
HumanHepatitis
Human Hepatitis A immunoglobulin - Elisa
Description
Example 08 - Four-dose parallel line assay; completely randomized; square root transformation;
explicit content notation, from CombiStats - EDQM, Council of Europe (http://combistats.
edqm.eu).
Usage
data("HumanHepatitis")
20
IPV
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/Hepatitis%20A%20Ig.pdf
Examples
Example <- "Example 8 "
data(HumanHepatitis); Data <- HumanHepatitis
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/HumanHepatitis.txt",
sep = "/"), fun = sqrt,
rows = "Dilutions & Samples", columns = "Replicates")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel)
IPV
Inactivated poliomyelitis vaccine - Type 3
Description
Example 10 - Four-dose parallel line assay; completely randomized; logarithmic transformation;
explicit ratio notation, from CombiStats - EDQM, Council of Europe (http://combistats.edqm.
eu).
Usage
data("IPV")
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/IPV.pdf
Examples
Example <- "Example 10"
data(IPV); Data <- IPV
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/IPV.txt",
sep = "/"), fun = log10,
rows = "Dilutions & Samples", columns = "Replicates")
plaModel <- plaCRD(Data); plaModel
plots
<- plot(plaModel)
jitterSteps
21
jitterSteps
Compute a perturbed version of the dose-variable
Description
Compute a perturbed version of the dose-variable - such that all the measurements can be seen in
plots.
Usage
jitterSteps(dataFrame)
Arguments
dataFrame
A data.frame with columns Sample, Response, Dilution, and Z.
Value
data.frame with rows of individual observations and columns of treatments, block, response-value,
etc. plus a new column Zjitter.
Author(s)
Jens Henrik Badsberg
Nystatin
Nystatin: Antibiotic agar diffusion assay
Description
Example 15 - Three-dose parallel line assay; latin square; explicit ratio notation, from CombiStats - EDQM, Council of Europe (http://combistats.edqm.eu). 5.1.2. THREE-DOSE LATIN
SQUARE DESIGN
Usage
data("Nystatin")
Details
The data is the same as AgarDiffusionAssay, but here with CombiStats as source, and put into an
object.
Source
From CombiStats - EDQM, Council of Europe: http://combistats.edqm.eu/images/stories/
Examples/Nystatin.pdf
22
pheur325
Examples
Example <- "Example 15"
data(Nystatin); Data <- Nystatin
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/Nystatin.txt",
sep = "/"),
rows = "Measurements",
columns = "All factors and variables")
plaModel <- plaLSD(Data)
Fits
<- fit(plaModel)
plots
<- plot(plaModel)
pheur325
Potency with confidence intervals
Description
Estimation of potency and confidence limits as described at page 480 in Ph.Eur (but with the
Sums Of Squares computed by lm).
If complete data analyses is performed, then the slope and contrasts of intercepts are returned form
the lm-fit, and confidence intervals for potency computed by Fieller’s theorem.
Usage
pheur325(data,
lmInteraction = NULL,
lmRestricted = NULL,
dr = 2,
response = "Response",
sampleLabels = levels(unlist(data["Sample"])),
indexOfReference = 1,
StdName = sampleLabels[indexOfReference],
sampleStepName = "SampleStep",
dfAdj = 0,
factor = 1.0,
alpha = 0.05)
Arguments
data
data.frame with the columns response and sampleStepName. Note that the
slope then is determined by only the additional dilution ratio dr.
lmInteraction
Linear model for ANOVA table - with Sums of Squares.
lmRestricted
Linear model with estimates of regression parameters for complete analysis when missing values are present.
dr
The dilution ratio of the equally spaced dilutions, see data2assayFrame.
pla.fit
23
response
sampleLabels
A character string giving the name of the response column of data.
A vector of character strings giving the labels of the samples. If data["Sample"]
has one of these values, then these rows are used. These labels are also used for
labels of the returned values.
indexOfReference
Index of the reference among the samples given by sampleLabels. If data["Sample"]
has this value, then these rows are from the ’reference’.
StdName
A character string identifying the reference in the columns "Sample" of the input
data.
sampleStepName A character string giving the name of the sampleStepName column of data.
This variable should identify both the preparation and the dilution step.
dfAdj
The needed adjustment of the number of degrees of freedom, if e.g. data are
corrected for blocks, rows or columns, or if values are imputed before applying
the model of the completely randomized design on block designs.
factor
A numeric (vector) to multiply on the estimated potency.
alpha
A real number, preferable between 0 and 1 - for the confidence interval.
Details
See page 480 in Ph.Eur.
Value
A list of lists with variables named as at page 480 in Ph.Eur.
Author(s)
Jens Henrik Badsberg
References
Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014; 607-635.
Fieller, E.C.: The biological standardization of insulin. Supplement to the Journal of the Royal
Statistical Society. 1940; Vol. VII., No. 1.
pla.fit
Estimation in parallel line models, with listing of results
Description
The main results are the estimate of potency with confidence interval and the anova table with tests
of regression, parallelism and linearity. The anova table can also have test of effect of blocks for
Randomized Block Design, and test of row and column for Latin Square Design.
Further the restricted and unrestricted models are fitted without effects of row, columns, and blocks.
The models are fitted by lm, in combination with the function pheur325.
Results are listed directly, or returned in an object. These results can be typeset by LaTex - directly,
or by the use of the package xtable.
24
pla.fit
Usage
fit(object, ...)
pla.fit(data,
sampleLabels = levels(unlist(data["Sample"])),
indexOfReference = 1,
StdName = sampleLabels[indexOfReference],
design = "blocks",
dfAdj = 0,
dr = 2,
factor = 1,
alpha = 0.05,
main = "Parallel Line Model",
tag = "PLA",
expectedAnova = NULL,
expectedPotency = NULL,
formatTests = "long",
show = FALSE,
sink = FALSE,
Sweave = FALSE,
printPotencyEstimates = TRUE,
returnPotencyEstimates = TRUE)
Arguments
object
Object of class pla-class.
...
Arguments from tag to printPotencyEstimates of pla.fit. The other arguments for pla.fit are extracted from the object when using fit(object, ...).
data
The data.frame with relevant variables - created by data2assayFrame or assayTable2frame.
main
A character string giving with the main title for plot (created by pla.plots).
tag
A character string giving a part of names of output-files, see e.g. sink.
design
crd, blocks, or latin for selecting "Completely Randomized Design", "Randomized block design", or "Latin square design".
dr
The dilution ratio of the equally spaced dilutions.
dfAdj
The needed adjustment of the number of degrees of freedom, if data are corrected for blocks, rows or columns before applying the model of the completely
randomized design on block designs, or if values are imputed.
sampleLabels
A vector of character strings giving the labels of the samples. If data["Sample"]
has one of these values, then these rows are used. These labels are also used for
labels of the returned values.
indexOfReference
Index of the reference among the samples given by sampleLabels.
StdName
A character string identifying the reference in the columns Sample of the input
data data. If data["Sample"] has this value, then these rows are from the
’reference’.
pla.fit
25
formatTests
A vector of character string, "long", "short", "both", "none" to select format
for results of validity tests.
show
A logical or subset of "head", "anova", "tests", "regressions", "ratios", "pheur",
"rsquare", "slope", "logpotency", "potency"). If TRUE then all the results are
reported.
sink
Output is diverted to paste(tag, "-Result.txt", sep = "") if this boolean
is TRUE.
alpha
A numeric (vector), the level of significance for test of validity, default 0.05.
alpha can be a named vector with the levels of significance for the tests of
Regression, Linearity, Parallelism, and the complementary probability
alpha of the Confidence interval of the potency. If more than one probability is supplied for one test of validity, then "Unknown" is reported for tests with
probability between the supplied values, with counts of limits exceedded.
Sweave
If TRUE then code is inserted in the output listing for page breaking in LaTeX.
factor
A numeric (vector) to multiply on the estimated potency.
expectedAnova A numeric matrix with the expected ANOVA table.
expectedPotency
A numeric matrix with the expected potency.
printPotencyEstimates
If TRUE then computed potency values are listed (for Sweave).
returnPotencyEstimates
If TRUE then computed potency values are returned.
Value
No values returned.
Author(s)
Jens Henrik Badsberg
Examples
data(Turbidimetric); Data <- Turbidimetric
Design <- "blocks"
Data
<- readAssayTable(paste(system.file(package = "pla"),
"vignettes/PhEur/data/AntibioticTurbidimetric.txt",
sep = "/"))
Frame <- as.data.frame(Data, dr = 1.5)
fits
<- pla.fit(Frame, design = Design, sampleLabels = c("S", "T"),
dr = 1.5, returnPotencyEstimates = TRUE)
## Alternative on object of class 'pla':
plaModel <- plaRBD(Data)
Fits <- fit(plaModel)
26
pla.plots
pla.plots
Make plots for parallel line models
Description
Plots of the "restricted" and "unrestricted" fits for parallel line models. Also plots of the model
with individual fits for each combination of sample and dose can be displayed, on the scale of
observed values, or corrected for the mean of the values for the dilution step. Finally residuals can
be plotted in qq-plots (qqnorm), histograms, box-plots, or against dilutions step, sample, repetition,
row, column, block, plate, etc.
Usage
pla.plots(dataframe,
sampleLabels = levels(unlist(dataframe["Sample"])),
indexOfReference = 1,
design = "blocks",
main = "Parallel Line Model",
setPdf = FALSE,
pdfName = "PlaPlots.pdf",
nc = 4,
mfrow = c(2, nc),
oma = c(1, 0, 2, 0),
mar = c(3.5, 3.5, 0, 0) + 0.6,
joinReplicates = TRUE,
showRho = FALSE,
plots = "default",
xlab = "Log(Dosis)",
ylab = "Response: Response",
pch = 14 + as.numeric(unlist(dataframe["Replicate"])),
cex = 2,
lwd = 4,
colTst = "black",
colRef = "grey",
colRho = "grey10",
colNrm = "grey70",
tests = NULL)
Arguments
dataframe
The data.frame with relevant variables, created by functions data2assayFrame
or assayTable2frame - as for pla.fit.
sampleLabels
A vector of character strings giving the labels of the samples, standard and
test-samples: "S", "T", "U", ... If data["Sample"] has one of these values,
then these rows are used. These labels are also used for labels of the returned
values.
pla.plots
27
indexOfReference
Index of the reference among the samples given by sampleLabels.
design
crd, blocks, or latin, see pla.fit.
main
Main title for plot.
setPdf
If TRUE then PDF graphics is produced in pdfName. This should not be used for
Sweave.
pdfName
A character string giving the name of the file for PDF graphics.
nc
4 or 3. Numeric value used for mfrow. One plot for the unrestricted model and
the histogram of residuals omitted by 3.
mfrow
See par.
oma
See par.
mar
See par.
joinReplicates See plotSamples.
showRho
See plotSamples.
plots
A (vector of) character strings from the list "default", "all", "restricted", "unrestricted", "twoway", "stepadjusted", "qplot", "histogram", "residualsSamples",
"residualsBoxSampleStep", "residualsBoxSample", "residualsRow", "residualsColumn", "residualsBlock", "residualsPlate", "residualsStep".
xlab
See plotSamples.
ylab
See plotSamples.
pch
See plotSamples.
cex
See plotSamples.
lwd
See plotSamples.
colTst
Color(s) of test-samples, "T", "U", ...
colRef
Color of reference or standard, i.e. "S".
colRho
Color of displayed potency.
colNrm
Color for qqnorm and curve in histogram.
tests
Optional returned values from pla.fit.
Value
No values returned.
Author(s)
Jens Henrik Badsberg
28
plotSamples
Examples
data(HepatitisB); Data <- HepatitisB
Design <- "crd"
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/PhEur/data/HepatitisB.txt",
sep = "/"))
Frame <- as.data.frame(Data)
fits
<- pla.fit(Frame, design = Design, sampleLabels = c("S", "T", "U", "V"),
dr = 2.25, returnPotencyEstimates = TRUE)
cbbPalette <- c("#000000", "#009E73", "#e79f00", "#9ad0f3",
"#0072B2", "#D55E00", "#CC79A7", "#F0E442")
plots <- pla.plots(Frame, sampleLabels = c("S", "T", "U", "V"),
nc = 3, showRho = FALSE, colTst = cbbPalette[2:4],
## main = Data@assayTitle,
main = "PhEur: HepatitisB; Three hepatitis B vaccines against a standard",
tests = fits@tests)
## Alternative on object of class 'pla':
plaModel <- plaCRD(Data,
assayTitle = "PhEur: HepatitisB; Three hepatitis B vaccines against a standard")
print(plaModel, formatTest = "short")
plots
<- plot(plaModel)
plotSamples
Scatter plot for parallel line models
Description
Make one scatter plot of the samples in a parallel line assay, with fitted models.
Usage
plotSamples(dataframe,
LMfits,
sampleLabels = levels(unlist(dataframe["Sample"])),
indexOfReference = 1,
pdfName = "SpecifiedModel.pdf",
joinReplicates = TRUE,
showRho = TRUE,
xlab = "Log(Dosis)",
ylab = "Response: Response",
pch = 14 + as.numeric(unlist(dataframe["Replicate"])),
cex = 2,
lwd = 4,
plotSamples
29
colTst = "black",
colRef = "grey",
colRho = "grey80",
main = "Parallel Line Model",
sub = "Specified Model")
Arguments
dataframe
The data.frame with relevant variables (Replicate, Response, indexOfTreatment,
Z, and Zjitter), created by jitterSteps in pla.plots.
LMfits
Result of lm with relevant regression coefficients. Fitted values, intercepts and
slopes are extracted from this model.
sampleLabels
See pla.plots.
indexOfReference
See pla.plots.
pdfName
See pla.plots.
joinReplicates If TRUE the samples from same block or row are joined by lines in the plots for
unrestricted models, i.e. for the models with dilution as a factor.
showRho
If TRUE then the potency is displayed in the plot for the restricted model.
xlab
A character string giving the title on horizontal axis of the plot.
ylab
A character string giving the title on vertical axis of the plot.
pch
Vector of symbols for plot, par.
cex
See par about size of characters for plot.
lwd
See par about line width for plot.
colTst
See pla.plots.
colRef
See pla.plots.
colRho
See pla.plots.
main
See pla.plots.
sub
See pla.plots.
Details
This function is called from pla.plots.
Value
No values returned.
Author(s)
Jens Henrik Badsberg
30
readAssayTable
potency
Return or compute potency
Description
The function computes the potency as described in the Ph.Eur.
Usage
potency(object)
Arguments
object
Object of class pla-class or plaFit-class
Details
See page 480 in Ph.Eur.
Value
A list of lists with variables named as at page 480 in Ph.Eur.
Author(s)
Jens Henrik Badsberg
References
Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014; 607-635.
readAssayTable
Read a .txt file with responses of an assay
Description
Read ".txt" file with responses of an indirect dilution assay, with some titles and labels - and return
the table and labels in an object.
The function reads either a matrix of measurement by variable (a ’data.frame’), or a table with the
measured variable (an ’array’).
readAssayTable
31
Usage
readAssayTable(file = "AssayTable.txt",
fun = NULL,
log = FALSE,
rows = "",
columns = "",
replicateNames = c("Repetition", "Replicate", "Block",
"Plate", "Animal", "Group", "Litter"),
doseNames = c("Dilution", "Dose"),
sampleNames = c("Smp", "Sample"),
otherNames = c("Outer", "Inner", "Assay"),
responseName = "Response",
combinedTreatment = FALSE,
echoTitle = TRUE)
Arguments
file
A character string giving the name of the file of input.
fun
A function to be applied on the table (before log-transformation).
log
If TRUE, then the responses are log-transformed.
rows
A character string: A warning is given, if this does not match the row-factors
found in the file.
columns
A character string: A warning is given, if this does not match the column-factors
found in the file.
replicateNames A vector of text strings with permitted names for the factor of replicates. These
cannot be used for labels of levels in the header line, the first line of the file.
doseNames
A vector of text strings with permitted names for the factor of doses.
sampleNames
A vector of text strings with permitted names for the factor of samples.
otherNames
A vector of text strings with permitted names of other factors.
responseName
A text string with name of response.
combinedTreatment
A boolean. If TRUE then the dose and sample does not have to be balanced. Dose
and sample is read as a combined treatment, when they are given in columns,
that is, the levels are specified in the header line.
echoTitle
A boolean. If TRUE then the project- and assay-title is printed.
Details
The file is read by read.table.
Navigate to the folder .../pla/vignettes/'Source'/data/ or .../pla/scripts/data/ to see
some examples of data-files. The file .../pla/scripts/data/AssayTable.txt shows a very
simple example without "comments" for project- and assay-title, design, etc.
If the function finds the text-string ’response’ in the header line of the file, then the returned object
is of class assayFrame-class, else a table with the measured variable (an ’array’) is expected, and
then the values are stored an object of class assayTable-class.
32
readAssayTable
Her are some examples of the later:
1. form: Columns identified by the cross classification of sample and dose, and rows identified by
replicate-, repetition-, plate-, or block-number, used for Erythromycin, Erythropoietin, and Turbidimetric:
Block
S1
S2
S3
T1
T2
T3
Label
Block-1
Block-2
Block-3
Block-4
Block-5
Block-6
185
185
174
175
185
180
192
199
200
198
201
194
210
216
211
216
211
211
172
178
185
184
175
178
201
205
196
196
201
197
214
212
216
208
218
214
""
""
""
""
""
""
.
.
.
.
.
.
.
.
.
.
.
.
# Model
# Design
# DilutionRatio
# ResultOfAssay
# Project
# Description
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
"Parallel lines"
"Randomized block"
"1.5"
"Example 22: Erythromycin"
"CombiStats - EDQM, Council of Europe"
"Three-dose parallel line assay ..."
For data entered as this table for the measurements, the header line, first record or row, of the file
gives the names of the treatments (samples and dilution-steps) together with the name of at least
one factor variating over the rows.
Columns should then contain the replicates of responses for the individual treatments (cross classification of samples and dilution-steps), rows of the file the responses for different samples and doses
for one replicate (plate or block). The first column is a label for the "replicate", "block", "plate", ...,
When the columns contains the responses for the individual treatments (cross classification of samples and dilution-steps), and rows of the file replicates of the response, samples are named by a
single letter ("S", "T", "U", ...) and dilution steps by a single digit, and the header thus are text
strings with two characters, ("S1", "S2", ..., "T1", "T2", ...) - then everything is very simple.
But sometimes the cross classification of samples and dilution-steps have to be divided on more
lines, or the replicates entered in the individual lines determined by the doses of the samples, e.g.
to make proofreading against the source more easy. But then the programming in this package is
not so simple (though only a few ’hacks’ are necessary), but especially this documentation gets
complicated:
A column with label sample can be used when samples (for one ’replicate’) requires more lines.
This is used for HepatitisB under the "2. alternative" below. The table can also be transposed
(transformed) relative to the above "1. form", if rows contains the replicates of one treatment, i.e.
one cross-classification of sample and dose, and columns the responses for the individual replicate
numbers. A column Dose and a column Sample is then used for naming treatments.
Dose
Dose-0.05
Dose-0.1
Sample R1 R2 R3 R4 Label
S
S
0
2
0
3
1
2
0 ""
2 ""
readAssayTable
33
Dose-0.2
S
4
4
3
4 ""
Dose-0.02
Dose-0.04
Dose-0.08
T
T
T
1
2
2
1
2
4
0
2
4
1 ""
2 ""
4 ""
# Model
# Design
# ResultOfAssay
# Project
# Description
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
"Parallel lines"
"Completely randomised"
"Example 1: Diphteria"
"CombiStats - EDQM, Council of Europe"
"Three-dose parallel line assay; explicit volume units"
1. alternative: Rows identified by the cross classification of sample and dose, and columns identified
by replicate-, repetition-, plate-, or block-number:
If the keyword "Dose" is used in the first column (together with a dose or step number) and a
column is used to identify "sample", then the lines are expected to have the replicates for the
cross-classification of dose and sample determined by the these two columns.
This table is just a transposed version of the above "1. form".
This used for Diphteria, FactorIX, HepatitisBvaccine, HumanHepatitis, and IPV.
2. alternative: Rows identified by the cross classification of sample and replicate-, repetition-,
plate-, or block-number and columns identified by dose:
This is similar to the above "1. form", but the lines are just too long, and thus divided by sample.
Here also a column with name sample gives the sample.
Used for HepatitisB:
Replicate
Sample D1
D2
D3
D4
D5
Label
Replicate-1
Replicate-2
Replicate-3
Replicate-1
Replicate-2
Replicate-3
Replicate-1
Replicate-2
Replicate-3
Replicate-1
Replicate-2
Replicate-3
S
S
S
T
T
T
U
U
U
V
V
V
0.093
0.099
0.082
0.167
0.157
0.178
0.127
0.146
0.133
0.145
0.144
0.173
0.159
0.154
0.166
0.327
0.355
0.345
0.277
0.268
0.269
0.318
0.306
0.316
0.283
0.295
0.362
0.501
0.665
0.576
0.586
0.489
0.546
0.552
0.551
0.624
0.514
0.531
0.545
1.140
1.386
1.051
0.957
0.866
1.045
1.037
1.039
1.068
""
""
""
""
""
""
""
""
""
""
""
""
#
#
#
#
#
Model
Design
ResultOfAssay
Project
Description
0.043
0.045
0.051
0.097
0.097
0.094
0.086
0.071
0.073
0.082
0.082
0.086
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
"Parallel lines"
"Completely randomised"
"Three hepatitis B vaccines against a standard"
"Europ. Pharm., 5th Ed. (2005), Ch. 5.3, 5.1.4.a"
"Five-Dose Multiple Assay" ...
34
readAssayTable
For HeparinSodium a special form of the above is used with an "inner" factor:
Dose
Dose-1.044
Dose-1.321
Dose-1.670
Dose-1.000
Dose-1.265
Dose-1.600
#
#
#
#
#
#
#
Sample R-1:I-y R-1:I-z R-2:I-y R-2:I-z Label
S
S
S
T
T
T
78.9
108.2
176.9
79.8
107.2
168.2
79.8
113.1
180.1
76.4
106.5
171.4
79.0
119.1
173.6
78.9
117.7
179.3
79.1
122.5
169.8
78.7
117.3
162.7
""
""
""
""
""
""
Model
. . . "Parallel lines"
Design
. . . "Completely randomised"
Transformation . . . "y' = log((y+z)/2"
FUN . . . "function(x) log(apply(array(x, dim = c(6, 2, 2)), c(1, 3), mean))/log(10)"
ResultOfAssay . . . "Example 5: Heparin Sodium"
Project
. . . "CombiStats - EDQM, Council of Europe"
Description
. . . "Three-dose parallel line assay" ...
For the 1. and 2. alternative, the order of the dilution steps are determined by the order of the
columns (by assayTable2frame when byOrder is TRUE, the default). Please note that the labels of
the dilution steps are then ignored.
These three above alternatives covers half of the six possibilities of the layout of the table of
responses: Three cases with columns determined by one of the tree factors sample, dose and
replicate (block , plate, repetition, ...), and three cases with the columns determined by the
cross classification of two of the three factors.
The first found word of the header gives one of one or more factors determination the rows. This
word should also be a part of the first word of the rows of the table (to separate the data-table from
the from the options). Other names in the header not found in the 'Names' arguments determinate
the remaining factors and there levels, and are column names of columns with responses.
Other interesting tested examples of headers are:
• Block BRP_Batch:1 BRP_Batch:2 BRP_Batch:3 Test:1 Test:2 Test:3 Label
• Replicate D-1.00:T D-0.10:T D-0.01:T D-1.00:S D-0.10:S D-0.01:S Label
• Replicate T:Dose-3 S:Dose-3 T:Dose-2 S:Dose-2 T:Dose-1 S:Dose-1 Label
• Replicate S:D=5.76 S:D=9.6 S:D=16.0 T:D=32.4 T:D=54.0 T:D=90.0 T:D=150.0 Label
The pattern of special characters in the column names of columns with responses should be identical.
2. form: Matrix of measurement by variable:
If the header of the file contains the text-string "Response", then a "data.frame" with rows of measurements and columns of variables and factors is expected. This is used for latin square designs.
Column Row Sample Dilution Response
1
1
S
1
161
1
2
T
1
151
readAssayTable
1
1
1
1
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4
4
4
4
5
5
5
5
5
5
6
6
6
6
6
6
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
# Model
# Design
35
T
S
S
T
T
T
S
S
T
S
T
S
S
T
S
T
S
S
S
T
T
T
S
T
T
S
T
S
T
S
T
T
S
S
2
3
2
3
1
3
3
2
2
1
2
1
2
3
3
1
3
2
1
1
3
2
2
2
3
1
1
3
3
3
1
2
1
2
. .
. .
162
194
176
193
160
192
195
184
181
166
178
150
174
199
201
161
187
172
161
160
202
186
171
170
193
163
154
198
194
192
151
171
151
182
"Parallel lines"
"Latin square design"
# ResultOfAssay . . "Antibiotic agar diffusion assay (Example 15: Nystatin)"
# Project
. . "Europ. Pharm., 5th Ed. (2005), Ch. 5.3, 5.1.2"
# Comment
. . "Five-dose multiple assay"
...
Labels (text-lines for the "report"):
Labels as e.g. design, dilutionRatio, model, Assay and Project, etc. are extracted from the
label-field in lines after the response values.
The first character in these lines has to be "#" when a "matrix" of measurements by variables is
entered. It is also suggested to start the lines by "#", when a table of responses is entered.
36
readAssayTable
Value
An object of class assayTable-class or assayFrame-class with many more slots than the following,
but these are the most important for the functions of this package:
tableRaw
The untransformed table read into a data.frame.
design
A character string.
factor
A numeric vector.
dilutionRatio
A numeric.
dfAdjustment
A numeric.
projectTitle
Title of assay.
assayTitle
Tag for names of e.g. plots.
The returned objects have the methods print, show, as.data.frame, as.array, and as.table. as.array
and as.table has the arguments reduced and selectFun. With the boolean argument reduced the
factor of sample and factor of dilution are combined, with output similar to using row.vars for
ftable, but labels of dose can then be different across samples. The function selectFun should
work on the array of all the read factors. For objects of class assayFrame-class also the arguments
which, FUN and responseName are available. which gives the factors to determined the array, either
by indices, or names by text strings. The function is by default mean, and is used to calculate the
value of the cell in the array from the available responses in the cell.
Author(s)
Jens Henrik Badsberg
References
http://en.wikipedia.org/wiki/Dilution_assay
See Also
pla
Examples
## Not run:
library (lattice)
as.array(barley, 1:3, type = "counts", reduced = TRUE)
as.array(barley, 1:3, reduced = TRUE)
## End(Not run)
as.array(data.frame(Titanic), 1:4)
as.array(data.frame(CO2), response = "conc",
factorNames = c("Plant", "Type", "Treatment"))
as.array(data.frame(CO2), response = "uptake",
factorNames = c("Plant", "Type", "Treatment"))
as.array(data.frame(ChickWeight), response = "weight",
factorNames = c("Time", "Chick", "Diet"))
as.array(npk)
Turbidimetric
37
data(Diphteria)
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/Diphteria.txt",
sep = "/"), fun = function(x) x^2,
rows = "Dilutions & Samples", columns = "Replicates")
Diphteria
print(Diphteria)
as.array(Diphteria)
as.data.frame(Diphteria)
as.table(Diphteria)
data(Nystatin)
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/CombiStat/data/Nystatin.txt",
sep = "/"),
rows = "Measurements",
columns = "All factors and variables")
Nystatin
print(Nystatin)
as.array(Nystatin)
as.array(Nystatin, which = 1:3, reduced = TRUE)
as.array(Nystatin, which = 1:2, reduced = TRUE)
as.array(Nystatin, which = 1:2, FUN = var, reduced = TRUE)
as.array(Nystatin, which = 1:2, FUN = length, reduced = TRUE)
as.data.frame(Nystatin)
as.table(Nystatin, which = 1:3, reduced = TRUE)
Turbidimetric
Antibiotic turbidimetric assay
Description
5.1.3. FOUR-DOSE RANDOMIZED BLOCK DESIGN
Usage
data("Turbidimetric")
Details
From Ph.Eur.:
This assay is designed to assign a potency in international units per vial. The standard has an
assigned potency of 670 IU/mg. The test preparation has an assumed potency of 20 000 IU/vial. On
the basis of this information the stock solutions are prepared as follows. 16.7 mg of the standard is
dissolved in 25 ml solvent and the contents of one vial of the test preparation are dissolved in 40 ml
solvent. The final solutions are prepared by first diluting to 1/40 and further using a dilution ratio of
38
Vancomycin
1.5. The tubes are placed in a water-bath in a randomized block arrangement (see Section 8.5). The
responses are listed in Table 5.1.3.-I. Inspection of Figure 5.1.3.-I gives no rise to doubt the validity
of the assumptions of normality and homogeneity of variance of the data. The standard deviation
of S3 is somewhat high but is no reason for concern.
Source
The example can also be found at CombiStats - EDQM, Council of Europe (http://combistats.
edqm.eu): http://combistats.edqm.eu/content/view/188/199/
References
Chapter 5.3. Statistical analysis. In EUROPEAN PHARMACOPOEIA version 8.0, 2014; 607-635.
Examples
data(Turbidimetric); Data <- Turbidimetric
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/PhEur/data/AntibioticTurbidimetric.txt",
sep = "/"))
plaModel <- plaRBD(Data,
assayTitle = "PhEur: Antibiotic turbidimetric assay")
plaModel
plots
<- plot(plaModel)
Vancomycin
Antibiotic agar diffusion assay on 6 plates
Description
An "Antibiotic agar diffusion assay", but using 6 plates instead of 1 plate with 36 responses.
Usage
data("Vancomycin")
Examples
data(Vancomycin); Data <- Vancomycin
Data <- readAssayTable(paste(system.file(package = "pla"),
"vignettes/Miscellaneous/data/Vancomycin.txt",
sep = "/"))
Index
∗Topic datasets
AgarDiffusionAssay, 5
Corticotrophin, 10
Diphteria, 13
Erythromycin, 14
Erythropoietin, 15
FactorIX, 16
HeparinSodium, 17
HepatitisB, 18
HepatitisBvaccine, 19
HumanHepatitis, 19
IPV, 20
Nystatin, 21
Turbidimetric, 37
Vancomycin, 38
∗Topic design
Fiellers, 16
pheur325, 22
pla.fit, 23
pla.plots, 26
potency, 30
∗Topic hplot
plotSamples, 28
∗Topic method
assayModel-class, 6
∗Topic mich
assayTable2frame, 8
data2assayFrame, 11
jitterSteps, 21
readAssayTable, 30
∗Topic package
pla-package, 2
as.array,assayTable-method
(readAssayTable), 30
as.array,data.frame-method
(readAssayTable), 30
as.data.frame, 3, 12, 36
as.data.frame,assayFrame-method
(readAssayTable), 30
as.data.frame,assayTable-method
(readAssayTable), 30
as.data.frame,pla-method
(assayModel-class), 6
as.table, 3, 36
as.table,assayFrame-method
(readAssayTable), 30
as.table,assayTable-method
(readAssayTable), 30
assayData-class, 7
assayData-class (readAssayTable), 30
assayFrame-class, 7, 31, 36
assayFrame-class (readAssayTable), 30
assayModel-class, 6
assayTable-class, 7, 31, 36
assayTable-class (readAssayTable), 30
assayTable2frame, 3, 4, 7, 8, 24, 26, 34
AgarDiffusionAssay, 3, 4, 5, 21
anova,pla-method (assayModel-class), 6
anova,plaFit-method (pla.fit), 23
array, 3, 9
as.array, 3, 36
as.array,assayFrame-method
(readAssayTable), 30
data.frame, 3, 7–9, 12, 21, 22, 24, 26, 29, 36
data2assayFrame, 3, 4, 7–9, 11, 12, 22, 24, 26
dimnames, 9
Diphteria, 3, 13, 33
coef, 17
coef,pla-method (assayModel-class), 6
coef,plaFit-method (pla.fit), 23
confint,pla-method (assayModel-class), 6
confint,plaFit-method (pla.fit), 23
Corticotrophin, 3, 10
curve, 27
Erythromycin, 4, 14, 32
Erythropoietin, 3, 15, 32
39
40
factor, 12
FactorIX, 3, 16, 33
Fiellers, 16
fit, 3, 7
fit (pla.fit), 23
fitted,pla-method (assayModel-class), 6
fitted,plaFit-method (pla.fit), 23
ftable, 36
function, 7
HeparinSodium, 3, 17, 34
HepatitisB, 3, 18, 32, 33
HepatitisBvaccine, 3, 19, 33
hist, 26, 27
HumanHepatitis, 3, 19, 33
IPV, 3, 20, 33
jitterSteps, 3, 21, 29
lm, 7, 17, 22, 23, 29
lm.influence,pla-method
(assayModel-class), 6
lm.influence,plaFit-method (pla.fit), 23
mean, 36
numeric, 12
Nystatin, 3, 21
par, 27, 29
pheur325, 3, 4, 12, 22, 23
pla, 2, 3, 7, 8, 11, 12, 36
pla (assayModel-class), 6
pla-class, 7, 8, 24, 30
pla-class (assayModel-class), 6
pla-package, 2, 2, 8
pla.fit, 3, 4, 7–9, 11, 12, 23, 24, 26, 27
pla.plots, 3, 4, 7–9, 11, 12, 24, 26, 29
plaCRD, 7
plaCRD (assayModel-class), 6
plaCRD-class, 8
plaCRD-class (assayModel-class), 6
plaFit-class, 30
plaFit-class (pla.fit), 23
plaLSD, 7
plaLSD (assayModel-class), 6
plaLSD-class, 8
plaLSD-class (assayModel-class), 6
plaRBD, 7
INDEX
plaRBD (assayModel-class), 6
plaRBD-class, 8
plaRBD-class (assayModel-class), 6
plot, 3, 7, 24, 27, 29
plot,pla-method (assayModel-class), 6
plot,plaFit-method (pla.fit), 23
plotMoreSamples (plotSamples), 28
plotSamples, 3, 4, 27, 28
plotTwoSamples (plotSamples), 28
potency, 7, 12, 30
predict,pla-method (assayModel-class), 6
predict,plaFit-method (pla.fit), 23
print, 7, 36
print,assayFrame-method
(readAssayTable), 30
print,assayTable-method
(readAssayTable), 30
print,pla-method (assayModel-class), 6
print,plaFit-method (pla.fit), 23
qqnorm, 26, 27
read.table, 31
readAssayTable, 3, 4, 7, 9, 30
residuals,pla-method
(assayModel-class), 6
residuals,plaFit-method (pla.fit), 23
show, 7, 36
show,assayFrame-method
(readAssayTable), 30
show,assayTable-method
(readAssayTable), 30
summary,pla-method (assayModel-class), 6
summary,plaFit-method (pla.fit), 23
title, 24, 27, 29
Turbidimetric, 3, 32, 37
Vancomycin, 4, 38
vcov,pla-method (assayModel-class), 6
vcov,plaFit-method (pla.fit), 23