resistance predict update
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 0.5.0.9017
|
Version: 0.5.0.9017
|
||||||
Date: 2019-02-10
|
Date: 2019-02-11
|
||||||
Title: Antimicrobial Resistance Analysis
|
Title: Antimicrobial Resistance Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(
|
person(
|
||||||
|
@ -253,6 +253,7 @@ importFrom(graphics,axis)
|
|||||||
importFrom(graphics,barplot)
|
importFrom(graphics,barplot)
|
||||||
importFrom(graphics,hist)
|
importFrom(graphics,hist)
|
||||||
importFrom(graphics,plot)
|
importFrom(graphics,plot)
|
||||||
|
importFrom(graphics,points)
|
||||||
importFrom(graphics,text)
|
importFrom(graphics,text)
|
||||||
importFrom(hms,is.hms)
|
importFrom(hms,is.hms)
|
||||||
importFrom(knitr,kable)
|
importFrom(knitr,kable)
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#' @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 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.
|
#' @param info a logical to indicate whether textual analysis should be printed with the name and \code{\link{summary}} of the statistical model.
|
||||||
#' @param main title of the plot
|
#' @param main title of the plot
|
||||||
|
#' @param ribbon a logical to indicate whether a ribbon should be shown (default) or error bars
|
||||||
#' @details Valid options for the statistical model are:
|
#' @details Valid options for the statistical model are:
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item{\code{"binomial"} or \code{"binom"} or \code{"logit"}: a generalised linear regression model with binomial distribution}
|
#' \item{\code{"binomial"} or \code{"binom"} or \code{"logit"}: a generalised linear regression model with binomial distribution}
|
||||||
@ -51,6 +52,7 @@
|
|||||||
#' \item{\code{observed}, the original observed resistant percentages}
|
#' \item{\code{observed}, the original observed resistant percentages}
|
||||||
#' \item{\code{estimated}, the estimated resistant percentages, calculated by the model}
|
#' \item{\code{estimated}, the estimated resistant percentages, calculated by the model}
|
||||||
#' }
|
#' }
|
||||||
|
#' Furthermore, the model itself is available as an attribute: \code{attributes(x)$model}, see Examples.
|
||||||
#' @seealso The \code{\link{portion}} function to calculate resistance, \cr \code{\link{lm}} \code{\link{glm}}
|
#' @seealso The \code{\link{portion}} function to calculate resistance, \cr \code{\link{lm}} \code{\link{glm}}
|
||||||
#' @rdname resistance_predict
|
#' @rdname resistance_predict
|
||||||
#' @export
|
#' @export
|
||||||
@ -71,7 +73,12 @@
|
|||||||
#' plot(x)
|
#' plot(x)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' # create nice plots with ggplot yourself
|
#' # get the model from the object
|
||||||
|
#' mymodel <- attributes(x)$model
|
||||||
|
#' summary(mymodel)
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' # create nice plots with ggplot2 yourself
|
||||||
#' if (!require(ggplot2)) {
|
#' if (!require(ggplot2)) {
|
||||||
#'
|
#'
|
||||||
#' data <- septic_patients %>%
|
#' data <- septic_patients %>%
|
||||||
@ -295,8 +302,8 @@ rsi_predict <- resistance_predict
|
|||||||
|
|
||||||
#' @exportMethod plot.mic
|
#' @exportMethod plot.mic
|
||||||
#' @export
|
#' @export
|
||||||
#' @importFrom dplyr %>% group_by summarise
|
#' @importFrom dplyr filter
|
||||||
#' @importFrom graphics plot axis arrows
|
#' @importFrom graphics plot axis arrows points
|
||||||
#' @rdname resistance_predict
|
#' @rdname resistance_predict
|
||||||
plot.resistance_predict <- function(x, main = paste("Resistance prediction of", attributes(x)$ab), ...) {
|
plot.resistance_predict <- function(x, main = paste("Resistance prediction of", attributes(x)$ab), ...) {
|
||||||
if (attributes(x)$I_as_R == TRUE) {
|
if (attributes(x)$I_as_R == TRUE) {
|
||||||
@ -316,18 +323,30 @@ plot.resistance_predict <- function(x, main = paste("Resistance prediction of",
|
|||||||
", model: ", attributes(x)$model_title, ")"),
|
", model: ", attributes(x)$model_title, ")"),
|
||||||
cex.sub = 0.75)
|
cex.sub = 0.75)
|
||||||
|
|
||||||
|
|
||||||
axis(side = 2, at = seq(0, 1, 0.1), labels = paste0(0:10 * 10, "%"))
|
axis(side = 2, at = seq(0, 1, 0.1), labels = paste0(0:10 * 10, "%"))
|
||||||
|
|
||||||
# arrows hack: https://stackoverflow.com/a/22037078/4575331
|
# hack for error bars: https://stackoverflow.com/a/22037078/4575331
|
||||||
arrows(x0 = x$year,
|
arrows(x0 = x$year,
|
||||||
y0 = x$se_min,
|
y0 = x$se_min,
|
||||||
x1 = x$year,
|
x1 = x$year,
|
||||||
y1 = x$se_max, length = 0.05, angle = 90, code = 3)
|
y1 = x$se_max,
|
||||||
|
length = 0.05, angle = 90, code = 3, lwd = 1.5)
|
||||||
|
|
||||||
|
# overlay grey points for prediction
|
||||||
|
points(x = filter(x, is.na(observations))$year,
|
||||||
|
y = filter(x, is.na(observations))$value,
|
||||||
|
pch = 19,
|
||||||
|
col = "grey40")
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname resistance_predict
|
#' @rdname resistance_predict
|
||||||
|
#' @importFrom dplyr filter
|
||||||
#' @export
|
#' @export
|
||||||
ggplot_rsi_predict <- function(x, main = paste("Resistance prediction of", attributes(x)$ab), ...) {
|
ggplot_rsi_predict <- function(x,
|
||||||
|
main = paste("Resistance prediction of", attributes(x)$ab),
|
||||||
|
ribbon = TRUE,
|
||||||
|
...) {
|
||||||
|
|
||||||
if (!"resistance_predict" %in% class(x)) {
|
if (!"resistance_predict" %in% class(x)) {
|
||||||
stop("`x` must be a resistance prediction model created with resistance_predict().")
|
stop("`x` must be a resistance prediction model created with resistance_predict().")
|
||||||
@ -338,15 +357,26 @@ ggplot_rsi_predict <- function(x, main = paste("Resistance prediction of", attri
|
|||||||
} else {
|
} else {
|
||||||
ylab <- "%R"
|
ylab <- "%R"
|
||||||
}
|
}
|
||||||
suppressWarnings(
|
|
||||||
ggplot2::ggplot(x, ggplot2::aes(x = year, y = value)) +
|
p <- ggplot2::ggplot(x, ggplot2::aes(x = year, y = value)) +
|
||||||
ggplot2::geom_point(size = 2) +
|
ggplot2::geom_point(data = filter(x, !is.na(observations)),
|
||||||
ggplot2::geom_errorbar(ggplot2::aes(ymin = se_min, ymax = se_max), na.rm = TRUE, width = 0.5) +
|
size = 2) +
|
||||||
scale_y_percent(limits = c(0, 1)) +
|
scale_y_percent(limits = c(0, 1)) +
|
||||||
ggplot2::labs(title = main,
|
ggplot2::labs(title = main,
|
||||||
y = paste0("Percentage (", ylab, ")"),
|
y = paste0("Percentage (", ylab, ")"),
|
||||||
x = "Year",
|
x = "Year",
|
||||||
caption = paste0("(n = ", sum(x$observations, na.rm = TRUE),
|
caption = paste0("(n = ", sum(x$observations, na.rm = TRUE),
|
||||||
", model: ", attributes(x)$model_title, ")"))
|
", model: ", attributes(x)$model_title, ")"))
|
||||||
)
|
|
||||||
|
if (ribbon == TRUE) {
|
||||||
|
p <- p + ggplot2::geom_ribbon(ggplot2::aes(ymin = se_min, ymax = se_max), alpha = 0.25)
|
||||||
|
} else {
|
||||||
|
p <- p + ggplot2::geom_errorbar(ggplot2::aes(ymin = se_min, ymax = se_max), na.rm = TRUE, width = 0.5)
|
||||||
|
}
|
||||||
|
p <- p +
|
||||||
|
# overlay grey points for prediction
|
||||||
|
ggplot2::geom_point(data = filter(x, is.na(observations)),
|
||||||
|
size = 2,
|
||||||
|
colour = "grey40")
|
||||||
|
p
|
||||||
}
|
}
|
||||||
|
10
README.md
@ -23,11 +23,11 @@ Bhanu N.M. Sinha <a href="https://orcid.org/0000-0003-1634-0010"><img src="https
|
|||||||
<sup>a</sup> Thesis dissertant<br>
|
<sup>a</sup> Thesis dissertant<br>
|
||||||
<sup>b</sup> Thesis advisor
|
<sup>b</sup> Thesis advisor
|
||||||
|
|
||||||
<a href="https://www.rug.nl"><img src="docs/logo_rug.png" height="60px"></a>
|
<a href="https://www.rug.nl"><img src="pkgdown/logos/logo_rug.png" height="60px"></a>
|
||||||
<a href="https://www.umcg.nl"><img src="docs/logo_umcg.png" height="60px"></a>
|
<a href="https://www.umcg.nl"><img src="pkgdown/logos/logo_umcg.png" height="60px"></a>
|
||||||
<a href="https://www.certe.nl"><img src="docs/logo_certe.png" height="60px"></a>
|
<a href="https://www.certe.nl"><img src="pkgdown/logos/logo_certe.png" height="60px"></a>
|
||||||
<a href="http://www.eurhealth-1health.eu"><img src="docs/logo_eh1h.png" height="60px"></a>
|
<a href="http://www.eurhealth-1health.eu"><img src="pkgdown/logos/logo_eh1h.png" height="60px"></a>
|
||||||
<a href="http://www.eurhealth-1health.eu"><img src="docs/logo_interreg.png" height="60px"></a>
|
<a href="http://www.eurhealth-1health.eu"><img src="pkgdown/logos/logo_interreg.png" height="60px"></a>
|
||||||
|
|
||||||
## How to get this package
|
## How to get this package
|
||||||
All stable versions of this package [are published on CRAN](https://CRAN.R-project.org/package=AMR), the official R network with a peer-reviewed submission process.
|
All stable versions of this package [are published on CRAN](https://CRAN.R-project.org/package=AMR), the official R network with a peer-reviewed submission process.
|
||||||
|
@ -37,7 +37,7 @@ navbar:
|
|||||||
href: 'articles/AMR.html'
|
href: 'articles/AMR.html'
|
||||||
- text: 'Predict antimicrobial resistance'
|
- text: 'Predict antimicrobial resistance'
|
||||||
icon: 'fa-dice'
|
icon: 'fa-dice'
|
||||||
href: 'articles/Predict.html'
|
href: 'articles/resistance_predict.html'
|
||||||
- text: 'Work with WHONET data'
|
- text: 'Work with WHONET data'
|
||||||
icon: 'fa-globe-americas'
|
icon: 'fa-globe-americas'
|
||||||
href: 'articles/WHONET.html'
|
href: 'articles/WHONET.html'
|
||||||
@ -46,10 +46,12 @@ navbar:
|
|||||||
href: 'articles/EUCAST.html'
|
href: 'articles/EUCAST.html'
|
||||||
- text: 'Get properties of a microorganism'
|
- text: 'Get properties of a microorganism'
|
||||||
icon: 'fa-bug'
|
icon: 'fa-bug'
|
||||||
href: 'articles/mo_property.html'
|
# href: 'articles/mo_property.html'
|
||||||
|
href: 'reference/mo_property.html'
|
||||||
- text: 'Get properties of an antibiotic'
|
- text: 'Get properties of an antibiotic'
|
||||||
icon: 'fa-capsules'
|
icon: 'fa-capsules'
|
||||||
href: 'articles/ab_property.html'
|
# href: 'articles/atc_property.html'
|
||||||
|
href: 'reference/atc_property.html'
|
||||||
- text: 'Create frequency tables'
|
- text: 'Create frequency tables'
|
||||||
icon: 'fa-sort-amount-down'
|
icon: 'fa-sort-amount-down'
|
||||||
href: 'articles/freq.html'
|
href: 'articles/freq.html'
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/Predict.html">
|
<a href="articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -129,14 +129,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/mo_property.html">
|
<a href="reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/ab_property.html">
|
<a href="reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 50 KiB |
@ -70,7 +70,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/Predict.html">
|
<a href="../articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -91,14 +91,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/mo_property.html">
|
<a href="../reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/ab_property.html">
|
<a href="../reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
@ -185,7 +185,7 @@
|
|||||||
<h1>How to apply EUCAST rules</h1>
|
<h1>How to apply EUCAST rules</h1>
|
||||||
<h4 class="author">Matthijs S. Berends</h4>
|
<h4 class="author">Matthijs S. Berends</h4>
|
||||||
|
|
||||||
<h4 class="date">09 February 2019</h4>
|
<h4 class="date">11 February 2019</h4>
|
||||||
|
|
||||||
|
|
||||||
<div class="hidden name"><code>EUCAST.Rmd</code></div>
|
<div class="hidden name"><code>EUCAST.Rmd</code></div>
|
||||||
|
233
docs/articles/atc_property.html
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>How to get properties of an antibiotic • AMR (for R)</title>
|
||||||
|
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
|
||||||
|
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
|
||||||
|
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
|
||||||
|
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous">
|
||||||
|
<link href="../docsearch.css" rel="stylesheet">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
|
||||||
|
<script src="../extra.js"></script><meta property="og:title" content="How to get properties of an antibiotic">
|
||||||
|
<meta property="og:description" content="">
|
||||||
|
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
|
||||||
|
<meta name="twitter:card" content="summary">
|
||||||
|
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
|
||||||
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||||
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container template-article">
|
||||||
|
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<span class="navbar-brand">
|
||||||
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9017</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li>
|
||||||
|
<a href="../index.html">
|
||||||
|
<span class="fa fa-home"></span>
|
||||||
|
|
||||||
|
Home
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||||
|
<span class="fa fa-question-circle"></span>
|
||||||
|
|
||||||
|
How to
|
||||||
|
|
||||||
|
<span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li>
|
||||||
|
<a href="../articles/AMR.html">
|
||||||
|
<span class="fa fa-directions"></span>
|
||||||
|
|
||||||
|
Conduct AMR analysis
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/resistance_predict.html">
|
||||||
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
|
Predict antimicrobial resistance
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/WHONET.html">
|
||||||
|
<span class="fa fa-globe-americas"></span>
|
||||||
|
|
||||||
|
Work with WHONET data
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/EUCAST.html">
|
||||||
|
<span class="fa fa-exchange-alt"></span>
|
||||||
|
|
||||||
|
Apply EUCAST rules
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../reference/mo_property.html">
|
||||||
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
|
Get properties of a microorganism
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../reference/atc_property.html">
|
||||||
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
|
Get properties of an antibiotic
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/freq.html">
|
||||||
|
<span class="fa fa-sort-amount-down"></span>
|
||||||
|
|
||||||
|
Create frequency tables
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/G_test.html">
|
||||||
|
<span class="fa fa-clipboard-check"></span>
|
||||||
|
|
||||||
|
Use the G-test
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/benchmarks.html">
|
||||||
|
<span class="fa fa-shipping-fast"></span>
|
||||||
|
|
||||||
|
Other: benchmarks
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../reference/">
|
||||||
|
<span class="fa fa-book-open"></span>
|
||||||
|
|
||||||
|
Manual
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../authors.html">
|
||||||
|
<span class="fa fa-users"></span>
|
||||||
|
|
||||||
|
Authors
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../news/">
|
||||||
|
<span class="far fa far fa-newspaper"></span>
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li>
|
||||||
|
<a href="https://gitlab.com/msberends/AMR">
|
||||||
|
<span class="fab fa fab fa-gitlab"></span>
|
||||||
|
|
||||||
|
Source Code
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../LICENSE-text.html">
|
||||||
|
<span class="fa fa-book"></span>
|
||||||
|
|
||||||
|
Licence
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<form class="navbar-form navbar-right" role="search">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--/.nav-collapse -->
|
||||||
|
</div>
|
||||||
|
<!--/.container -->
|
||||||
|
</div>
|
||||||
|
<!--/.navbar -->
|
||||||
|
|
||||||
|
|
||||||
|
</header><div class="row">
|
||||||
|
<div class="col-md-9 contents">
|
||||||
|
<div class="page-header toc-ignore">
|
||||||
|
<h1>How to get properties of an antibiotic</h1>
|
||||||
|
<h4 class="author">Matthijs S. Berends</h4>
|
||||||
|
|
||||||
|
<h4 class="date">11 February 2019</h4>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="hidden name"><code>atc_property.Rmd</code></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p><em>(will be available soon)</em></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<footer><div class="copyright">
|
||||||
|
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/">Alex W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a>.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pkgdown">
|
||||||
|
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
|
||||||
|
docsearch({
|
||||||
|
|
||||||
|
|
||||||
|
apiKey: 'f737050abfd4d726c63938e18f8c496e',
|
||||||
|
indexName: 'amr',
|
||||||
|
inputSelector: 'input#search-input.form-control',
|
||||||
|
transformData: function(hits) {
|
||||||
|
return hits.map(function (hit) {
|
||||||
|
hit.url = updateHitURL(hit);
|
||||||
|
return hit;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -108,7 +108,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/Predict.html">
|
<a href="../articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -129,14 +129,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/mo_property.html">
|
<a href="../reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/ab_property.html">
|
<a href="../reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
@ -232,12 +232,12 @@
|
|||||||
<li><a href="AMR.html">How to conduct AMR analysis</a></li>
|
<li><a href="AMR.html">How to conduct AMR analysis</a></li>
|
||||||
<li><a href="EUCAST.html">How to apply EUCAST rules</a></li>
|
<li><a href="EUCAST.html">How to apply EUCAST rules</a></li>
|
||||||
<li><a href="G_test.html">How to use the *G*-test</a></li>
|
<li><a href="G_test.html">How to use the *G*-test</a></li>
|
||||||
<li><a href="Predict.html">How to predict antimicrobial resistance</a></li>
|
|
||||||
<li><a href="WHONET.html">How to work with WHONET data</a></li>
|
<li><a href="WHONET.html">How to work with WHONET data</a></li>
|
||||||
<li><a href="ab_property.html">How to get properties of an antibiotic</a></li>
|
<li><a href="atc_property.html">How to get properties of an antibiotic</a></li>
|
||||||
<li><a href="benchmarks.html">Benchmarks</a></li>
|
<li><a href="benchmarks.html">Benchmarks</a></li>
|
||||||
<li><a href="freq.html">How to create frequency tables</a></li>
|
<li><a href="freq.html">How to create frequency tables</a></li>
|
||||||
<li><a href="mo_property.html">How to get properties of a microorganism</a></li>
|
<li><a href="mo_property.html">How to get properties of a microorganism</a></li>
|
||||||
|
<li><a href="resistance_predict.html">How to predict antimicrobial resistance</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/Predict.html">
|
<a href="../articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -91,14 +91,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/mo_property.html">
|
<a href="../reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/ab_property.html">
|
<a href="../reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
@ -185,7 +185,7 @@
|
|||||||
<h1>How to get properties of a microorganism</h1>
|
<h1>How to get properties of a microorganism</h1>
|
||||||
<h4 class="author">Matthijs S. Berends</h4>
|
<h4 class="author">Matthijs S. Berends</h4>
|
||||||
|
|
||||||
<h4 class="date">09 February 2019</h4>
|
<h4 class="date">11 February 2019</h4>
|
||||||
|
|
||||||
|
|
||||||
<div class="hidden name"><code>mo_property.Rmd</code></div>
|
<div class="hidden name"><code>mo_property.Rmd</code></div>
|
||||||
|
406
docs/articles/resistance_predict.html
Normal file
@ -0,0 +1,406 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>How to predict antimicrobial resistance • AMR (for R)</title>
|
||||||
|
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
|
||||||
|
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
|
||||||
|
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
|
||||||
|
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
|
||||||
|
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous">
|
||||||
|
<link href="../docsearch.css" rel="stylesheet">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
|
||||||
|
<script src="../extra.js"></script><meta property="og:title" content="How to predict antimicrobial resistance">
|
||||||
|
<meta property="og:description" content="">
|
||||||
|
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
|
||||||
|
<meta name="twitter:card" content="summary">
|
||||||
|
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
|
||||||
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||||
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container template-article">
|
||||||
|
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<span class="navbar-brand">
|
||||||
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9017</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li>
|
||||||
|
<a href="../index.html">
|
||||||
|
<span class="fa fa-home"></span>
|
||||||
|
|
||||||
|
Home
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||||
|
<span class="fa fa-question-circle"></span>
|
||||||
|
|
||||||
|
How to
|
||||||
|
|
||||||
|
<span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li>
|
||||||
|
<a href="../articles/AMR.html">
|
||||||
|
<span class="fa fa-directions"></span>
|
||||||
|
|
||||||
|
Conduct AMR analysis
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/resistance_predict.html">
|
||||||
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
|
Predict antimicrobial resistance
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/WHONET.html">
|
||||||
|
<span class="fa fa-globe-americas"></span>
|
||||||
|
|
||||||
|
Work with WHONET data
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/EUCAST.html">
|
||||||
|
<span class="fa fa-exchange-alt"></span>
|
||||||
|
|
||||||
|
Apply EUCAST rules
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../reference/mo_property.html">
|
||||||
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
|
Get properties of a microorganism
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../reference/atc_property.html">
|
||||||
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
|
Get properties of an antibiotic
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/freq.html">
|
||||||
|
<span class="fa fa-sort-amount-down"></span>
|
||||||
|
|
||||||
|
Create frequency tables
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/G_test.html">
|
||||||
|
<span class="fa fa-clipboard-check"></span>
|
||||||
|
|
||||||
|
Use the G-test
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../articles/benchmarks.html">
|
||||||
|
<span class="fa fa-shipping-fast"></span>
|
||||||
|
|
||||||
|
Other: benchmarks
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../reference/">
|
||||||
|
<span class="fa fa-book-open"></span>
|
||||||
|
|
||||||
|
Manual
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../authors.html">
|
||||||
|
<span class="fa fa-users"></span>
|
||||||
|
|
||||||
|
Authors
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../news/">
|
||||||
|
<span class="far fa far fa-newspaper"></span>
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li>
|
||||||
|
<a href="https://gitlab.com/msberends/AMR">
|
||||||
|
<span class="fab fa fab fa-gitlab"></span>
|
||||||
|
|
||||||
|
Source Code
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="../LICENSE-text.html">
|
||||||
|
<span class="fa fa-book"></span>
|
||||||
|
|
||||||
|
Licence
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<form class="navbar-form navbar-right" role="search">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--/.nav-collapse -->
|
||||||
|
</div>
|
||||||
|
<!--/.container -->
|
||||||
|
</div>
|
||||||
|
<!--/.navbar -->
|
||||||
|
|
||||||
|
|
||||||
|
</header><div class="row">
|
||||||
|
<div class="col-md-9 contents">
|
||||||
|
<div class="page-header toc-ignore">
|
||||||
|
<h1>How to predict antimicrobial resistance</h1>
|
||||||
|
<h4 class="author">Matthijs S. Berends</h4>
|
||||||
|
|
||||||
|
<h4 class="date">11 February 2019</h4>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="hidden name"><code>resistance_predict.Rmd</code></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="needed-r-packages" class="section level2">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2>
|
||||||
|
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by <a href="https://www.linkedin.com/in/hadleywickham/">Dr Hadley Wickham</a>. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
|
||||||
|
<p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p>
|
||||||
|
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a>
|
||||||
|
<a class="sourceLine" id="cb1-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(ggplot2)</a>
|
||||||
|
<a class="sourceLine" id="cb1-3" title="3"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(AMR)</a>
|
||||||
|
<a class="sourceLine" id="cb1-4" title="4"></a>
|
||||||
|
<a class="sourceLine" id="cb1-5" title="5"><span class="co"># (if not yet installed, install with:)</span></a>
|
||||||
|
<a class="sourceLine" id="cb1-6" title="6"><span class="co"># install.packages(c("tidyverse", "AMR"))</span></a></code></pre></div>
|
||||||
|
</div>
|
||||||
|
<div id="prediction-analysis" class="section level2">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#prediction-analysis" class="anchor"></a>Prediction analysis</h2>
|
||||||
|
<p>Our package contains a function <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>, which takes the same input as functions for <a href="./AMR.html">other AMR analysis</a>. Based on a date column, it calculates cases per year and uses a regression model to predict antimicrobial resistance.</p>
|
||||||
|
<p>It is basically as easy as:</p>
|
||||||
|
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1"><span class="co"># resistance prediction of piperacillin/tazobactam (pita):</span></a>
|
||||||
|
<a class="sourceLine" id="cb2-2" title="2"><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">tbl =</span> septic_patients, <span class="dt">col_date =</span> <span class="st">"date"</span>, <span class="dt">col_ab =</span> <span class="st">"pita"</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb2-3" title="3"></a>
|
||||||
|
<a class="sourceLine" id="cb2-4" title="4"><span class="co"># or:</span></a>
|
||||||
|
<a class="sourceLine" id="cb2-5" title="5">septic_patients <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb2-6" title="6"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"pita"</span>)</a>
|
||||||
|
<a class="sourceLine" id="cb2-7" title="7"></a>
|
||||||
|
<a class="sourceLine" id="cb2-8" title="8"><span class="co"># to bind it to object 'predict_pita' for example:</span></a>
|
||||||
|
<a class="sourceLine" id="cb2-9" title="9">predict_pita <-<span class="st"> </span>septic_patients <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb2-10" title="10"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"pita"</span>)</a></code></pre></div>
|
||||||
|
<p>The function will look for a date column itself if <code>col_date</code> is not set.</p>
|
||||||
|
<p>When running any of these commands, a summary of the regression model will be printed unless using <code><a href="../reference/resistance_predict.html">resistance_predict(..., info = FALSE)</a></code>.</p>
|
||||||
|
<pre><code>#> NOTE: Using column `date` as input for `col_date`.
|
||||||
|
#>
|
||||||
|
#> Logistic regression model (logit) with binomial distribution
|
||||||
|
#> ------------------------------------------------------------
|
||||||
|
#>
|
||||||
|
#> Call:
|
||||||
|
#> glm(formula = df_matrix ~ year, family = binomial)
|
||||||
|
#>
|
||||||
|
#> Deviance Residuals:
|
||||||
|
#> Min 1Q Median 3Q Max
|
||||||
|
#> -2.9224 -1.3120 0.0170 0.7586 3.1932
|
||||||
|
#>
|
||||||
|
#> Coefficients:
|
||||||
|
#> Estimate Std. Error z value Pr(>|z|)
|
||||||
|
#> (Intercept) -222.92857 45.93922 -4.853 1.22e-06 ***
|
||||||
|
#> year 0.10994 0.02284 4.814 1.48e-06 ***
|
||||||
|
#> ---
|
||||||
|
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
|
||||||
|
#>
|
||||||
|
#> (Dispersion parameter for binomial family taken to be 1)
|
||||||
|
#>
|
||||||
|
#> Null deviance: 59.794 on 14 degrees of freedom
|
||||||
|
#> Residual deviance: 35.191 on 13 degrees of freedom
|
||||||
|
#> AIC: 93.464
|
||||||
|
#>
|
||||||
|
#> Number of Fisher Scoring iterations: 4</code></pre>
|
||||||
|
<p>This text is only a printed summary - the actual result (output) of the function is a <code>data.frame</code> containing for each year: the number of observations, the actual observed resistance, the estimated resistance and the standard error below and above the estimation:</p>
|
||||||
|
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">predict_pita</a>
|
||||||
|
<a class="sourceLine" id="cb4-2" title="2"><span class="co">#> year value se_min se_max observations observed estimated</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-3" title="3"><span class="co">#> 1 2003 0.06250000 NA NA 32 0.06250000 0.06177594</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-4" title="4"><span class="co">#> 2 2004 0.08536585 NA NA 82 0.08536585 0.06846343</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-5" title="5"><span class="co">#> 3 2005 0.10000000 NA NA 60 0.10000000 0.07581637</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-6" title="6"><span class="co">#> 4 2006 0.05084746 NA NA 59 0.05084746 0.08388789</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-7" title="7"><span class="co">#> 5 2007 0.12121212 NA NA 66 0.12121212 0.09273250</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-8" title="8"><span class="co">#> 6 2008 0.04166667 NA NA 72 0.04166667 0.10240539</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-9" title="9"><span class="co">#> 7 2009 0.01639344 NA NA 61 0.01639344 0.11296163</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-10" title="10"><span class="co">#> 8 2010 0.09433962 NA NA 53 0.09433962 0.12445516</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-11" title="11"><span class="co">#> 9 2011 0.18279570 NA NA 93 0.18279570 0.13693759</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-12" title="12"><span class="co">#> 10 2012 0.30769231 NA NA 65 0.30769231 0.15045682</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-13" title="13"><span class="co">#> 11 2013 0.08620690 NA NA 58 0.08620690 0.16505550</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-14" title="14"><span class="co">#> 12 2014 0.15254237 NA NA 59 0.15254237 0.18076926</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-15" title="15"><span class="co">#> 13 2015 0.27272727 NA NA 55 0.27272727 0.19762493</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-16" title="16"><span class="co">#> 14 2016 0.25000000 NA NA 84 0.25000000 0.21563859</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-17" title="17"><span class="co">#> 15 2017 0.16279070 NA NA 86 0.16279070 0.23481370</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-18" title="18"><span class="co">#> 16 2018 0.25513926 0.2228376 0.2874409 NA NA 0.25513926</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-19" title="19"><span class="co">#> 17 2019 0.27658825 0.2386811 0.3144954 NA NA 0.27658825</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-20" title="20"><span class="co">#> 18 2020 0.29911630 0.2551715 0.3430611 NA NA 0.29911630</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-21" title="21"><span class="co">#> 19 2021 0.32266085 0.2723340 0.3729877 NA NA 0.32266085</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-22" title="22"><span class="co">#> 20 2022 0.34714076 0.2901847 0.4040968 NA NA 0.34714076</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-23" title="23"><span class="co">#> 21 2023 0.37245666 0.3087318 0.4361815 NA NA 0.37245666</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-24" title="24"><span class="co">#> 22 2024 0.39849187 0.3279750 0.4690088 NA NA 0.39849187</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-25" title="25"><span class="co">#> 23 2025 0.42511415 0.3479042 0.5023241 NA NA 0.42511415</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-26" title="26"><span class="co">#> 24 2026 0.45217796 0.3684992 0.5358568 NA NA 0.45217796</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-27" title="27"><span class="co">#> 25 2027 0.47952757 0.3897276 0.5693275 NA NA 0.47952757</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-28" title="28"><span class="co">#> 26 2028 0.50700045 0.4115444 0.6024565 NA NA 0.50700045</span></a>
|
||||||
|
<a class="sourceLine" id="cb4-29" title="29"><span class="co">#> 27 2029 0.53443111 0.4338908 0.6349714 NA NA 0.53443111</span></a></code></pre></div>
|
||||||
|
<p>The function <code>plot</code> is available in base R, and can be extended by other packages to depend the output based on the type of input. We extended its function to cope with resistance predictions:</p>
|
||||||
|
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/plot">plot</a></span>(predict_pita)</a></code></pre></div>
|
||||||
|
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-4-1.png" width="720"></p>
|
||||||
|
<p>This is the fastest way to plot the result. It automatically adds the right axes, error bars, titles, number of available observations and type of model.</p>
|
||||||
|
<p>We also support the <code>ggplot2</code> package with our custom function <code><a href="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> to create more appealing plots:</p>
|
||||||
|
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(predict_pita)</a></code></pre></div>
|
||||||
|
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-5-1.png" width="720"></p>
|
||||||
|
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1"></a>
|
||||||
|
<a class="sourceLine" id="cb7-2" title="2"><span class="co"># choose for error bars instead of a ribbon</span></a>
|
||||||
|
<a class="sourceLine" id="cb7-3" title="3"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(predict_pita, <span class="dt">ribbon =</span> <span class="ot">FALSE</span>)</a></code></pre></div>
|
||||||
|
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-5-2.png" width="720"></p>
|
||||||
|
<div id="choosing-the-right-model" class="section level3">
|
||||||
|
<h3 class="hasAnchor">
|
||||||
|
<a href="#choosing-the-right-model" class="anchor"></a>Choosing the right model</h3>
|
||||||
|
<p>Resistance is not easily predicted; if we look at vancomycin resistance in Gram positives, the spread (i.e. standard error) is enormous:</p>
|
||||||
|
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1">septic_patients <span class="op">%>%</span></a>
|
||||||
|
<a class="sourceLine" id="cb8-2" title="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/filter">filter</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(mo) <span class="op">==</span><span class="st"> "Gram positive"</span>) <span class="op">%>%</span></a>
|
||||||
|
<a class="sourceLine" id="cb8-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"vanc"</span>, <span class="dt">year_min =</span> <span class="dv">2010</span>, <span class="dt">info =</span> <span class="ot">FALSE</span>) <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb8-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>()</a>
|
||||||
|
<a class="sourceLine" id="cb8-5" title="5"><span class="co">#> </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a></code></pre></div>
|
||||||
|
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-6-1.png" width="720"></p>
|
||||||
|
<p>Vancomycin resistance could be 100% in ten years, but might also stay around 0%.</p>
|
||||||
|
<p>You can define the model with the <code>model</code> parameter. The default model is a generalised linear regression model using a binomial distribution, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance.</p>
|
||||||
|
<p>Valid values are:</p>
|
||||||
|
<table class="table">
|
||||||
|
<colgroup>
|
||||||
|
<col width="32%">
|
||||||
|
<col width="25%">
|
||||||
|
<col width="42%">
|
||||||
|
</colgroup>
|
||||||
|
<thead><tr class="header">
|
||||||
|
<th>Input values</th>
|
||||||
|
<th>Function used by R</th>
|
||||||
|
<th>Type of model</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>
|
||||||
|
<code>"binomial"</code> or <code>"binom"</code> or <code>"logit"</code>
|
||||||
|
</td>
|
||||||
|
<td><code><a href="https://www.rdocumentation.org/packages/stats/topics/glm">glm(..., family = binomial)</a></code></td>
|
||||||
|
<td>Generalised linear model with binomial distribution</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td>
|
||||||
|
<code>"loglin"</code> or <code>"poisson"</code>
|
||||||
|
</td>
|
||||||
|
<td><code><a href="https://www.rdocumentation.org/packages/stats/topics/glm">glm(..., family = poisson)</a></code></td>
|
||||||
|
<td>Generalised linear model with poisson distribution</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td>
|
||||||
|
<code>"lin"</code> or <code>"linear"</code>
|
||||||
|
</td>
|
||||||
|
<td><code><a href="https://www.rdocumentation.org/packages/stats/topics/lm">lm()</a></code></td>
|
||||||
|
<td>Linear model</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>For the vancomycin resistance in Gram positive bacteria, a linear model might be more appropriate since no (left half of a) binomial distribution is to be expected based on the observed years:</p>
|
||||||
|
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1">septic_patients <span class="op">%>%</span></a>
|
||||||
|
<a class="sourceLine" id="cb9-2" title="2"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/dplyr/topics/filter">filter</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(mo) <span class="op">==</span><span class="st"> "Gram positive"</span>) <span class="op">%>%</span></a>
|
||||||
|
<a class="sourceLine" id="cb9-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"vanc"</span>, <span class="dt">year_min =</span> <span class="dv">2010</span>, <span class="dt">info =</span> <span class="ot">FALSE</span>, <span class="dt">model =</span> <span class="st">"linear"</span>) <span class="op">%>%</span><span class="st"> </span></a>
|
||||||
|
<a class="sourceLine" id="cb9-4" title="4"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>()</a>
|
||||||
|
<a class="sourceLine" id="cb9-5" title="5"><span class="co">#> </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a></code></pre></div>
|
||||||
|
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-7-1.png" width="720"></p>
|
||||||
|
<p>This seems more likely, doesn’t it?</p>
|
||||||
|
<p>The model itself is also available from the object, as an <code>attribute</code>:</p>
|
||||||
|
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" title="1">model <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/attributes">attributes</a></span>(predict_pita)<span class="op">$</span>model</a>
|
||||||
|
<a class="sourceLine" id="cb10-2" title="2"></a>
|
||||||
|
<a class="sourceLine" id="cb10-3" title="3"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(model)<span class="op">$</span>family</a>
|
||||||
|
<a class="sourceLine" id="cb10-4" title="4"><span class="co">#> </span></a>
|
||||||
|
<a class="sourceLine" id="cb10-5" title="5"><span class="co">#> Family: binomial </span></a>
|
||||||
|
<a class="sourceLine" id="cb10-6" title="6"><span class="co">#> Link function: logit</span></a>
|
||||||
|
<a class="sourceLine" id="cb10-7" title="7"></a>
|
||||||
|
<a class="sourceLine" id="cb10-8" title="8"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(model)<span class="op">$</span>coefficients</a>
|
||||||
|
<a class="sourceLine" id="cb10-9" title="9"><span class="co">#> Estimate Std. Error z value Pr(>|z|)</span></a>
|
||||||
|
<a class="sourceLine" id="cb10-10" title="10"><span class="co">#> (Intercept) -222.9285736 45.93922388 -4.852685 1.218012e-06</span></a>
|
||||||
|
<a class="sourceLine" id="cb10-11" title="11"><span class="co">#> year 0.1099391 0.02283501 4.814500 1.475690e-06</span></a></code></pre></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||||
|
<div id="tocnav">
|
||||||
|
<h2 class="hasAnchor">
|
||||||
|
<a href="#tocnav" class="anchor"></a>Contents</h2>
|
||||||
|
<ul class="nav nav-pills nav-stacked">
|
||||||
|
<li><a href="#needed-r-packages">Needed R packages</a></li>
|
||||||
|
<li><a href="#prediction-analysis">Prediction analysis</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<footer><div class="copyright">
|
||||||
|
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/">Alex W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a>.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pkgdown">
|
||||||
|
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
|
||||||
|
docsearch({
|
||||||
|
|
||||||
|
|
||||||
|
apiKey: 'f737050abfd4d726c63938e18f8c496e',
|
||||||
|
indexName: 'amr',
|
||||||
|
inputSelector: 'input#search-input.form-control',
|
||||||
|
transformData: function(hits) {
|
||||||
|
return hits.map(function (hit) {
|
||||||
|
hit.url = updateHitURL(hit);
|
||||||
|
return hit;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 29 KiB |
@ -108,7 +108,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/Predict.html">
|
<a href="articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -129,14 +129,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/mo_property.html">
|
<a href="reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/ab_property.html">
|
<a href="reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
|
|
||||||
/* R for Data Science (r4ds) */
|
/* R for Data Science (r4ds) */
|
||||||
#r4ds a {
|
#r4ds a {
|
||||||
display: inline;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
#r4ds * {
|
#r4ds img {
|
||||||
text-align: center;
|
margin-left: 10px;
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* class for footer */
|
/* class for footer */
|
||||||
|
@ -34,15 +34,19 @@ $( document ).ready(function() {
|
|||||||
window.location.replace(url_new);
|
window.location.replace(url_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PR for 'R for Data Science' on How To pages
|
||||||
|
if ($(".template-article").length > 0) {
|
||||||
$('#sidebar').prepend(
|
$('#sidebar').prepend(
|
||||||
'<div id="r4ds">' +
|
'<div id="r4ds">' +
|
||||||
' <a href="https://r4ds.had.co.nz/">' +
|
' <a href="https://r4ds.had.co.nz/">Learn R reading this great book: R for Data Science.' +
|
||||||
' <img src="../../AMR/cover_r4ds.png" width="25%">' +
|
' <br>' +
|
||||||
' </a>' +
|
' <br>' +
|
||||||
' <p>Learn R reading this great book!</p>' +
|
' Click to read it online - it was published for free.' +
|
||||||
' <p>Or read it free online: <a href="https://r4ds.had.co.nz/" target="_blank">r4ds.co.nz</a>.</p>' +
|
' <img src="../../AMR/cover_r4ds.png" height="100px">' +
|
||||||
|
' </a> ' +
|
||||||
' <hr>' +
|
' <hr>' +
|
||||||
'</div>');
|
'</div>');
|
||||||
|
}
|
||||||
|
|
||||||
$('footer').html(
|
$('footer').html(
|
||||||
'<div>' +
|
'<div>' +
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/Predict.html">
|
<a href="articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -93,14 +93,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/mo_property.html">
|
<a href="reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="articles/ab_property.html">
|
<a href="reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
@ -195,7 +195,7 @@
|
|||||||
<p>This package can be used for:</p>
|
<p>This package can be used for:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Calculating antimicrobial resistance</li>
|
<li>Calculating antimicrobial resistance</li>
|
||||||
<li>Calculating empiric susceptibility of both mono therapy and combination therapy</li>
|
<li>Calculating empirical susceptibility of both mono therapy and combination therapy</li>
|
||||||
<li>Predicting future antimicrobial resistance using regression models</li>
|
<li>Predicting future antimicrobial resistance using regression models</li>
|
||||||
<li>Getting properties for any microorganism (like Gram stain, species, genus or family)</li>
|
<li>Getting properties for any microorganism (like Gram stain, species, genus or family)</li>
|
||||||
<li>Getting properties for any antibiotic (like name, ATC code, defined daily dose or trade name)</li>
|
<li>Getting properties for any antibiotic (like name, ATC code, defined daily dose or trade name)</li>
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/Predict.html">
|
<a href="../articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -129,14 +129,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/mo_property.html">
|
<a href="../reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/ab_property.html">
|
<a href="../reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
@ -798,7 +798,7 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Full support for Windows, Linux and macOS</li>
|
<li>Full support for Windows, Linux and macOS</li>
|
||||||
<li>Full support for old R versions, only R-3.0.0 (April 2013) or later is needed (needed packages may have other dependencies)</li>
|
<li>Full support for old R versions, only R-3.0.0 (April 2013) or later is needed (needed packages may have other dependencies)</li>
|
||||||
<li>Function <code>n_rsi</code> to count cases where antibiotic test results were available, to be used in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">dplyr::summarise</a></code>, see ?rsi</li>
|
<li>Function <code>n_rsi</code> to count cases where antibiotic test results were available, to be used in conjunction with <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">dplyr::summarise</a></code>, see ?rsi</li>
|
||||||
<li>Function <code>guess_bactid</code> to <strong>determine the ID</strong> of a microorganism based on genus/species or known abbreviations like MRSA</li>
|
<li>Function <code>guess_bactid</code> to <strong>determine the ID</strong> of a microorganism based on genus/species or known abbreviations like MRSA</li>
|
||||||
<li>Function <code>guess_atc</code> to <strong>determine the ATC</strong> of an antibiotic based on name, trade name, or known abbreviations</li>
|
<li>Function <code>guess_atc</code> to <strong>determine the ATC</strong> of an antibiotic based on name, trade name, or known abbreviations</li>
|
||||||
<li>Function <code>freq</code> to create <strong>frequency tables</strong>, with additional info in a header</li>
|
<li>Function <code>freq</code> to create <strong>frequency tables</strong>, with additional info in a header</li>
|
||||||
|
@ -5,12 +5,12 @@ articles:
|
|||||||
AMR: AMR.html
|
AMR: AMR.html
|
||||||
EUCAST: EUCAST.html
|
EUCAST: EUCAST.html
|
||||||
G_test: G_test.html
|
G_test: G_test.html
|
||||||
Predict: Predict.html
|
|
||||||
WHONET: WHONET.html
|
WHONET: WHONET.html
|
||||||
ab_property: ab_property.html
|
atc_property: atc_property.html
|
||||||
benchmarks: benchmarks.html
|
benchmarks: benchmarks.html
|
||||||
freq: freq.html
|
freq: freq.html
|
||||||
mo_property: mo_property.html
|
mo_property: mo_property.html
|
||||||
|
resistance_predict: resistance_predict.html
|
||||||
urls:
|
urls:
|
||||||
reference: https://msberends.gitlab.io/AMR/reference
|
reference: https://msberends.gitlab.io/AMR/reference
|
||||||
article: https://msberends.gitlab.io/AMR/articles
|
article: https://msberends.gitlab.io/AMR/articles
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/Predict.html">
|
<a href="../articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -129,14 +129,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/mo_property.html">
|
<a href="../reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/ab_property.html">
|
<a href="../reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/Predict.html">
|
<a href="../articles/resistance_predict.html">
|
||||||
<span class="fa fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
@ -131,14 +131,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/mo_property.html">
|
<a href="../reference/mo_property.html">
|
||||||
<span class="fa fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/ab_property.html">
|
<a href="../reference/atc_property.html">
|
||||||
<span class="fa fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
@ -249,7 +249,7 @@
|
|||||||
<span class='kw'>main</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Resistance prediction of"</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/attributes'>attributes</a></span>(<span class='no'>x</span>)$<span class='no'>ab</span>), <span class='no'>...</span>)
|
<span class='kw'>main</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Resistance prediction of"</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/attributes'>attributes</a></span>(<span class='no'>x</span>)$<span class='no'>ab</span>), <span class='no'>...</span>)
|
||||||
|
|
||||||
<span class='fu'>ggplot_rsi_predict</span>(<span class='no'>x</span>, <span class='kw'>main</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Resistance prediction of"</span>,
|
<span class='fu'>ggplot_rsi_predict</span>(<span class='no'>x</span>, <span class='kw'>main</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Resistance prediction of"</span>,
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/attributes'>attributes</a></span>(<span class='no'>x</span>)$<span class='no'>ab</span>), <span class='no'>...</span>)</pre>
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/attributes'>attributes</a></span>(<span class='no'>x</span>)$<span class='no'>ab</span>), <span class='kw'>ribbon</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='no'>...</span>)</pre>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||||
<table class="ref-arguments">
|
<table class="ref-arguments">
|
||||||
@ -284,7 +284,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>model</th>
|
<th>model</th>
|
||||||
<td><p>the statistical model of choice. Valid values are <code>"binomial"</code> (or <code>"binom"</code> or <code>"logit"</code>) or <code>"loglin"</code> (or <code>"poisson"</code>) or <code>"linear"</code> (or <code>"lin"</code>).</p></td>
|
<td><p>the statistical model of choice. Defaults to a generalised linear regression model with binomial distribution, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See Details for valid options.</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>I_as_R</th>
|
<th>I_as_R</th>
|
||||||
@ -312,6 +312,10 @@
|
|||||||
<th>...</th>
|
<th>...</th>
|
||||||
<td><p>parameters passed on to the <code>first_isolate</code> function</p></td>
|
<td><p>parameters passed on to the <code>first_isolate</code> function</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>ribbon</th>
|
||||||
|
<td><p>a logical to indicate whether a ribbon should be shown (default) or error bars</p></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
||||||
@ -324,8 +328,15 @@
|
|||||||
<li><p><code>observations</code>, the total number of available observations in that year, i.e. S + I + R</p></li>
|
<li><p><code>observations</code>, the total number of available observations in that year, i.e. S + I + R</p></li>
|
||||||
<li><p><code>observed</code>, the original observed resistant percentages</p></li>
|
<li><p><code>observed</code>, the original observed resistant percentages</p></li>
|
||||||
<li><p><code>estimated</code>, the estimated resistant percentages, calculated by the model</p></li>
|
<li><p><code>estimated</code>, the estimated resistant percentages, calculated by the model</p></li>
|
||||||
</ul>
|
</ul><p>Furthermore, the model itself is available as an attribute: <code>attributes(x)$model</code>, see Examples.</p>
|
||||||
|
|
||||||
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
|
<p>Valid options for the statistical model are:</p><ul>
|
||||||
|
<li><p><code>"binomial"</code> or <code>"binom"</code> or <code>"logit"</code>: a generalised linear regression model with binomial distribution</p></li>
|
||||||
|
<li><p><code>"loglin"</code> or <code>"poisson"</code>: a generalised log-linear regression model with poisson distribution</p></li>
|
||||||
|
<li><p><code>"lin"</code> or <code>"linear"</code>: a linear regression model</p></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||||
|
|
||||||
@ -348,36 +359,41 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
|||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>x</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>x</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='first_isolate.html'>filter_first_isolate</a></span>() <span class='kw'>%>%</span>
|
<span class='fu'><a href='first_isolate.html'>filter_first_isolate</a></span>() <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='no'>mo</span>) <span class='kw'>==</span> <span class='st'>"Staphylococcus"</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='no'>mo</span>) <span class='kw'>==</span> <span class='st'>"Staphylococcus"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>resistance_predict</span>(<span class='st'>"peni"</span>)
|
<span class='fu'>resistance_predict</span>(<span class='st'>"peni"</span>)
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>x</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>x</span>)
|
||||||
|
|
||||||
|
|
||||||
<span class='co'># create nice plots with ggplot yourself</span>
|
<span class='co'># get the model from the object</span>
|
||||||
|
<span class='no'>mymodel</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/attributes'>attributes</a></span>(<span class='no'>x</span>)$<span class='no'>model</span>
|
||||||
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/summary'>summary</a></span>(<span class='no'>mymodel</span>)
|
||||||
|
|
||||||
|
|
||||||
|
<span class='co'># create nice plots with ggplot2 yourself</span>
|
||||||
<span class='kw'>if</span> (!<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>require</a></span>(<span class='no'>ggplot2</span>)) {
|
<span class='kw'>if</span> (!<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>require</a></span>(<span class='no'>ggplot2</span>)) {
|
||||||
|
|
||||||
<span class='no'>data</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
<span class='no'>data</span> <span class='kw'><-</span> <span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>resistance_predict</span>(<span class='kw'>col_ab</span> <span class='kw'>=</span> <span class='st'>"amox"</span>,
|
<span class='fu'>resistance_predict</span>(<span class='kw'>col_ab</span> <span class='kw'>=</span> <span class='st'>"amox"</span>,
|
||||||
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
|
||||||
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
||||||
<span class='kw'>minimum</span> <span class='kw'>=</span> <span class='fl'>15</span>)
|
<span class='kw'>minimum</span> <span class='kw'>=</span> <span class='fl'>15</span>)
|
||||||
|
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>data</span>,
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/ggplot'>ggplot</a></span>(<span class='no'>data</span>,
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>year</span>)) +
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/aes'>aes</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>year</span>)) +
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/geom_bar.html'>geom_col</a></span>(<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='kw'>y</span> <span class='kw'>=</span> <span class='no'>value</span>),
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/geom_bar'>geom_col</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/aes'>aes</a></span>(<span class='kw'>y</span> <span class='kw'>=</span> <span class='no'>value</span>),
|
||||||
<span class='kw'>fill</span> <span class='kw'>=</span> <span class='st'>"grey75"</span>) +
|
<span class='kw'>fill</span> <span class='kw'>=</span> <span class='st'>"grey75"</span>) +
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/geom_linerange.html'>geom_errorbar</a></span>(<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='kw'>ymin</span> <span class='kw'>=</span> <span class='no'>se_min</span>,
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/geom_linerange'>geom_errorbar</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/aes'>aes</a></span>(<span class='kw'>ymin</span> <span class='kw'>=</span> <span class='no'>se_min</span>,
|
||||||
<span class='kw'>ymax</span> <span class='kw'>=</span> <span class='no'>se_max</span>),
|
<span class='kw'>ymax</span> <span class='kw'>=</span> <span class='no'>se_max</span>),
|
||||||
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"grey50"</span>) +
|
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"grey50"</span>) +
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_continuous.html'>scale_y_continuous</a></span>(<span class='kw'>limits</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>),
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/scale_continuous'>scale_y_continuous</a></span>(<span class='kw'>limits</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>),
|
||||||
<span class='kw'>breaks</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0.1</span>),
|
<span class='kw'>breaks</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0.1</span>),
|
||||||
<span class='kw'>labels</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste0</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>100</span>, <span class='fl'>10</span>), <span class='st'>"%"</span>)) +
|
<span class='kw'>labels</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste0</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>100</span>, <span class='fl'>10</span>), <span class='st'>"%"</span>)) +
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/expression'>expression</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Forecast of amoxicillin resistance in "</span>,
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/labs'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/expression'>expression</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Forecast of amoxicillin resistance in "</span>,
|
||||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/grDevices/topics/plotmath'>italic</a></span>(<span class='st'>"E. coli"</span>))),
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/grDevices/topics/plotmath'>italic</a></span>(<span class='st'>"E. coli"</span>))),
|
||||||
<span class='kw'>y</span> <span class='kw'>=</span> <span class='st'>"%IR"</span>,
|
<span class='kw'>y</span> <span class='kw'>=</span> <span class='st'>"%IR"</span>,
|
||||||
<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"Year"</span>) +
|
<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"Year"</span>) +
|
||||||
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggtheme.html'>theme_minimal</a></span>(<span class='kw'>base_size</span> <span class='kw'>=</span> <span class='fl'>13</span>)
|
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/ggtheme'>theme_minimal</a></span>(<span class='kw'>base_size</span> <span class='kw'>=</span> <span class='fl'>13</span>)
|
||||||
}
|
}
|
||||||
<span class='co'># }</span></pre>
|
<span class='co'># }</span></pre>
|
||||||
</div>
|
</div>
|
||||||
@ -388,6 +404,8 @@ On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitla
|
|||||||
|
|
||||||
<li><a href="#value">Value</a></li>
|
<li><a href="#value">Value</a></li>
|
||||||
|
|
||||||
|
<li><a href="#details">Details</a></li>
|
||||||
|
|
||||||
<li><a href="#read-more-on-our-website-">Read more on our website!</a></li>
|
<li><a href="#read-more-on-our-website-">Read more on our website!</a></li>
|
||||||
|
|
||||||
<li><a href="#see-also">See also</a></li>
|
<li><a href="#see-also">See also</a></li>
|
||||||
|
@ -138,14 +138,11 @@
|
|||||||
<url>
|
<url>
|
||||||
<loc>https://msberends.gitlab.io/AMR/articles/G_test.html</loc>
|
<loc>https://msberends.gitlab.io/AMR/articles/G_test.html</loc>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
|
||||||
<loc>https://msberends.gitlab.io/AMR/articles/Predict.html</loc>
|
|
||||||
</url>
|
|
||||||
<url>
|
<url>
|
||||||
<loc>https://msberends.gitlab.io/AMR/articles/WHONET.html</loc>
|
<loc>https://msberends.gitlab.io/AMR/articles/WHONET.html</loc>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
<url>
|
||||||
<loc>https://msberends.gitlab.io/AMR/articles/ab_property.html</loc>
|
<loc>https://msberends.gitlab.io/AMR/articles/atc_property.html</loc>
|
||||||
</url>
|
</url>
|
||||||
<url>
|
<url>
|
||||||
<loc>https://msberends.gitlab.io/AMR/articles/benchmarks.html</loc>
|
<loc>https://msberends.gitlab.io/AMR/articles/benchmarks.html</loc>
|
||||||
@ -156,4 +153,7 @@
|
|||||||
<url>
|
<url>
|
||||||
<loc>https://msberends.gitlab.io/AMR/articles/mo_property.html</loc>
|
<loc>https://msberends.gitlab.io/AMR/articles/mo_property.html</loc>
|
||||||
</url>
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>https://msberends.gitlab.io/AMR/articles/resistance_predict.html</loc>
|
||||||
|
</url>
|
||||||
</urlset>
|
</urlset>
|
||||||
|
2
index.md
@ -14,7 +14,7 @@ This R package is actively maintained and free software; you can freely use and
|
|||||||
This package can be used for:
|
This package can be used for:
|
||||||
|
|
||||||
* Calculating antimicrobial resistance
|
* Calculating antimicrobial resistance
|
||||||
* Calculating empiric susceptibility of both mono therapy and combination therapy
|
* Calculating empirical susceptibility of both mono therapy and combination therapy
|
||||||
* Predicting future antimicrobial resistance using regression models
|
* Predicting future antimicrobial resistance using regression models
|
||||||
* Getting properties for any microorganism (like Gram stain, species, genus or family)
|
* Getting properties for any microorganism (like Gram stain, species, genus or family)
|
||||||
* Getting properties for any antibiotic (like name, ATC code, defined daily dose or trade name)
|
* Getting properties for any antibiotic (like name, ATC code, defined daily dose or trade name)
|
||||||
|
@ -21,7 +21,7 @@ rsi_predict(tbl, col_ab, col_date = NULL, year_min = NULL,
|
|||||||
main = paste("Resistance prediction of", attributes(x)$ab), ...)
|
main = paste("Resistance prediction of", attributes(x)$ab), ...)
|
||||||
|
|
||||||
ggplot_rsi_predict(x, main = paste("Resistance prediction of",
|
ggplot_rsi_predict(x, main = paste("Resistance prediction of",
|
||||||
attributes(x)$ab), ...)
|
attributes(x)$ab), ribbon = TRUE, ...)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{tbl}{a \code{data.frame} containing isolates.}
|
\item{tbl}{a \code{data.frame} containing isolates.}
|
||||||
@ -53,6 +53,8 @@ ggplot_rsi_predict(x, main = paste("Resistance prediction of",
|
|||||||
\item{main}{title of the plot}
|
\item{main}{title of the plot}
|
||||||
|
|
||||||
\item{...}{parameters passed on to the \code{first_isolate} function}
|
\item{...}{parameters passed on to the \code{first_isolate} function}
|
||||||
|
|
||||||
|
\item{ribbon}{a logical to indicate whether a ribbon should be shown (default) or error bars}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
\code{data.frame} with extra class \code{"resistance_predict"} with columns:
|
\code{data.frame} with extra class \code{"resistance_predict"} with columns:
|
||||||
@ -65,6 +67,7 @@ ggplot_rsi_predict(x, main = paste("Resistance prediction of",
|
|||||||
\item{\code{observed}, the original observed resistant percentages}
|
\item{\code{observed}, the original observed resistant percentages}
|
||||||
\item{\code{estimated}, the estimated resistant percentages, calculated by the model}
|
\item{\code{estimated}, the estimated resistant percentages, calculated by the model}
|
||||||
}
|
}
|
||||||
|
Furthermore, the model itself is available as an attribute: \code{attributes(x)$model}, see Examples.
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Create a prediction model to predict antimicrobial resistance for the next years on statistical solid ground. Standard errors (SE) will be returned as columns \code{se_min} and \code{se_max}. See Examples for a real live example.
|
Create a prediction model to predict antimicrobial resistance for the next years on statistical solid ground. Standard errors (SE) will be returned as columns \code{se_min} and \code{se_max}. See Examples for a real live example.
|
||||||
@ -97,7 +100,12 @@ x <- septic_patients \%>\%
|
|||||||
plot(x)
|
plot(x)
|
||||||
|
|
||||||
|
|
||||||
# create nice plots with ggplot yourself
|
# get the model from the object
|
||||||
|
mymodel <- attributes(x)$model
|
||||||
|
summary(mymodel)
|
||||||
|
|
||||||
|
|
||||||
|
# create nice plots with ggplot2 yourself
|
||||||
if (!require(ggplot2)) {
|
if (!require(ggplot2)) {
|
||||||
|
|
||||||
data <- septic_patients \%>\%
|
data <- septic_patients \%>\%
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
|
|
||||||
/* R for Data Science (r4ds) */
|
/* R for Data Science (r4ds) */
|
||||||
#r4ds a {
|
#r4ds a {
|
||||||
display: inline;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
#r4ds * {
|
#r4ds img {
|
||||||
text-align: center;
|
margin-left: 10px;
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* class for footer */
|
/* class for footer */
|
||||||
|
@ -34,15 +34,19 @@ $( document ).ready(function() {
|
|||||||
window.location.replace(url_new);
|
window.location.replace(url_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PR for 'R for Data Science' on How To pages
|
||||||
|
if ($(".template-article").length > 0) {
|
||||||
$('#sidebar').prepend(
|
$('#sidebar').prepend(
|
||||||
'<div id="r4ds">' +
|
'<div id="r4ds">' +
|
||||||
' <a href="https://r4ds.had.co.nz/">' +
|
' <a href="https://r4ds.had.co.nz/">Learn R reading this great book: R for Data Science.' +
|
||||||
' <img src="../../AMR/cover_r4ds.png" width="25%">' +
|
' <br>' +
|
||||||
' </a>' +
|
' <br>' +
|
||||||
' <p>Learn R reading this great book!</p>' +
|
' Click to read it online - it was published for free.' +
|
||||||
' <p>Or read it free online: <a href="https://r4ds.had.co.nz/" target="_blank">r4ds.co.nz</a>.</p>' +
|
' <img src="../../AMR/cover_r4ds.png" height="100px">' +
|
||||||
|
' </a> ' +
|
||||||
' <hr>' +
|
' <hr>' +
|
||||||
'</div>');
|
'</div>');
|
||||||
|
}
|
||||||
|
|
||||||
$('footer').html(
|
$('footer').html(
|
||||||
'<div>' +
|
'<div>' +
|
||||||
|
@ -17,9 +17,9 @@ editor_options:
|
|||||||
```{r setup, include = FALSE, results = 'markup'}
|
```{r setup, include = FALSE, results = 'markup'}
|
||||||
knitr::opts_chunk$set(
|
knitr::opts_chunk$set(
|
||||||
collapse = TRUE,
|
collapse = TRUE,
|
||||||
comment = "#",
|
comment = "#>",
|
||||||
fig.width = 7.5,
|
fig.width = 7.5,
|
||||||
fig.height = 4.5
|
fig.height = 5
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -106,14 +106,21 @@ ab_interpretations <- c("S", "I", "R")
|
|||||||
Using the `sample()` function, we can randomly select items from all objects we defined earlier. To let our fake data reflect reality a bit, we will also approximately define the probabilities of bacteria and the antibiotic results with the `prob` parameter.
|
Using the `sample()` function, we can randomly select items from all objects we defined earlier. To let our fake data reflect reality a bit, we will also approximately define the probabilities of bacteria and the antibiotic results with the `prob` parameter.
|
||||||
|
|
||||||
```{r merge data}
|
```{r merge data}
|
||||||
data <- data.frame(date = sample(dates, 5000, replace = TRUE),
|
sample_size <- 20000
|
||||||
patient_id = sample(patients, 5000, replace = TRUE),
|
data <- data.frame(date = sample(dates, size = sample_size, replace = TRUE),
|
||||||
hospital = sample(hospitals, 5000, replace = TRUE, prob = c(0.30, 0.35, 0.15, 0.20)),
|
patient_id = sample(patients, size = sample_size, replace = TRUE),
|
||||||
bacteria = sample(bacteria, 5000, replace = TRUE, prob = c(0.50, 0.25, 0.15, 0.10)),
|
hospital = sample(hospitals, size = sample_size, replace = TRUE,
|
||||||
amox = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.60, 0.05, 0.35)),
|
prob = c(0.30, 0.35, 0.15, 0.20)),
|
||||||
amcl = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.75, 0.10, 0.15)),
|
bacteria = sample(bacteria, size = sample_size, replace = TRUE,
|
||||||
cipr = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.80, 0.00, 0.20)),
|
prob = c(0.50, 0.25, 0.15, 0.10)),
|
||||||
gent = sample(ab_interpretations, 5000, replace = TRUE, prob = c(0.92, 0.00, 0.08))
|
amox = sample(ab_interpretations, size = sample_size, replace = TRUE,
|
||||||
|
prob = c(0.60, 0.05, 0.35)),
|
||||||
|
amcl = sample(ab_interpretations, size = sample_size, replace = TRUE,
|
||||||
|
prob = c(0.75, 0.10, 0.15)),
|
||||||
|
cipr = sample(ab_interpretations, size = sample_size, replace = TRUE,
|
||||||
|
prob = c(0.80, 0.00, 0.20)),
|
||||||
|
gent = sample(ab_interpretations, size = sample_size, replace = TRUE,
|
||||||
|
prob = c(0.92, 0.00, 0.08))
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -124,6 +131,7 @@ data <- data %>% left_join(patients_table)
|
|||||||
```
|
```
|
||||||
|
|
||||||
The resulting data set contains 5,000 blood culture isolates. With the `head()` function we can preview the first 6 values of this data set:
|
The resulting data set contains 5,000 blood culture isolates. With the `head()` function we can preview the first 6 values of this data set:
|
||||||
|
|
||||||
```{r preview data set 1, eval = FALSE}
|
```{r preview data set 1, eval = FALSE}
|
||||||
head(data)
|
head(data)
|
||||||
```
|
```
|
||||||
@ -148,6 +156,7 @@ data %>% freq(gender, markdown = FALSE, header = TRUE)
|
|||||||
So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values `M` and `F`. From a researcher perspective: there are slightly more men. Nothing we didn't already know.
|
So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values `M` and `F`. From a researcher perspective: there are slightly more men. Nothing we didn't already know.
|
||||||
|
|
||||||
The data is already quite clean, but we still need to transform some variables. The `bacteria` column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The `mutate()` function of the `dplyr` package makes this really easy:
|
The data is already quite clean, but we still need to transform some variables. The `bacteria` column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The `mutate()` function of the `dplyr` package makes this really easy:
|
||||||
|
|
||||||
```{r transform mo 1}
|
```{r transform mo 1}
|
||||||
data <- data %>%
|
data <- data %>%
|
||||||
mutate(bacteria = as.mo(bacteria))
|
mutate(bacteria = as.mo(bacteria))
|
||||||
@ -202,6 +211,7 @@ data_1st <- data %>%
|
|||||||
```
|
```
|
||||||
|
|
||||||
For future use, the above two syntaxes can be shortened with the `filter_first_isolate()` function:
|
For future use, the above two syntaxes can be shortened with the `filter_first_isolate()` function:
|
||||||
|
|
||||||
```{r 1st isolate filter 2, eval = FALSE}
|
```{r 1st isolate filter 2, eval = FALSE}
|
||||||
data_1st <- data %>%
|
data_1st <- data %>%
|
||||||
filter_first_isolate()
|
filter_first_isolate()
|
||||||
@ -263,6 +273,7 @@ data_1st <- data %>%
|
|||||||
So we end up with `r format(nrow(data_1st), big.mark = ",")` isolates for analysis.
|
So we end up with `r format(nrow(data_1st), big.mark = ",")` isolates for analysis.
|
||||||
|
|
||||||
We can remove unneeded columns:
|
We can remove unneeded columns:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
data_1st <- data_1st %>%
|
data_1st <- data_1st %>%
|
||||||
select(-c(first, keyab))
|
select(-c(first, keyab))
|
||||||
@ -359,6 +370,7 @@ data_1st %>%
|
|||||||
```
|
```
|
||||||
|
|
||||||
To make a transition to the next part, let's see how this difference could be plotted:
|
To make a transition to the next part, let's see how this difference could be plotted:
|
||||||
|
|
||||||
```{r plot 1}
|
```{r plot 1}
|
||||||
data_1st %>%
|
data_1st %>%
|
||||||
group_by(genus) %>%
|
group_by(genus) %>%
|
||||||
@ -391,6 +403,7 @@ ggplot(a_data_set,
|
|||||||
```
|
```
|
||||||
|
|
||||||
The `AMR` package contains functions to extend this `ggplot2` package, for example `geom_rsi()`. It automatically transforms data with `count_df()` or `portion_df()` and show results in stacked bars. Its simplest and shortest example:
|
The `AMR` package contains functions to extend this `ggplot2` package, for example `geom_rsi()`. It automatically transforms data with `count_df()` or `portion_df()` and show results in stacked bars. Its simplest and shortest example:
|
||||||
|
|
||||||
```{r plot 3}
|
```{r plot 3}
|
||||||
ggplot(data_1st) +
|
ggplot(data_1st) +
|
||||||
geom_rsi(translate_ab = FALSE)
|
geom_rsi(translate_ab = FALSE)
|
||||||
@ -424,6 +437,7 @@ ggplot(data_1st %>% group_by(genus)) +
|
|||||||
```
|
```
|
||||||
|
|
||||||
To simplify this, we also created the `ggplot_rsi()` function, which combines almost all above functions:
|
To simplify this, we also created the `ggplot_rsi()` function, which combines almost all above functions:
|
||||||
|
|
||||||
```{r plot 5}
|
```{r plot 5}
|
||||||
data_1st %>%
|
data_1st %>%
|
||||||
group_by(genus) %>%
|
group_by(genus) %>%
|
||||||
|
@ -17,7 +17,7 @@ editor_options:
|
|||||||
```{r setup, include = FALSE, results = 'markup'}
|
```{r setup, include = FALSE, results = 'markup'}
|
||||||
knitr::opts_chunk$set(
|
knitr::opts_chunk$set(
|
||||||
collapse = TRUE,
|
collapse = TRUE,
|
||||||
comment = "#",
|
comment = "#>",
|
||||||
fig.width = 7.5,
|
fig.width = 7.5,
|
||||||
fig.height = 4.5
|
fig.height = 4.5
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,7 @@ editor_options:
|
|||||||
```{r setup, include = FALSE, results = 'markup'}
|
```{r setup, include = FALSE, results = 'markup'}
|
||||||
knitr::opts_chunk$set(
|
knitr::opts_chunk$set(
|
||||||
collapse = TRUE,
|
collapse = TRUE,
|
||||||
comment = "#"
|
comment = "#>"
|
||||||
)
|
)
|
||||||
# set to original language (English)
|
# set to original language (English)
|
||||||
Sys.setlocale(locale = "C")
|
Sys.setlocale(locale = "C")
|
@ -16,8 +16,10 @@ editor_options:
|
|||||||
```{r setup, include = FALSE, results = 'markup'}
|
```{r setup, include = FALSE, results = 'markup'}
|
||||||
knitr::opts_chunk$set(
|
knitr::opts_chunk$set(
|
||||||
collapse = TRUE,
|
collapse = TRUE,
|
||||||
comment = "#"
|
comment = "#>"
|
||||||
)
|
)
|
||||||
|
# set to original language (English)
|
||||||
|
Sys.setlocale(locale = "C")
|
||||||
```
|
```
|
||||||
|
|
||||||
*(will be available soon)*
|
*(will be available soon)*
|
||||||
|
@ -16,9 +16,9 @@ editor_options:
|
|||||||
```{r setup, include = FALSE, results = 'markup'}
|
```{r setup, include = FALSE, results = 'markup'}
|
||||||
knitr::opts_chunk$set(
|
knitr::opts_chunk$set(
|
||||||
collapse = TRUE,
|
collapse = TRUE,
|
||||||
comment = "#",
|
comment = "#>",
|
||||||
fig.width = 7.5,
|
fig.width = 7.5,
|
||||||
fig.height = 4.5
|
fig.height = 4.75
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ library(AMR)
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Prediction analysis
|
## Prediction analysis
|
||||||
Our package contains a function `resistance_predict()`, which takes the same input as functions for [other AMR analysis](./articles/AMR.html). Based on a date column, it calculates cases per year and uses a regression model to predict antimicrobial resistance.
|
Our package contains a function `resistance_predict()`, which takes the same input as functions for [other AMR analysis](./AMR.html). Based on a date column, it calculates cases per year and uses a regression model to predict antimicrobial resistance.
|
||||||
|
|
||||||
It is basically as easy as:
|
It is basically as easy as:
|
||||||
```{r, eval = FALSE}
|
```{r, eval = FALSE}
|
||||||
@ -53,27 +53,36 @@ predict_pita <- septic_patients %>%
|
|||||||
resistance_predict(col_ab = "pita")
|
resistance_predict(col_ab = "pita")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The function will look for a date column itself if `col_date` is not set.
|
||||||
|
|
||||||
|
When running any of these commands, a summary of the regression model will be printed unless using `resistance_predict(..., info = FALSE)`.
|
||||||
|
|
||||||
```{r, echo = FALSE}
|
```{r, echo = FALSE}
|
||||||
predict_pita <- septic_patients %>%
|
predict_pita <- septic_patients %>%
|
||||||
resistance_predict(col_ab = "pita")
|
resistance_predict(col_ab = "pita")
|
||||||
```
|
```
|
||||||
|
|
||||||
The function will look for a data column itself if `col_date` is not set. The result is nothing more than a `data.frame`, containing the years, number of observations, actual observed resistance, the estimated resistance and the standard error below and above the estimation:
|
This text is only a printed summary - the actual result (output) of the function is a `data.frame` containing for each year: the number of observations, the actual observed resistance, the estimated resistance and the standard error below and above the estimation:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
predict_pita
|
predict_pita
|
||||||
```
|
```
|
||||||
|
|
||||||
The function `plot` is available in base R, and can be extended by other packages to depend the output based on the type of input. We extended its function to cope with resistance predictions:
|
The function `plot` is available in base R, and can be extended by other packages to depend the output based on the type of input. We extended its function to cope with resistance predictions:
|
||||||
|
|
||||||
```{r}
|
```{r, fig.height = 5.5}
|
||||||
plot(predict_pita)
|
plot(predict_pita)
|
||||||
```
|
```
|
||||||
|
|
||||||
We also support the `ggplot2` package with the function `ggplot_rsi_predict()`:
|
This is the fastest way to plot the result. It automatically adds the right axes, error bars, titles, number of available observations and type of model.
|
||||||
|
|
||||||
|
We also support the `ggplot2` package with our custom function `ggplot_rsi_predict()` to create more appealing plots:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
library(ggplot2)
|
|
||||||
ggplot_rsi_predict(predict_pita)
|
ggplot_rsi_predict(predict_pita)
|
||||||
|
|
||||||
|
# choose for error bars instead of a ribbon
|
||||||
|
ggplot_rsi_predict(predict_pita, ribbon = FALSE)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Choosing the right model
|
### Choosing the right model
|
||||||
@ -84,7 +93,7 @@ Resistance is not easily predicted; if we look at vancomycin resistance in Gram
|
|||||||
septic_patients %>%
|
septic_patients %>%
|
||||||
filter(mo_gramstain(mo) == "Gram positive") %>%
|
filter(mo_gramstain(mo) == "Gram positive") %>%
|
||||||
resistance_predict(col_ab = "vanc", year_min = 2010, info = FALSE) %>%
|
resistance_predict(col_ab = "vanc", year_min = 2010, info = FALSE) %>%
|
||||||
plot()
|
ggplot_rsi_predict()
|
||||||
```
|
```
|
||||||
|
|
||||||
Vancomycin resistance could be 100% in ten years, but might also stay around 0%.
|
Vancomycin resistance could be 100% in ten years, but might also stay around 0%.
|
||||||
@ -99,13 +108,22 @@ Valid values are:
|
|||||||
| `"loglin"` or `"poisson"` | `glm(..., family = poisson)` | Generalised linear model with poisson distribution |
|
| `"loglin"` or `"poisson"` | `glm(..., family = poisson)` | Generalised linear model with poisson distribution |
|
||||||
| `"lin"` or `"linear"` | `lm()` | Linear model |
|
| `"lin"` or `"linear"` | `lm()` | Linear model |
|
||||||
|
|
||||||
For the vancomycin resistance in Gram positive bacteria, a linear model might be more appropriate since no (left half of a) binomial distribution is to be expected based on observed years:
|
For the vancomycin resistance in Gram positive bacteria, a linear model might be more appropriate since no (left half of a) binomial distribution is to be expected based on the observed years:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
septic_patients %>%
|
septic_patients %>%
|
||||||
filter(mo_gramstain(mo) == "Gram positive") %>%
|
filter(mo_gramstain(mo) == "Gram positive") %>%
|
||||||
resistance_predict(col_ab = "vanc", year_min = 2010, info = FALSE, model = "linear") %>%
|
resistance_predict(col_ab = "vanc", year_min = 2010, info = FALSE, model = "linear") %>%
|
||||||
plot()
|
ggplot_rsi_predict()
|
||||||
```
|
```
|
||||||
|
|
||||||
This seems more likely, doesn't it?
|
This seems more likely, doesn't it?
|
||||||
|
|
||||||
|
The model itself is also available from the object, as an `attribute`:
|
||||||
|
```{r}
|
||||||
|
model <- attributes(predict_pita)$model
|
||||||
|
|
||||||
|
summary(model)$family
|
||||||
|
|
||||||
|
summary(model)$coefficients
|
||||||
|
```
|