diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R index c5b90f56..ef25dc00 100755 --- a/R/guess_ab_col.R +++ b/R/guess_ab_col.R @@ -21,7 +21,7 @@ #' Guess antibiotic column #' -#' This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. You can look for an antibiotic (trade) of abbreviation and it will search the data for any column containing a name or ATC code of that antibiotic. +#' This tries to find a column name in a data set based on information from the \code{\link{antibiotics}} data set. You can look for an antibiotic (trade) name or abbreviation and it will search the \code{data.frame} for any column containing a name or ATC code of that antibiotic. #' @param tbl a \code{data.frame} #' @param col a character to look for #' @param verbose a logical to indicate whether additional info should be printed diff --git a/R/resistance_predict.R b/R/resistance_predict.R index b52eaa4c..6caab1d0 100755 --- a/R/resistance_predict.R +++ b/R/resistance_predict.R @@ -25,23 +25,23 @@ #' @inheritParams first_isolate #' @param col_ab column name of \code{tbl} with antimicrobial interpretations (\code{R}, \code{I} and \code{S}) #' @param col_date column name of the date, will be used to calculate years if this column doesn't consist of years already -#' @param year_min lowest year to use in the prediction model, dafaults the lowest year in \code{col_date} -#' @param year_max highest year to use in the prediction model, defaults to 15 years after today +#' @param year_min lowest year to use in the prediction model, dafaults to the lowest year in \code{col_date} +#' @param year_max highest year to use in the prediction model, defaults to 10 years after today #' @param year_every unit of sequence between lowest year found in the data and \code{year_max} #' @param minimum minimal amount of available isolates per year to include. Years containing less observations will be estimated by the model. #' @param model the statistical model of choice. Valid values are \code{"binomial"} (or \code{"binom"} or \code{"logit"}) or \code{"loglin"} or \code{"linear"} (or \code{"lin"}). -#' @param I_as_R treat \code{I} as \code{R} -#' @param preserve_measurements logical to indicate whether predictions of years that are actually available in the data should be overwritten with the original data. The standard errors of those years will be \code{NA}. -#' @param info print textual analysis with the name and \code{\link{summary}} of the model. +#' @param I_as_R a logical to indicate whether values \code{I} should be treated as \code{R} +#' @param preserve_measurements a logical to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be \code{NA}. +#' @param info a logical to indicate whether textual analysis should be printed with the name and \code{\link{summary}} of the statistical model. #' @return \code{data.frame} with columns: #' \itemize{ #' \item{\code{year}} #' \item{\code{value}, the same as \code{estimated} when \code{preserve_measurements = FALSE}, and a combination of \code{observed} and \code{estimated} otherwise} -#' \item{\code{se_min}, the lower bound of the standard error with a minimum of \code{0}} -#' \item{\code{se_max} the upper bound of the standard error with a maximum of \code{1}} -#' \item{\code{observations}, the total number of observations, i.e. S + I + R} -#' \item{\code{observed}, the original observed values} -#' \item{\code{estimated}, the estimated values, calculated by the model} +#' \item{\code{se_min}, the lower bound of the standard error with a minimum of \code{0} (so the standard error will never go below 0\%)} +#' \item{\code{se_max} the upper bound of the standard error with a maximum of \code{1} (so the standard error will never go above 100\%)} +#' \item{\code{observations}, the total number of available observations in that year, i.e. S + I + R} +#' \item{\code{observed}, the original observed resistant percentages} +#' \item{\code{estimated}, the estimated resistant percentages, calculated by the model} #' } #' @seealso The \code{\link{portion}} function to calculate resistance, \cr \code{\link{lm}} \code{\link{glm}} #' @rdname resistance_predict @@ -182,7 +182,7 @@ resistance_predict <- function(tbl, year_min <- max(year_min, year_lowest, na.rm = TRUE) } if (is.null(year_max)) { - year_max <- year(Sys.Date()) + 15 + year_max <- year(Sys.Date()) + 10 } years_predict <- seq(from = year_min, to = year_max, by = year_every) diff --git a/docs/index.html b/docs/index.html index 347bc253..d5063da5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -232,16 +232,23 @@
This package contains the complete microbial taxonomic data (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, https://www.itis.gov).
All ~20,000 (sub)species from the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package, as well as all ~2,500 previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
Read more about ITIS in our manual.
+The AMR
package basically does four important things:
as.mo()
to get an ID of a microorganism. The IDs are human readable for the trained eye - the ID of Klebsiella pneumoniae is “B_KLBSL_PNE” (B stands for Bacteria) and the ID of S. aureus is “B_STPHY_AUR”. The function takes almost any text as input that looks like the name or code of a microorganism like “E. coli”, “esco” and “esccol”. Even as.mo("MRSA")
will return the ID of S. aureus. Moreover, it can group all coagulase negative and positive Staphylococci, and can transform Streptococci into Lancefield groups. To find bacteria based on your input, it uses Artificial Intelligence to look up values in the included ITIS data, consisting of more than 18,000 microorganisms.as.mo()
to get an ID of a microorganism. The IDs are human readable for the trained eye - the ID of Klebsiella pneumoniae is “B_KLBSL_PNE” (B stands for Bacteria) and the ID of S. aureus is “B_STPHY_AUR”. The function takes almost any text as input that looks like the name or code of a microorganism like “E. coli”, “esco” or “esccol” and tries to find expected results using artificial intelligence (AI) on the included ITIS data set, consisting of almost 20,000 microorganisms. It is very fast, please see our benchmarks. Moreover, it can group Staphylococci into coagulase negative and positive (CoNS and CoPS, see source) and can categorise Streptococci into Lancefield groups (like beta-haemolytic Streptococcus Group B, source).as.rsi()
to transform values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like “<=0.002; S” (combined MIC/RSI) will result in “S”.as.mic()
to cleanse your MIC values. It produces a so-called factor (called ordinal in SPSS) with valid MIC values as levels. A value like “<=0.002; S” (combined MIC/RSI) will result in “<=0.002”.as.atc()
to get the ATC code of an antibiotic as defined by the WHO. This package contains a database with most LIS codes, official names, DDDs and even trade names of antibiotics. For example, the values “Furabid”, “Furadantin”, “nitro” all return the ATC code of Nitrofurantoine.This tries to find a column name in a data set based on information from the antibiotics
data set. You can look for an antibiotic (trade) of abbreviation and it will search the data for any column containing a name or ATC code of that antibiotic.
This tries to find a column name in a data set based on information from the antibiotics
data set. You can look for an antibiotic (trade) name or abbreviation and it will search the data.frame
for any column containing a name or ATC code of that antibiotic.
lowest year to use in the prediction model, dafaults the lowest year in col_date
lowest year to use in the prediction model, dafaults to the lowest year in col_date
highest year to use in the prediction model, defaults to 15 years after today
highest year to use in the prediction model, defaults to 10 years after today
treat I
as R
a logical to indicate whether values I
should be treated as R
logical to indicate whether predictions of years that are actually available in the data should be overwritten with the original data. The standard errors of those years will be NA
.
a logical to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be NA
.
print textual analysis with the name and summary
of the model.
a logical to indicate whether textual analysis should be printed with the name and summary
of the statistical model.
data.frame
with columns:
year
value
, the same as estimated
when preserve_measurements = FALSE
, and a combination of observed
and estimated
otherwise
se_min
, the lower bound of the standard error with a minimum of 0
se_max
the upper bound of the standard error with a maximum of 1
observations
, the total number of observations, i.e. S + I + R
observed
, the original observed values
estimated
, the estimated values, calculated by the model
se_min
, the lower bound of the standard error with a minimum of 0
(so the standard error will never go below 0%)
se_max
the upper bound of the standard error with a maximum of 1
(so the standard error will never go above 100%)
observations
, the total number of available observations in that year, i.e. S + I + R
observed
, the original observed resistant percentages
estimated
, the estimated resistant percentages, calculated by the model