crm.plot: Plot Results of Control Reference Material (CRM) Analyses

Description Usage Arguments Details Note Author(s) See Also Examples

Description

Function to plot the results of Control Reference Material (CRM) analyses in the order in which they occur in a file, assuming that this order is a time-series, so that the presence of ‘drift’ may be recognized, in addition to the presence of gross outliers reflecting ‘analytical problems’. The data are plotted as either values, when the associated standard deviation of the CRM is provided, or percent absolute relative difference from the ‘recommended’ value when a target tolerance level is provided (see below). The expected ‘recommended’ value (long-term mean) for the CRM being displayed must be supplied, together with its associated standard deviation, or a target tolerance level for percent absolute relative difference. By default the CRM recommended value and standard deviation are used to plot red dashed lines at the recommended value +/- 2 standard deviations, and a green line for the recommended value, alternate standard deviation multiples may be provided. This display is also known as a Shewart plot.

Usage

1
2
crm.plot(xx, xname = deparse(substitute(xx)), crm.mean = NULL, 
	crm.sd = NULL, n.sd = 2, crm.tol = NULL, ...)

Arguments

xx

a column vector of determinations from a data frame or matrix for a measured parameter on a CRM.

xname

a title can be displayed with the plot and results, e.g., xname = "Cu (mg/kg)". If this field is undefined the character string for xx is used as a default.

crm.mean

the recommended value for the CRM. A value must be provided, otherwise the function will terminate.

crm.sd

the standard deviation associated with the recommended value for the CRM. Appropriate red dotted control lines are plotted above and below the mean.

n.sd

by default 2 standard deviation limits are used on the Shewart plot, alternate values may be supplied.

crm.tol

optionally a percentage tolerance level my be provided for the maximum acceptable absolute relative percent difference from the CRM recommended value, in which case a red dotted control line is added to the plot.

...

any additional arguments to be passed to the plot function for titling, etc.

Details

Either a standard deviation for the CRM analyses or an upper limit tolerance level must be provided, otherwise the function will fail. If both are provided an percentage absolute relative difference plot is displayed.

Where the input data file contains determinations for more than one CRM, either a subset for the CRM of interest must be created, e.g., with gx.subset, or the R construct Cu[CRM=="X"] must be used to pass the data to the function.

Note

Any less than detection limit values represented by negative values, or zeros or other numeric codes representing blanks in the data, must be removed prior to executing this function, see ltdl.fix.df.

Author(s)

Robert G. Garrett

See Also

ltdl.fix.df

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Make test data available
data(crm.test)
attach(crm.test)

## Plot CRM analyses time-series for CRM-X using the CRM SD estimate
## and the default 2 SD tolerance bounds
crm.plot(Cu[CRM=="X"], "Cu(mgkg) in CRM-X", crm.mean = 34.5, crm.sd = 2.19)

## Plot CRM analyses time-series for CRM-X using the CRM SD estimate
## and 2.5 SD tolerance bounds
crm.plot(Cu[CRM=="X"], "Cu(mg/kg) in CRM-X", crm.mean = 34.5, crm.sd = 2.19,
n.sd = 2.5)

## Plot CRM analyses time-series for CRM-X using a maximum acceptable
## percantage tolerance bound
crm.plot(Cu[CRM=="X"], "Cu(mg/kg) in CRM-X", crm.mean = 34.5, crm.tol = 15)

## Detach test data
detach(crm.test)

Example output

Loading required package: MASS
Loading required package: fastICA
 Control Reference Material: Cu(mgkg) in CRM-X 
				  Mean = 34.5 	 SD = 2.19 	 N.SD = 2 	Percent tolerance = 
 This project:	 N = 25 	  Mean = 36.1 	 SD = 1.38 	 RSD% = 3.82 
				Median = 35.8 	MAD = 1.41 	rRSD% = 3.93 
 Control Reference Material: Cu(mg/kg) in CRM-X 
				  Mean = 34.5 	 SD = 2.19 	 N.SD = 2.5 	Percent tolerance = 
 This project:	 N = 25 	  Mean = 36.1 	 SD = 1.38 	 RSD% = 3.82 
				Median = 35.8 	MAD = 1.41 	rRSD% = 3.93 
 Control Reference Material: Cu(mg/kg) in CRM-X 
				  Mean = 34.5 	 SD = 	 N.SD = 	Percent tolerance = 15 
 This project:	 N = 25 	  Mean = 36.1 	 SD = 1.38 	 RSD% = 3.82 
				Median = 35.8 	MAD = 1.41 	rRSD% = 3.93 

rgr documentation built on May 2, 2019, 6:09 a.m.

Related to crm.plot in rgr...