Skip to content

Commit f79e8c9

Browse files
MaelaLupocran-robot
authored andcommitted
version 1.4
1 parent ecda234 commit f79e8c9

9 files changed

Lines changed: 175 additions & 12 deletions

File tree

DESCRIPTION

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: AQuality
22
Type: Package
33
Title: Water and Measurements Quality
4-
Version: 1.3
5-
Date: 2025-03-29
4+
Version: 1.4
5+
Date: 2025-04-13
66
Authors@R: c(person("Maela", "Lupo", role = c("aut","cre"),
77
email = "maela.lupo@gmail.com"),
88
person("Andrea", "Porpatto", role = "aut"),
@@ -13,10 +13,10 @@ Author: Maela Lupo [aut, cre],
1313
Rosa Marzullo [aut],
1414
Alfredo Rigalli [aut]
1515
Maintainer: Maela Lupo <maela.lupo@gmail.com>
16-
Description: The functions proposed in this package allows to evaluate the process of measurement of the chemical components of water numerically or graphically. TSSS(), ICHS and datacheck() functions are useful to control the quality of measurements of chemical components of a sample of water. If one or more measurements include an error, the generated graph will indicate it with a position of the point that represents the sample outside the confidence interval. The function CI allows to evaluate the possibility of contamination of a water sample after being obtained.
16+
Description: The functions proposed in this package allows to evaluate the process of measurement of the chemical components of water numerically or graphically. TSSS(), ICHS and datacheck() functions are useful to control the quality of measurements of chemical components of a sample of water. If one or more measurements include an error, the generated graph will indicate it with a position of the point that represents the sample outside the confidence interval. The function CI() allows to evaluate the possibility of contamination of a water sample after being obtained. Validation() is a function that allows to calculate the quality parameters of a technique for the measurement of a chemical component.
1717
License: GPL-2
1818
NeedsCompilation: no
19-
Packaged: 2025-03-30 09:41:34 UTC; casa
19+
Packaged: 2025-04-13 11:48:24 UTC; tresalamos
2020
Depends: R (>= 3.5.0)
2121
Repository: CRAN
22-
Date/Publication: 2025-03-30 10:50:02 UTC
22+
Date/Publication: 2025-04-13 12:30:01 UTC

MD5

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
bec88062c2cd18ac9823e16d5109aac1 *DESCRIPTION
2-
91480228c9aa40edd45f5574f6028710 *NAMESPACE
1+
2ea9fef9febcdb992140f0029567c597 *DESCRIPTION
2+
106a026c8f3fbf2e05dc7efadd535996 *NAMESPACE
33
57df71854f9d20e5bb81f569a2caff7a *R/CI.R
44
103809aeed282972635851f5d94ee7bb *R/ICHS.R
55
b361026a09a12321b21905a1f51ba9d4 *R/TSSS.R
66
193f55a5e650ad49ac4122b2f4a1991a *R/datacheck.R
7-
0d3b90c89de973dd5ec9330ff94603b8 *build/partial.rdb
7+
479a8916ab93c34c2b463d6b7c220752 *R/validation.R
8+
2196502b5c4feb9990ef4ae3f6b02c9a *build/partial.rdb
89
479c3a95e2a30ebc729c2dde9a2d121f *data/dataCI.rda
910
3252ea586bda89faf3613e3a441be801 *data/dataICHS.rda
1011
af9db732e4e639fc6b77050344522716 *data/dataTSSS.rda
11-
5a33512290287cf3b024e6d31410bbae *man/AQuality-package.Rd
12+
86a962d93671145a7d7ab79d2ddf47e5 *data/datavalidation.rda
13+
ae254744b408d4bb883090352caeb8d7 *man/AQuality-package.Rd
1214
6d1d95bb7965d86260052a57ee5c0bc5 *man/CI.Rd
1315
61085bb171843e2721d8955a25a1891a *man/ICHS.Rd
1416
26dcb6adb22e16e5e0c421bacacfd0ef *man/TSSS.Rd
1517
ffa289e5dccf531512e103da990db0bc *man/dataCI.Rd
1618
cf60e866e7dca298ec30051bb20d227a *man/dataICHS.Rd
1719
dbdcdc1f871db6481122c7488ae6ecc9 *man/dataTSSS.Rd
1820
36b2c82eda02db128a3fd2dca23242c1 *man/datacheck.Rd
21+
d7a0fbb318b5ec496fc508877b075301 *man/datavalidation.Rd
22+
6600d5937c2b8288595a11f9b599ae6c *man/validation.Rd

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export("CI", "ICHS", "TSSS","datacheck")
1+
export("CI", "datacheck", "ICHS", "TSSS", "validation")
22
import(stats,graphics)

R/validation.R

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
validation <-
2+
function(datavalidation,numest=NULL,measurementunit=NULL,techniquename=NULL,date=Sys.Date(),graph=FALSE){
3+
4+
if(numest=='NULL'){
5+
stop('argument numest was avoided')
6+
}
7+
#linear regression with data from day=1
8+
curveday1<-lm(abs~concentration,data=datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),])
9+
10+
rcurveday1<-cor.test(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$abs,datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$concentration)
11+
Rsquare<- rcurveday1$estimate
12+
13+
day1<-datavalidation[datavalidation$day==1,]
14+
meanabs<-mean(day1$abs)
15+
meanconcentration<-mean(day1$concentration)
16+
sdabs<-sd(day1$abs)
17+
sdconcentration<-sd(day1$concentration)
18+
19+
sumabs<-c()
20+
for(i in 1:nrow(day1)){
21+
sumabs<-c(sumabs,(day1[i,3]-meanabs)^2)
22+
}
23+
sumabs<-sum(sumabs)
24+
sumconcentration<-c()
25+
for(i in 1:nrow(day1)){
26+
sumconcentration<-c(sumconcentration,(day1[i,2]-meanconcentration)^2)
27+
}
28+
sumconcentration<-sum(sumconcentration)
29+
SE<-sqrt(sumabs/(nrow(day1)-2))/sqrt(sumconcentration)
30+
31+
if(graph=='TRUE'){
32+
fcurveday1<-function(x){curveday1$coefficients[1]+curveday1$coefficients[2]*x}
33+
plot(0,0,type="n",xlim=c(min(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$concentration),max(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$concentration)),ylim=c(min(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$abs),max(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$abs)))
34+
plot(fcurveday1,min(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$concentration),max(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$concentration),lwd=2,col="blue")
35+
points(datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$concentration,datavalidation[datavalidation$day==1 & (datavalidation$tube=="s" | datavalidation$tube=="b"),]$abs,pch=20,col="red",cex=1.5)
36+
}
37+
#sensitivity calculation
38+
sensitivity=SE*100/curveday1$coefficients[2]
39+
# detection limit calculation
40+
LOD=mean(datavalidation[datavalidation$day==1 & datavalidation$tube=="b",]$abs)+3.3*sd(datavalidation[datavalidation$day==1 & datavalidation$tube=="b",]$abs)
41+
LOD= (LOD -curveday1$coefficients[1])/curveday1$coefficients[2]
42+
# cuantification limit calculation
43+
LOQ=mean(datavalidation[datavalidation$day==1 & datavalidation$tube=="b",]$abs)+10*sd(datavalidation[datavalidation$day==1 & datavalidation$tube=="b",]$abs)
44+
LOQ= (LOQ -curveday1$coefficients[1])/curveday1$coefficients[2]
45+
46+
# veracidad calculation
47+
V= abs(((mean(datavalidation[datavalidation$day==1 & datavalidation$tube=="qc",]$abs)-curveday1$coefficients[1])/curveday1$coefficients[2])-mean(datavalidation[datavalidation$day==1 & datavalidation$tube=="qc",]$concentration))*100/mean(datavalidation[datavalidation$day==1 & datavalidation$tube=="qc",]$concentration)
48+
49+
50+
# repetitivity calculation (CVr%)
51+
CVr= sd(datavalidation[datavalidation$day==1 & datavalidation$tube=="qc",]$abs)*100/mean(datavalidation[datavalidation$day==1 & datavalidation$tube=="qc",]$abs)
52+
53+
54+
#intermediate precision calculation (CVR%)
55+
CVR= sd(c(datavalidation[datavalidation$day==1 & datavalidation$tube=="qc",]$abs,datavalidation[datavalidation$day==2 & datavalidation$tube=="qc",]$abs,datavalidation[datavalidation$day==3 & datavalidation$tube=="qc",]$abs))*100/mean(c(datavalidation[datavalidation$day==1 & datavalidation$tube=="qc",]$abs,datavalidation[datavalidation$day==2 & datavalidation$tube=="qc",]$abs,datavalidation[datavalidation$day==3 & datavalidation$tube=="qc",]$abs))
56+
57+
58+
# summary
59+
writeLines(paste("Validation parameters technique: ", techniquename))
60+
writeLines(paste("slope: ", round(curveday1$coefficients[2],digits=2)))
61+
writeLines(paste("Linearity, R square = ", (trunc(Rsquare*1000))/1000))
62+
writeLines(paste("Sensitivity ", (trunc(sensitivity*100))/100, " %"))
63+
writeLines(paste("LOD ", (trunc(LOD*100))/100, measurementunit))
64+
writeLines(paste("LOQ ", (trunc(LOQ*100))/100, measurementunit))
65+
writeLines(paste("Accuracy ", 100-(trunc(V*100))/100, "%"))
66+
writeLines(paste("CVr% :intraassay repetitivity ", (trunc(CVr*100))/100, "%"))
67+
writeLines(paste("CVR% :interassay repetitivity ", (trunc(CVR*100))/100, "%"))
68+
writeLines(paste("linear range: ", (trunc(LOQ*100))/100, "-", max(day1$concentration), measurementunit))
69+
writeLines(paste("Uncertainty: Urel(%): ", trunc(2*sqrt((CVR/sqrt(3))^2+(V/sqrt(3))^2)*100)/100, "%"))
70+
}

