package ‘pla’

40
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 ......................................... 2 AgarDiffusionAssay .................................... 5 assayModel-class ...................................... 6 assayTable2frame ...................................... 8 Corticotrophin ........................................ 10 data2assayFrame ...................................... 11 Diphteria .......................................... 13 Erythromycin ........................................ 14 Erythropoietin ........................................ 15 1

Upload: others

Post on 18-Dec-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

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 beperformed (with computation of Fieller's confidence intervals forthe estimated potency), or imputation of values can be applied.The package contains a script such that a pdf-document with areport of an analysis of an assay can be produced from an input filewith 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2AgarDiffusionAssay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5assayModel-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6assayTable2frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Corticotrophin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10data2assayFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Diphteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Erythromycin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Erythropoietin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

1

2 pla-package

FactorIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Fiellers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16HeparinSodium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17HepatitisB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18HepatitisBvaccine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19HumanHepatitis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19IPV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20jitterSteps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Nystatin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21pheur325 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22pla.fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23pla.plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26plotSamples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28potency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30readAssayTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Turbidimetric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Vancomycin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

Index 39

pla-package 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 ofFieller’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 canbe produced from an input file with data of the assay just by entering the name of the input-file. Hereno 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 ofR and the pla-package.

Details

Package: plaType: PackageVersion: 0.2Date: 2015-09-09License: GPL (>= 2)

pla-package 3

Contents:

• readAssayTable: Reads (.txt) files with responses of assays, entered as matrices with rows ofmeasurements 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 arefound in the folder .../pla/vignettes/'Source'/data/.

– assayTable2frame: An array with the responses of an assay is transformed to a data.framefor 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 missingvalues 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 thePh.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 corti-cotrophin by subcutaneous injection in rats: Corticotrophin

– 5.1.2. Three-dose latin square design; Antibiotic agar diffusion assay using a rectangulartray: 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 transforma-tion; 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 transfor-mation; explicit ratio notation; FactorIX,

– Example 5 - Three-dose parallel line assay; completely randomized; custom transforma-tion; explicit content notation; HeparinSodium,

– Example 7 - Five-dose parallel line assay; completely randomized; logarithmic transfor-mation; explicit ratio notation; HepatitisBvaccine,

– Example 8 - Four-dose parallel line assay; completely randomized; square root transfor-mation; explicit content notation; HumanHepatitis (Human Hepatitis A immunoglobu-lin),

– Example 10 - Four-dose parallel line assay; completely randomized; logarithmic trans-formation; explicit ratio notation; IPV (Inactivated Poliomyelitis Vaccine).

– Example 15 - Five-dose multiple assay; randomized block design; explicit ratio notationNystatin,

4 pla-package

– Example 22 - Three-dose parallel line assay at three independent occasions; randomizedblock; symbolic notation; Erythromycin,

• Other example: Vancomycin.

The two main functions are pla.fit and pla.plots, which expects data in the format as returned byassayTable2frame 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.plotsis to look into data2assayFrame and AgarDiffusionAssay. The column names Response, Dilution,Sample, Replicate, Row, and Column of the input for data2assayFrame cannot be changed. Rowand 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 frompla.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 CombiStatsin 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 andIntralitter variation in rats with respect to the healing of rachitic bones by vitamin D. PharmaceuticalSociety, London.

Fieller, E.C.: The biological standardization of insulin. Supplement to the Journal of the RoyalStatistical Society. 1940; Vol. VII., No. 1.

Bliss, C.I. (1952): The Statistics of Bioassay - with special reference to the vitamin. AcademicPress, New York.

Arthur Linder, Genova, Switzerland (1964): Statistics of Bioassays, Notes on lectures held duringthe 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 potencyof 5600 IU/mg. For the stock solutions 25.2 mg of the standard is dissolved in 24.5 ml of solvent and21.4 mg of the test preparation is dissolved in 23.95 ml of solvent. The final solutions are preparedby first diluting both stock solutions to 1/20 and further using a dilution ratio of 1.5. A Latin squareis generated with the method described in Section 8.6 (see Table 5.1.2.-I). The responses of thisroutine assay are shown in Table 5.1.2.-II (inhibition zones in mm x 10). The treatment meanvalues 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 <- AgarDiffusionAssayAgar <- 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.frameas 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 datadata. 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 confi-dence intervals, default 0.05. See pla.fit.

dfAdjustment The needed adjustment of the number of degrees of freedom, if e.g. data are cor-rected for blocks, rows or columns before applying the model of the completelyrandomized 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 thethree-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", "random-ized 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 re-turns 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 thesefunctions. 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, andadding 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. Thepreference 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, andthe value neither is found in the argument object with data, then a default value, "crd", 0 or 1, isused. 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 imputeMissingto 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 performedas 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 slotin 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. AcademicPress, New York.

See Also

pla-package

assayTable2frame Expand table to matrix of measurements by variables - for pla.fit andpla.plots

Description

A table, that is, a 2-dimensional array, with the responses of an experiment is transformed for intoa matrix, a data.frame, with rows for the individual measurements and columns the variables andfactors 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 ofas.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. Seealso 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 dilutionsteps - for tables read by readAssayTable with the single repetition over severallines. If FALSE then the 'dose' is extracted from the dimnames of the tableand as well Dilution and Z is given this value.

echoData If TRUE then the data is shown with means, standard deviations and coefficientsof variations of columns.

... For additional arguments.

Details

This function is used on table of data read by readAssayTable. The table of responses is trans-formed 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 crossclassification samples and dilutions.

Value

A data.frame with rows of individual observations and columns of treatments, dilution step num-bers, 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 thecolumn-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 argumentbyOrder is set to FALSE.

Sample names (and "doses") are extracted from the second item of dimnames of the table. If thissecond 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 dilutionstepamong 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 eachname 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 preparationsto be examined are both assumed to have a potency of 1 unit per milligram and they are administeredin the same quantities as the standard. The individual responses and means per treatment are givenin Table 5.1.1.-I. A graphical presentation (Figure 5.1.1.I) gives no rise to doubt the homogeneityof 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")plaModelplots <- 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 (orRow 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 columnReplicate 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 theargument dataframe.

Details

This function is used internally in pla to check the dataframe that can be given with the data forpla.fit. It can also be used to prepare a dataframe for direct call of pla.fit. Relevant columns areadded 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. Zis 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 serienot is used, the anova-table and plots might be useful, but not the slope and potency computed bypheur325 and thus by pla.fit.

Sample and Step are transformed to numerics from possible factors (with the orderings of thelevels of these factors), and the order of Sample and Step are then reverted. This might give someconfusion. data2assayFrame is called from pla, if a data.frame is found as the argument, or as therelevant slot in an argument with this slot. Use as.data.frame on the pla-object to view data data asgoing 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 <- read.table("./pla/vignettes/PhEur/data/AntibioticAgarDiffusionAssay.txt",# header = TRUE)Agar <- AgarDiffusionAssayDesign <- "lsd"select <- c("Row", "Column", "Sample", "Dilution", "Response")Frame <- data2assayFrame(Agar[, select])

fits <- 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; ex-plicit 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); plaModelplots <- 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); plaModelplots <- plot(plaModel)

