Skip to content

Commit

Permalink
🔜clean merge devel in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
pierucci committed Oct 30, 2016
2 parents a61f352 + ef8ca6f commit f094b7f
Show file tree
Hide file tree
Showing 101 changed files with 2,063 additions and 896 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
^README\.html$
^vignettes/.*\.html$
^vignettes/.*\.md$
^codecov\.yaml$
^codecov\.yml$
^data-raw$
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: heemod
Title: Models for Health Economic Evaluation
Version: 0.4.0
Version: 0.5.1
Authors@R: c(
person("Antoine", "Filipovic-Pierucci", email = "pierucci@gmail.com", role = c("aut", "cre")),
person("Kevin", "Zarca", email = "kevin.zarca@urc-eco.fr", role = "aut"),
Expand Down Expand Up @@ -37,8 +37,9 @@ VignetteBuilder: knitr
RoxygenNote: 5.0.1
Suggests: knitr,
parallel,
formatR,
readxl,
rmarkdown,
testthat
URL: https://github.com/pierucci/heemod, https://pierucci.github.io
URL: https://github.com/pierucci/heemod, http://pierucci.org
BugReports: https://github.com/pierucci/heemod/issues
46 changes: 38 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
# Generated by roxygen2: do not edit by hand

S3method(get_code,run_models)
S3method(expand_state,uneval_matrix)
S3method(expand_state,uneval_state_list)
S3method(get_code,run_model)
S3method(get_code,state)
S3method(get_code,uneval_matrix)
S3method(get_code,uneval_model)
S3method(get_code,uneval_parameters)
S3method(get_code,uneval_state_list)
S3method(get_counts,combined_models)
S3method(get_counts,eval_model)
S3method(get_counts,list)
S3method(get_counts,run_models)
S3method(get_counts,run_model)
S3method(get_counts,updated_models)
S3method(get_values,combined_models)
S3method(get_values,eval_model)
S3method(get_values,list)
S3method(get_values,run_model)
S3method(get_values,updated_models)
S3method(has_state_cycle,state)
S3method(has_state_cycle,uneval_matrix)
S3method(has_state_cycle,uneval_state_list)
S3method(interp_heemod,default)
S3method(interp_heemod,state)
S3method(interp_heemod,uneval_matrix)
S3method(interp_heemod,uneval_state_list)
S3method(modify,state)
S3method(modify,uneval_matrix)
S3method(modify,uneval_parameters)
S3method(plot,combined_models)
S3method(plot,eval_sensitivity)
S3method(plot,probabilistic)
S3method(plot,run_models)
S3method(plot,run_model)
S3method(plot,uneval_matrix)
S3method(plot,updated_models)
S3method(print,combined_models)
S3method(print,eval_matrix)
S3method(print,eval_sensitivity)
S3method(print,eval_state_list)
S3method(print,heemod_code)
S3method(print,run_models)
S3method(print,run_model)
S3method(print,sensitivity)
S3method(print,state)
S3method(print,summary_run_models)
S3method(print,summary_run_model)
S3method(print,summary_sensitivity)
S3method(print,summary_updated_models)
S3method(print,uneval_matrix)
Expand All @@ -36,24 +52,33 @@ S3method(print,uneval_state_list)
S3method(print,updated_models)
S3method(summary,combined_models)
S3method(summary,eval_sensitivity)
S3method(summary,run_models)
S3method(summary,run_model)
S3method(summary,updated_models)
S3method(update,run_models)
S3method(update,run_model)
export(cluster_for_heemod)
export(define_correlation)
export(define_distrib)
export(define_distrib_)
export(define_dsa)
export(define_matrix)
export(define_matrix_)
export(define_model)
export(define_model_)
export(define_parameters)
export(define_parameters_)
export(define_psa)
export(define_sensitivity)
export(define_sensitivity_)
export(define_state)
export(define_state_)
export(define_strategy)
export(define_strategy_)
export(define_transition)
export(discount)
export(get_code)
export(get_counts)
export(get_init)
export(get_values)
export(get_who_mr)
export(logitnormal)
export(lognormal)
Expand All @@ -67,10 +92,14 @@ export(prob_to_prob)
export(prop)
export(rate_to_prob)
export(rr_to_prob)
export(run_dsa)
export(run_model)
export(run_model_)
export(run_model_tabular)
export(run_models)
export(run_models_)
export(run_models_tabular)
export(run_probabilistic)
export(run_psa)
export(run_sensitivity)
importFrom(Hmisc,wtd.mean)
importFrom(Hmisc,wtd.quantile)
Expand Down Expand Up @@ -106,6 +135,7 @@ importFrom(grDevices,png)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(lazyeval,as.lazy_dots)
importFrom(lazyeval,interp)
importFrom(lazyeval,lazy)
importFrom(lazyeval,lazy_dots)
importFrom(lazyeval,lazy_eval)
Expand Down
25 changes: 23 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
# heemod devel
# heemod 0.5.1

## Bugfixes

* Added `formatR` to suggest list.

# heemod 0.5.0

## Breaking changes

* Some functions were renamed for clarification:
* `define_strategy()` <- `define_model()`
* `run_model()` <- `run_models()`
* `define_transition()` <- `define_matrix()`
* `define_dsa()` <- `define_sensitivity()`
* `define_psa()` <- `define_distrib()`
* `run_dsa()` <- `run_sensitivity()`
* `run_psa()` <- `run_probabilistic()`

## New features

* Values and probabilities can depend on state time with `state_cycle`, allowing to reproduce the results of microsimulations.
* `define_sensitivity()` now accepts any expression as input, and can call references to model parameteres.
* Discount rates can now be specified as parameters (allows for rates to be modified in DSA & PSA).
* Any state value can be plotted.
* Additional output: csv files for many of the tabular results.

## Bugfixes

* Edges where P=0 are not plotted anymore for transition matrices.
* There used to be a potential error when you wanted to save output but there had been no psa.

# heemod 0.4.0

Expand Down Expand Up @@ -42,7 +63,7 @@

## Acknowledments

* Thanks to [Matthew Wiener](https://github.com/MattWiener), [Zdenek Kabat](https://github.com/ZdenekKabat) and [Vojtech Filipec](https://github.com/vojtech-filipec) for their great contributions to this update.
* Thanks to [Matthew Wiener](https://github.com/MattWiener), [Zdenek Kabat](https://github.com/zkabat) and [Vojtech Filipec](https://github.com/vojtech-filipec) for their great contributions to this update.

# heemod 0.3.3

Expand Down
2 changes: 1 addition & 1 deletion R/acceptability_curve.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Acceptability Curve from Probabilistic Analysis
#'
#'
#' @param x Result from \code{\link{run_sensitivity}}.
#' @param x Result from \code{\link{run_dsa}}.
#' @param wtp_thresholds willingness to pay thresholds
#'
#' @return A data frame with columns \code{.ceac} (the
Expand Down
11 changes: 5 additions & 6 deletions R/cluster_for_heemod.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#' Prepare a cluster to use with heemod
#'
#'
#' @param num_cores The number of cores desired
#'
#' @return If num_cores is 1 or 0, NULL. If num_cores is
#' a larger integer, a cluster loaded with the appropriate packages.
#'
#' @return If num_cores is 1 or 0, NULL. If num_cores is a
#' larger integer, a cluster loaded with the appropriate
#' packages.
#' @export
#'
#' @examples
cluster_for_heemod <- function(num_cores) {
cl <- NULL
if (length(num_cores)) {
Expand Down
39 changes: 27 additions & 12 deletions R/combine.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param oldmodel The original model.
#'
#' @return A \code{combined_models} object, mostly similar
#' to a result from \code{\link{run_models}}. \code{plot}
#' to a result from \code{\link{run_model}}. \code{plot}
#' and \code{summary} methods are available.
#'
#' @keywords internal
Expand All @@ -27,8 +27,8 @@ combine_models <- function(list_newmodels, weights, oldmodel) {
# collapse each new model values and counts

list_res <- list()
list_counts <- list()
for (i in seq_along(list_newmodels)) {
list_eval_models <- list()
for (i in seq_along(list_newmodels)) {
collapsed_values <- (list_newmodels[[i]]) %>%
dplyr::rowwise() %>%
dplyr::do_(~ get_total_state_values(.$.mod)) %>%
Expand All @@ -38,23 +38,38 @@ combine_models <- function(list_newmodels, weights, oldmodel) {
tab_counts <- (list_newmodels[[i]]) %>%
dplyr::rowwise() %>%
dplyr::do_(.counts = ~ get_counts(.$.mod))


tab_vals <- (list_newmodels[[i]]) %>%
dplyr::rowwise() %>%
dplyr::do_(.vals = ~ get_values(.$.mod))

counts <- tab_counts$.counts %>%
mapply(
weights,
FUN = function(x, y) x * y / total_weights,
SIMPLIFY = FALSE) %>%
Reduce(f = "+")

vals <- tab_vals$.vals %>%
mapply(
weights,
FUN = function(x, y) x * y / total_weights,
SIMPLIFY = FALSE) %>%
Reduce(f = "+")


list_res <- c(
list_res,
list(collapsed_values)
)

list_counts <- c(
list_counts,
setNames(list(list(counts = counts)), model_names[i])
)
list_eval_models <-
c(
list_eval_models,
setNames(list(list(counts = counts,
values = vals)),
model_names[i])
)
}

for (i in seq_along(model_names)){
Expand All @@ -67,7 +82,7 @@ combine_models <- function(list_newmodels, weights, oldmodel) {
res,
class = c("combined_models", class(res)),
base_model = get_base_model(oldmodel),
eval_model_list = list_counts,
eval_model_list = list_eval_models,
parameters = attr(oldmodel, "parameters"),
init = attr(oldmodel, "init"),
cycles = attr(oldmodel, "cycles"),
Expand All @@ -84,14 +99,14 @@ print.combined_models <- function(x, ...) {

#' @export
plot.combined_models <- function(x, ...) {
plot.run_models(x, ...)
plot.run_model(x, ...)
}

#' @export
summary.combined_models <- function(object, ...) {
summary.run_models(object, ...)
summary.run_model(object, ...)
}

normalize_ce.combined_models <- function(x, ...) {
normalize_ce.run_models(x, ...)
normalize_ce.run_model(x, ...)
}
83 changes: 83 additions & 0 deletions R/deprecated.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#' @export
#' @rdname define_strategy
define_model <- function(...) {
warning("'define_model' is deprecated, use 'define_strategy' instead.")
define_strategy(...)
}

#' @export
#' @rdname define_strategy
define_model_ <- function(...) {
warning("'define_model_' is deprecated, use 'define_strategy_' instead.")
define_strategy_(...)
}

#' @export
#' @rdname run_model
run_models <- function(...) {
warning("'run_models' is deprecated, use 'run_model' (no 's') instead.")
run_model(...)
}

#' @export
#' @rdname run_model
run_models_ <- function(...) {
warning("'run_models_' is deprecated, use 'run_model_' (no 's') instead.")
run_model_(...)
}

#' @export
#' @rdname define_transition
define_matrix <- function(...) {
warning("'define_matrix' is deprecated, use 'define_transition' instead.")
define_transition(...)
}

#' @export
#' @rdname define_transition
define_matrix_ <- function(...) {
warning("'define_matrix_' is deprecated, use 'define_transition_' instead.")
define_transition_(...)
}

#' @export
#' @rdname define_dsa
define_sensitivity <- function(...) {
warning("'define_sensitivity' is deprecated, use 'define_dsa' instead.")
define_dsa(...)
}

#' @export
#' @rdname define_dsa
define_sensitivity_ <- function(...) {
warning("'define_sensitivity_' is deprecated, use 'define_dsa_' instead.")
define_dsa_(...)
}

#' @export
#' @rdname define_psa
define_distrib <- function(...) {
warning("'define_distrib' is deprecated, use 'define_psa' instead.")
define_psa(...)
}

#' @export
#' @rdname define_psa
define_distrib_ <- function(...) {
warning("'define_distrib_' is deprecated, use 'define_psa_' instead.")
define_psa_(...)
}

#' @export
#' @rdname run_dsa
run_sensitivity <- function(model, sensitivity) {
warning("'run_sensitivity' is deprecated, use 'run_dsa' instead.")
run_dsa(model = model, sensitivity = sensitivity)
}

#' @export
#' @rdname run_psa
run_probabilistic <- function(model, resample, N) {
warning("'run_probabilistic' is deprecated, use 'run_psa' instead.")
run_psa(model = model, resample = resample, N = N)
}
Loading

0 comments on commit f094b7f

Please sign in to comment.