genloq
uses given (or determines) threshold of the limit of quantification and substitutes string "LoQ"
of values below it.
genloq(x, y=NA, input="openair", output=NA, loq=NA, method="mle", distr="lnorm", pollutant=NA, plot=TRUE, ylim=c(NA,NA), columns=2, col.points="black", pch=1, xlab="Date", ylab="Concentration", main=NA)
"numeric"
or "character"
) or data frame of "genasis"/"openair" type with concentration column allowed to be of class "character"
. See 'Details' for more detailed description of both data types and the exceptions for genloq
function."openair"
(default) and "genasis"
with an exception of the column with concentration values, which could be of class "character"
. In case of vector input, this argument is meaningless.input
argument, both data frames "openair"
and "genasis"
are available, with the default value equal to input
."exc"
for exclusion, "1.0"
, "2.0"
, "sq2"
for substitution by constant and "mle"
for modified maximum likelihood method. See 'Details' for more detailed description of methods.method="mle"
(default), specifies if normal distr="norm"
or log-normal distr="lnorm"
distribution will be used for likelihood maximization.x
. If not specified, results for all pollutants are computed and plots for all pollutants are drawn in a multi-plot arrangement."numeric"
and length 2 setting the lower and upper border of the plot.output
argument settings with substituted (or eventually excluded) (concentration) values below limit of quantification. genloq
function substitutes values below the limit of quantification (LoQ) (equivalently the limit of detection (LoD)) marked as "loq", "LoQ" or "LOQ" in the x
. Although both data frames of types "openair" and "genasis" are defined with columns containing concentration values of class "numeric"
, it is necessary to mark values below LoQ as character string - thus here is an exception from the definition and both data types "openair" and "genasis", as well as vector x
could contain concentration values of class "character"
. See 'Examples' paragraph.
Thus the function recognises three different input formats: Option input="openair"
uses "openair" format of data frame with first column of name "date"
and class "Date"
, optional columns of names "date_end"
, "temp"
, "wind"
and "note"
and other columns of class "numeric"
or "character"
containing concentration values and named by names of the compounds. input="genasis"
is used for the data frame with six columns "valu"
, "comp"
, "date_start"
, "date_end"
, "temp"
and "wind"
where the first could be both "numeric"
or "character"
class, fifth and sixth are of class "numeric"
, second of class "character"
and third and fourth columns could be both "character"
or "Date"
class. The names of columns in input="genasis"
are not rigid, only their order is assumed. There is also a possibility to specify x
and y
as two vectors of equal lenght, first of class "numeric"
or "character"
containing concentration values, second of class "character"
or "Date"
containing measurement dates.
The output
argument specifies of which type the result will be. Both types of "data.frame"
class output="openair"
and output="genasis"
are available - now without any exceptions with all concentration values of class "numeric"
, the default value is equal to the input
argument, therefore the vector class of output is possible only if x
is "numeric"
or "character"
vector and output
is not specified.
There are five available methods of LoQs treatment. The simpliest method method="exc"
is not recommended because of high bias and meaningless approach. Standard constant methods method="1.0"
, method="2.0"
and method="sq2"
serve for substitution of (concentration) values below LoQ by value of LoQ divided gradually by 1 ,2 and square root of 2. The most recommended is the modified maximum likelihood method method="mle"
which will be described later.
genoutlier, genhistogram, genpastoact, genanaggr,
genplot, genstatistic, gentransform, genwhisker
## Definition of simple data sources:
c1<-rlnorm(100,0,1)
c2<-"random compound"
c3<-as.Date(as.Date("2013-01-01"):as.Date("2013-04-10"),
origin="1970-01-01")
c4<-c3+1
# Cuts the values below the 0.5.
c1[which(c1<0.5)]<-"LoQ"
sample_genasis<-data.frame(c1,c2,c3,c4)
sample_openair<-data.frame(c4,c1)
colnames(sample_openair)=c("date",c2)
## Examples of different usages:
genloq(c1,c3,pollutant=c2,method="sq2")
genloq(sample_openair,method="mle")
Run the code above in your browser using DataLab