Erythropoietin 15

Erythropoietin Erythropoietin rDNA - Normocythaemic assay in mice

Description

Example 02 - Three-dose parallel line assay; randomized block; explicit content notation, fromCombiStats - 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); plaModelplots <- 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); plaModelplots <- 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 RoyalStatistical 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; ex-plicit 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); plaModelplots <- 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. Aftersome additional steps in the assay procedure, absorbance’s were measured. They are shown inTable 5.1.4.-I. The logarithms of the optical densities are known to have a linear relationship withthe logarithms of the doses. The mean responses of the ln-transformed optical densities are listedin 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

plaModelplots <- 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); plaModelplots <- 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); plaModelplots <- 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); plaModelplots <- 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 inplots.

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 CombiS-tats - EDQM, Council of Europe (http://combistats.edqm.eu). 5.1.2. THREE-DOSE LATINSQUARE DESIGN

Usage

data("Nystatin")

Details

The data is the same as AgarDiffusionAssay, but here with CombiStats as source, and put into anobject.

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 theSums Of Squares computed by lm).

If complete data analyses is performed, then the slope and contrasts of intercepts are returned formthe 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 theslope 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 A character string giving the name of the response column of data.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 forlabels 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 inputdata.

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 arecorrected for blocks, rows or columns, or if values are imputed before applyingthe 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 RoyalStatistical 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 testsof regression, parallelism and linearity. The anova table can also have test of effect of blocks forRandomized 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 argu-ments for pla.fit are extracted from the object when using fit(object, ...).

data The data.frame with relevant variables - created by data2assayFrame or as-sayTable2frame.

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", "Ran-domized 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 cor-rected for blocks, rows or columns before applying the model of the completelyrandomized 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 forlabels 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 inputdata 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 formatfor 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 arereported.

