mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 20:41:58 +02:00
(v0.7.1.9063) septic_patients -> example_isolates
This commit is contained in:
@ -461,12 +461,12 @@ data_1st %>%
|
||||
|
||||
## Independence test
|
||||
|
||||
The next example uses the included `septic_patients`, which is an anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found in septic patients in 4 different hospitals in the Netherlands, between 2001 and 2017. It is true, genuine data. This `data.frame` can be used to practice AMR analysis.
|
||||
The next example uses the included `example_isolates`, which is an anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found in septic patients in 4 different hospitals in the Netherlands, between 2001 and 2017. This `data.frame` can be used to practice AMR analysis.
|
||||
|
||||
We will compare the resistance to fosfomycin (column `FOS`) in hospital A and D. The input for the `fisher.test()` can be retrieved with a transformation like this:
|
||||
|
||||
```{r, results = 'markup'}
|
||||
check_FOS <- septic_patients %>%
|
||||
check_FOS <- example_isolates %>%
|
||||
filter(hospital_id %in% c("A", "D")) %>% # filter on only hospitals A and D
|
||||
select(hospital_id, FOS) %>% # select the hospitals and fosfomycin
|
||||
group_by(hospital_id) %>% # group on the hospitals
|
||||
|
@ -114,8 +114,8 @@ Repetitive results are unique values that are present more than once. Unique val
|
||||
|
||||
```{r, message = FALSE}
|
||||
library(dplyr)
|
||||
# take all MO codes from the septic_patients data set
|
||||
x <- septic_patients$mo %>%
|
||||
# take all MO codes from the example_isolates data set
|
||||
x <- example_isolates$mo %>%
|
||||
# keep only the unique ones
|
||||
unique() %>%
|
||||
# pick 50 of them at random
|
||||
|
@ -42,15 +42,15 @@ Our package contains a function `resistance_predict()`, which takes the same inp
|
||||
It is basically as easy as:
|
||||
```{r, eval = FALSE}
|
||||
# resistance prediction of piperacillin/tazobactam (TZP):
|
||||
resistance_predict(tbl = septic_patients, col_date = "date", col_ab = "TZP", model = "binomial")
|
||||
resistance_predict(tbl = example_isolates, col_date = "date", col_ab = "TZP", model = "binomial")
|
||||
|
||||
# or:
|
||||
septic_patients %>%
|
||||
example_isolates %>%
|
||||
resistance_predict(col_ab = "TZP",
|
||||
model "binomial")
|
||||
|
||||
# to bind it to object 'predict_TZP' for example:
|
||||
predict_TZP <- septic_patients %>%
|
||||
predict_TZP <- example_isolates %>%
|
||||
resistance_predict(col_ab = "TZP",
|
||||
model = "binomial")
|
||||
```
|
||||
@ -60,7 +60,7 @@ 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}
|
||||
predict_TZP <- septic_patients %>%
|
||||
predict_TZP <- example_isolates %>%
|
||||
resistance_predict(col_ab = "TZP", model = "binomial")
|
||||
```
|
||||
|
||||
@ -92,7 +92,7 @@ ggplot_rsi_predict(predict_TZP, ribbon = FALSE)
|
||||
Resistance is not easily predicted; if we look at vancomycin resistance in Gram positives, the spread (i.e. standard error) is enormous:
|
||||
|
||||
```{r}
|
||||
septic_patients %>%
|
||||
example_isolates %>%
|
||||
filter(mo_gramstain(mo, language = NULL) == "Gram-positive") %>%
|
||||
resistance_predict(col_ab = "VAN", year_min = 2010, info = FALSE, model = "binomial") %>%
|
||||
ggplot_rsi_predict()
|
||||
@ -113,7 +113,7 @@ Valid values are:
|
||||
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}
|
||||
septic_patients %>%
|
||||
example_isolates %>%
|
||||
filter(mo_gramstain(mo, language = NULL) == "Gram-positive") %>%
|
||||
resistance_predict(col_ab = "VAN", year_min = 2010, info = FALSE, model = "linear") %>%
|
||||
ggplot_rsi_predict()
|
||||
|
Reference in New Issue
Block a user