build/partial.rdb

43 Bytes
Binary file not shown.

data/datavalidation.rda

345 Bytes
Binary file not shown.

man/AQuality-package.Rd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
\packageTitle{AQuality}
77
}
88
\description{The package allows you tu evaluate graphically the quality of measurements of water components}
9-
\details{The package includes four functions: TSSS(), ICHS(), datacheck() and CI(). The TSSS()function allows evaluating the quality of a set of measurement of water components, which correlate with total soluble solids. On the other hand, the ICHS() function allows evaluating the quality of a set of measurement of water components, which correlate with conductivity. The function CI allows to evaluate the possibility of contamination of a water sample after being obtained. The function datacheck indicates de registers of a database that do not match simultaneously correlation of mass summation of chemical components with total soluble solids and correlation of charge summation of chemical components with conductivity}
9+
\details{The package includes five functions: TSSS(), ICHS(), datacheck(), validation() and CI(). The TSSS()function allows evaluating the quality of a set of measurement of water components, which correlate with total soluble solids. On the other hand, the ICHS() function allows evaluating the quality of a set of measurement of water components, which correlate with conductivity. The function CI() allows to evaluate the possibility of contamination of a water sample after being obtained. The function datacheck indicates de registers of a database that do not match simultaneously correlation of mass summation of chemical components with total soluble solids and correlation of charge summation of chemical components with conductivity. The function validation() allows to calculate the quality parameters of a technique for the measurement of a chemical component.}
1010
\author{
1111
\packageAuthor{AQuality}
1212
Maintainer: Maela Lupo email: maela.lupo@gmail.com}
13-
\keyword{package}
13+
\keyword{package}