sink Output is diverted to paste(tag, "-Result.txt", sep = "") if this booleanis 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 ofRegression, Linearity, Parallelism, and the complementary probabilityalpha of the Confidence interval of the potency. If more than one probabil-ity is supplied for one test of validity, then "Unknown" is reported for tests withprobability 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 modelwith individual fits for each combination of sample and dose can be displayed, on the scale ofobserved values, or corrected for the mean of the values for the dilution step. Finally residuals canbe 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 data2assayFrameor assayTable2frame - as for pla.fit.

sampleLabels A vector of character strings giving the labels of the samples, standard andtest-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 returnedvalues.

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 forSweave.

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 andthe 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", "unre-stricted", "twoway", "stepadjusted", "qplot", "histogram", "residualsSamples","residualsBoxSampleStep", "residualsBoxSample", "residualsRow", "residuals-Column", "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 andslopes 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 forunrestricted 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 returnthe table and labels in an object.

The function reads either a matrix of measurement by variable (a ’data.frame’), or a table with themeasured 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-factorsfound in the file.

columns A character string: A warning is given, if this does not match the column-factorsfound in the file.

replicateNames A vector of text strings with permitted names for the factor of replicates. Thesecannot 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. Doseand 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 seesome examples of data-files. The file .../pla/scripts/data/AssayTable.txt shows a verysimple 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 objectis of class assayFrame-class, else a table with the measured variable (an ’array’) is expected, andthen 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 byreplicate-, repetition-, plate-, or block-number, used for Erythromycin, Erythropoietin, and Turbidi-metric:

Block S1 S2 S3 T1 T2 T3 Label

Block-1 185 192 210 172 201 214 ""Block-2 185 199 216 178 205 212 ""Block-3 174 200 211 185 196 216 ""Block-4 175 198 216 184 196 208 ""Block-5 185 201 211 175 201 218 ""Block-6 180 194 211 178 197 214 ""

# Model . . . . . "Parallel lines"# Design . . . . . "Randomized block"# DilutionRatio . . . . . "1.5"# ResultOfAssay . . . . . "Example 22: Erythromycin"# Project . . . . . "CombiStats - EDQM, Council of Europe"# Description . . . . . "Three-dose parallel line assay ..."...

For data entered as this table for the measurements, the header line, first record or row, of the filegives the names of the treatments (samples and dilution-steps) together with the name of at leastone factor variating over the rows.

Columns should then contain the replicates of responses for the individual treatments (cross classi-fication of samples and dilution-steps), rows of the file the responses for different samples and dosesfor 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 sam-ples and dilution-steps), and rows of the file replicates of the response, samples are named by asingle letter ("S", "T", "U", ...) and dilution steps by a single digit, and the header thus are textstrings 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 morelines, 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 isnot so simple (though only a few ’hacks’ are necessary), but especially this documentation getscomplicated:

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 replicatenumbers. A column Dose and a column Sample is then used for naming treatments.

Dose Sample R1 R2 R3 R4 Label

Dose-0.05 S 0 0 1 0 ""Dose-0.1 S 2 3 2 2 ""

readAssayTable 33

Dose-0.2 S 4 4 3 4 ""

Dose-0.02 T 1 1 0 1 ""Dose-0.04 T 2 2 2 2 ""Dose-0.08 T 2 4 4 4 ""

# Model . . . . "Parallel lines"# Design . . . . "Completely randomised"# ResultOfAssay . . . . "Example 1: Diphteria"# Project . . . . "CombiStats - EDQM, Council of Europe"# Description . . . . "Three-dose parallel line assay; explicit volume units"...

1. alternative: Rows identified by the cross classification of sample and dose, and columns identifiedby replicate-, repetition-, plate-, or block-number:

If the keyword "Dose" is used in the first column (together with a dose or step number) and acolumn is used to identify "sample", then the lines are expected to have the replicates for thecross-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 S 0.043 0.093 0.159 0.283 0.514 ""Replicate-2 S 0.045 0.099 0.154 0.295 0.531 ""Replicate-3 S 0.051 0.082 0.166 0.362 0.545 ""Replicate-1 T 0.097 0.167 0.327 0.501 1.140 ""Replicate-2 T 0.097 0.157 0.355 0.665 1.386 ""Replicate-3 T 0.094 0.178 0.345 0.576 1.051 ""Replicate-1 U 0.086 0.127 0.277 0.586 0.957 ""Replicate-2 U 0.071 0.146 0.268 0.489 0.866 ""Replicate-3 U 0.073 0.133 0.269 0.546 1.045 ""Replicate-1 V 0.082 0.145 0.318 0.552 1.037 ""Replicate-2 V 0.082 0.144 0.306 0.551 1.039 ""Replicate-3 V 0.086 0.173 0.316 0.624 1.068 ""

