Skip to content

Commit

Permalink
Merge pull request #13 from SACEMA/fix-issue-11
Browse files Browse the repository at this point in the history
Fix issues #11&12
  • Loading branch information
Eduard Grebe committed May 26, 2016
2 parents 031498e + 879005e commit cc311a9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions inctools/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Encoding: UTF-8
Package: inctools
Type: Package
Title: Incidence Estimation Tools
Version: 1.0.4
Date: 2016-05-19
Version: 1.0.5
Date: 2016-05-27
Authors@R: c(
person("Alex","Welte", email="[email protected]", role="aut"),
person("Eduard","Grebe",email="[email protected]",role=c("cre","aut")),
Expand Down
19 changes: 14 additions & 5 deletions inctools/R/calibration_mdri.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,17 @@ mdrical <- function(data = NULL, subid_var = NULL, time_var = NULL, functional_f
}

if (is.null(recency_rule)) {
stop("Please specify a Recency Rule")
stop("Please specify a recency rule")
}

if (is.null(recency_vars)) {
stop("Please specify at least one Recency Variable")
}

if (recency_rule != "binary_data" & recency_rule != "independent_thresholds") {
stop("Please specify a valid recency rule")
}

if (recency_rule == "binary_data") {
if (length(recency_vars) > 1) {
stop("Binary data should be specified in one recency (outcome) variable.")
Expand Down Expand Up @@ -441,10 +445,15 @@ plot_probability <- function(functional_form = functional_form, parameters = par
y = plotdata$probability))
plotout <- plotout + ggplot2::labs(x = "Time (since detectable infection)", y = "Probability of testing recent")
plotout <- plotout + ggplot2::geom_vline(xintercept = mdri, colour = "blue")
plotout <- plotout + ggplot2::geom_vline(xintercept = mdri_ci[1], colour = "blue",
alpha = 0.7, linetype = "dashed")
plotout <- plotout + ggplot2::geom_vline(xintercept = mdri_ci[2], colour = "blue",
alpha = 0.7, linetype = "dashed")
if (!is.na(mdri_ci[1]) & !is.na(mdri_ci[2]) & !is.null(mdri_ci[1]) &
!is.null(mdri_ci[2])) {
plotout <- plotout + ggplot2::geom_vline(xintercept = mdri_ci[1],
colour = "blue", alpha = 0.7,
linetype = "dashed")
plotout <- plotout + ggplot2::geom_vline(xintercept = mdri_ci[2],
colour = "blue", alpha = 0.7,
linetype = "dashed")
}
plotout <- plotout + ggplot2::annotate("text", label = "MDRI", x = mdri + 50,
y = 0.95, colour = "blue")
plotout <- plotout + ggplot2::geom_vline(xintercept = recency_cutoff_time, colour = "red")
Expand Down
5 changes: 4 additions & 1 deletion inctools/man/incprops.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cc311a9

Please sign in to comment.