man/datavalidation.Rd

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
\name{datavalidation}
2+
\alias{datavalidation}
3+
\docType{data}
4+
\title{
5+
Data Sets~~
6+
}
7+
\description{
8+
Data.frame with data for calculating the quality parameters of a technique for the measurement of a chemical component of water with the validation() function. The data.frame includes concentration and absorbance measurement of standards of the calibration curve and a solution of known concentration, called quality control (qc). The data.frame includes measurements of the absorbance of the tube at three different days.
9+
Column 1: name of the tube. The tubes b, s1, s2,s3 and s4 represent different concentrations of a calibration curve.
10+
Column 2: concentration: the concentration of each tube, expressed in micrograms.
11+
Column 3: abs: absorbance of each tube which were measured spectrophotometrically.
12+
Column 4: day: the day when the measurement was done.
13+
}
14+
\usage{data("datavalidation")}
15+
\format{
16+
A data frame with 46 measurement of the following variables.
17+
\describe{
18+
\item{\code{tube}}{a character vector}
19+
\item{\code{concentration}}{a numeric vector}
20+
\item{\code{abs}}{a numeric vector}
21+
\item{\code{day}}{a numeric vector}
22+
}
23+
}
24+
25+
\examples{
26+
# Including data.frame: datavalidation in workspace.
27+
data("datavalidation")
28+
# Column names of data.frame: datavalidation
29+
names(datavalidation)
30+
# Data set type of columns of data.frame: datavalidation.
31+
str(datavalidation)
32+
# Calculation of quality parameters of the Total Kjeldhal Nitrogen (tkn) measurement technique
33+
validation(datavalidation,numest=4,measurementunit='ug',techniquename='tkn',graph=TRUE)
34+
}
35+
36+
\keyword{datasets}