# Model . . . . . "Parallel lines"# Design . . . . . "Completely randomised"# ResultOfAssay . . . . . "Three hepatitis B vaccines against a standard"# Project . . . . . "Europ. Pharm., 5th Ed. (2005), Ch. 5.3, 5.1.4.a"# Description . . . . . "Five-Dose Multiple Assay" ...

34 readAssayTable

For HeparinSodium a special form of the above is used with an "inner" factor:

Dose Sample R-1:I-y R-1:I-z R-2:I-y R-2:I-z Label

Dose-1.044 S 78.9 79.8 79.0 79.1 ""Dose-1.321 S 108.2 113.1 119.1 122.5 ""Dose-1.670 S 176.9 180.1 173.6 169.8 ""Dose-1.000 T 79.8 76.4 78.9 78.7 ""Dose-1.265 T 107.2 106.5 117.7 117.3 ""Dose-1.600 T 168.2 171.4 179.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 thecolumns (by assayTable2frame when byOrder is TRUE, the default). Please note that the labels ofthe dilution steps are then ignored.

These three above alternatives covers half of the six possibilities of the layout of the table ofresponses: Three cases with columns determined by one of the tree factors sample, dose andreplicate (block , plate, repetition, ...), and three cases with the columns determined by thecross classification of two of the three factors.

The first found word of the header gives one of one or more factors determination the rows. Thisword should also be a part of the first word of the rows of the table (to separate the data-table fromthe from the options). Other names in the header not found in the 'Names' arguments determinatethe 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 identi-cal.

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 mea-surements and columns of variables and factors is expected. This is used for latin square designs.

Column Row Sample Dilution Response1 1 S 1 1611 2 T 1 151

readAssayTable 35

1 3 T 2 1621 4 S 3 1941 5 S 2 1761 6 T 3 1932 1 T 1 1602 2 T 3 1922 3 S 3 1952 4 S 2 1842 5 T 2 1812 6 S 1 1663 1 T 2 1783 2 S 1 1503 3 S 2 1743 4 T 3 1993 5 S 3 2013 6 T 1 1614 1 S 3 1874 2 S 2 1724 3 S 1 1614 4 T 1 1604 5 T 3 2024 6 T 2 1865 1 S 2 1715 2 T 2 1705 3 T 3 1935 4 S 1 1635 5 T 1 1545 6 S 3 1986 1 T 3 1946 2 S 3 1926 3 T 1 1516 4 T 2 1716 5 S 1 1516 6 S 2 182

# Model . . "Parallel lines"# Design . . "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 thelabel-field in lines after the response values.

The first character in these lines has to be "#" when a "matrix" of measurements by variables isentered. 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.arrayand as.table has the arguments reduced and selectFun. With the boolean argument reduced thefactor of sample and factor of dilution are combined, with output similar to using row.vars forftable, but labels of dose can then be different across samples. The function selectFun shouldwork on the array of all the read factors. For objects of class assayFrame-class also the argumentswhich, FUN and responseName are available. which gives the factors to determined the array, eitherby indices, or names by text strings. The function is by default mean, and is used to calculate thevalue 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")Diphteriaprint(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")

Nystatinprint(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 anassigned potency of 670 IU/mg. The test preparation has an assumed potency of 20 000 IU/vial. Onthe basis of this information the stock solutions are prepared as follows. 16.7 mg of the standard isdissolved in 25 ml solvent and the contents of one vial of the test preparation are dissolved in 40 mlsolvent. 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). Theresponses are listed in Table 5.1.3.-I. Inspection of Figure 5.1.3.-I gives no rise to doubt the validityof the assumptions of normality and homogeneity of variance of the data. The standard deviationof 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")

plaModelplots <- 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 datasetsAgarDiffusionAssay, 5Corticotrophin, 10Diphteria, 13Erythromycin, 14Erythropoietin, 15FactorIX, 16HeparinSodium, 17HepatitisB, 18HepatitisBvaccine, 19HumanHepatitis, 19IPV, 20Nystatin, 21Turbidimetric, 37Vancomycin, 38

∗Topic designFiellers, 16pheur325, 22pla.fit, 23pla.plots, 26potency, 30

∗Topic hplotplotSamples, 28