man/validation.Rd

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
\name{validation}
2+
\alias{validation}
3+
\title{
4+
Quality parameters of a measurement technique
5+
}
6+
\description{
7+
Calculate the quality parameters of a technique for the measurement of a chemical component.
8+
}
9+
10+
\usage{
11+
validation(datavalidation, numest = NULL, measurementunit = NULL,
12+
techniquename = NULL, date = Sys.Date(), graph = FALSE)
13+
}
14+
15+
16+
\arguments{
17+
\item{datavalidation}{
18+
Data.frame with data for points of a calibration curve of five points, including a reagent blank and four standards. The data.frame also includes a solution of known concentration called quality control (qc). The columns include name of the tube, concentration, absorbance and day of measurement.
19+
}
20+
\item{numest}{
21+
The number of standards solution used for the calibration curve. This number do not include the reagen t blank.
22+
}
23+
\item{measurementunit}{
24+
The unit of measurement of the concentration.
25+
}
26+
\item{techniquename}{
27+
The name of the technique whose quality parameters are calculated.
28+
}
29+
\item{date}{
30+
The date when the procedure is performed.
31+
}
32+
\item{graph}{
33+
Graph argument allows to plot the calibration curve.
34+
}
35+
}
36+
37+
38+
\details{
39+
The validation() function calculates a set of quality parameters of a technique for the measurement of a chemical component. The function needs the values of a property (absorbance in the example) of standard solutions with different known concentration of one chemical component of water, measured in three different days. The function also needs the values of the property of a solution with a known concentration of the component, different from the standards of the calibration curve, which is called quality control solution (qc).
40+
}
41+
42+
43+
\value{
44+
The datavalidation() function returns a graph of the calibration curve if the argument graph takes the value TRUE. The function calculates and returns a list with the values of the slope of the calibration curve, the detection limit (LOD), the quantification limit (LOQ), correlation coefficient, sensitivity, accuracy, intraassay repetitivity, interassayrepetitivity, linear range and uncertainty.
45+
}
46+
47+
48+
\author{
49+
Maela Lupo, Alfredo Rigalli
50+
}
51+
52+
% \keyword{methods}
53+
% \keyword{misc}

0 commit comments

Comments
 (0)