∗Topic methodassayModel-class, 6

∗Topic michassayTable2frame, 8data2assayFrame, 11jitterSteps, 21readAssayTable, 30

∗Topic packagepla-package, 2

AgarDiffusionAssay, 3, 4, 5, 21anova,pla-method (assayModel-class), 6anova,plaFit-method (pla.fit), 23array, 3, 9as.array, 3, 36as.array,assayFrame-method

(readAssayTable), 30

as.array,assayTable-method(readAssayTable), 30

as.array,data.frame-method(readAssayTable), 30

as.data.frame, 3, 12, 36as.data.frame,assayFrame-method

(readAssayTable), 30as.data.frame,assayTable-method

(readAssayTable), 30as.data.frame,pla-method

(assayModel-class), 6as.table, 3, 36as.table,assayFrame-method

(readAssayTable), 30as.table,assayTable-method

(readAssayTable), 30assayData-class, 7assayData-class (readAssayTable), 30assayFrame-class, 7, 31, 36assayFrame-class (readAssayTable), 30assayModel-class, 6assayTable-class, 7, 31, 36assayTable-class (readAssayTable), 30assayTable2frame, 3, 4, 7, 8, 24, 26, 34

coef, 17coef,pla-method (assayModel-class), 6coef,plaFit-method (pla.fit), 23confint,pla-method (assayModel-class), 6confint,plaFit-method (pla.fit), 23Corticotrophin, 3, 10curve, 27

data.frame, 3, 7–9, 12, 21, 22, 24, 26, 29, 36data2assayFrame, 3, 4, 7–9, 11, 12, 22, 24, 26dimnames, 9Diphteria, 3, 13, 33

Erythromycin, 4, 14, 32Erythropoietin, 3, 15, 32

39

40 INDEX

factor, 12FactorIX, 3, 16, 33Fiellers, 16fit, 3, 7fit (pla.fit), 23fitted,pla-method (assayModel-class), 6fitted,plaFit-method (pla.fit), 23ftable, 36function, 7

HeparinSodium, 3, 17, 34HepatitisB, 3, 18, 32, 33HepatitisBvaccine, 3, 19, 33hist, 26, 27HumanHepatitis, 3, 19, 33

IPV, 3, 20, 33

jitterSteps, 3, 21, 29

lm, 7, 17, 22, 23, 29lm.influence,pla-method

(assayModel-class), 6lm.influence,plaFit-method (pla.fit), 23

mean, 36

numeric, 12Nystatin, 3, 21

par, 27, 29pheur325, 3, 4, 12, 22, 23pla, 2, 3, 7, 8, 11, 12, 36pla (assayModel-class), 6pla-class, 7, 8, 24, 30pla-class (assayModel-class), 6pla-package, 2, 2, 8pla.fit, 3, 4, 7–9, 11, 12, 23, 24, 26, 27pla.plots, 3, 4, 7–9, 11, 12, 24, 26, 29plaCRD, 7plaCRD (assayModel-class), 6plaCRD-class, 8plaCRD-class (assayModel-class), 6plaFit-class, 30plaFit-class (pla.fit), 23plaLSD, 7plaLSD (assayModel-class), 6plaLSD-class, 8plaLSD-class (assayModel-class), 6plaRBD, 7

plaRBD (assayModel-class), 6plaRBD-class, 8plaRBD-class (assayModel-class), 6plot, 3, 7, 24, 27, 29plot,pla-method (assayModel-class), 6plot,plaFit-method (pla.fit), 23plotMoreSamples (plotSamples), 28plotSamples, 3, 4, 27, 28plotTwoSamples (plotSamples), 28potency, 7, 12, 30predict,pla-method (assayModel-class), 6predict,plaFit-method (pla.fit), 23print, 7, 36print,assayFrame-method

(readAssayTable), 30print,assayTable-method

(readAssayTable), 30print,pla-method (assayModel-class), 6print,plaFit-method (pla.fit), 23

qqnorm, 26, 27

read.table, 31readAssayTable, 3, 4, 7, 9, 30residuals,pla-method

(assayModel-class), 6residuals,plaFit-method (pla.fit), 23

show, 7, 36show,assayFrame-method

(readAssayTable), 30show,assayTable-method

(readAssayTable), 30summary,pla-method (assayModel-class), 6summary,plaFit-method (pla.fit), 23

title, 24, 27, 29Turbidimetric, 3, 32, 37

Vancomycin, 4, 38vcov,pla-method (assayModel-class), 6vcov,plaFit-method (pla.fit), 23