Skip to content

Commit 428fffd

Browse files
committed
use fit_options() for .fit_options arg input
1 parent 2e7d651 commit 428fffd

5 files changed

Lines changed: 52 additions & 14 deletions

File tree

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export(calculate_shrinkage)
1515
export(calculate_stats)
1616
export(compare_psn_execute_results)
1717
export(compare_psn_proseval_results)
18+
export(fit_options)
1819
export(group_by_dose)
1920
export(group_by_time)
2021
export(install_default_literature_model)

R/run_eval.R

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@
3232
#' result from a call to [stats_summ_options()].
3333
#' @param .vpc_options Options for VPC simulations. This must be the result from
3434
#' a call to [vpc_options()].
35-
#' @param .fit_options Options for controlling MAP Bayesian fit. E.g.
36-
#' `.map_options = list(control = list(reltol = 1e-04))` will perform a slightly
37-
#' coarser fit (but more stable) which can be useful in some case (default
38-
#' `reltol = 1e-05`).
35+
#' @param .fit_options Options for controlling MAP Bayesian fit. This must be
36+
#' the result from a call to [fit_options()].
3937
#' @param threads number of threads to divide computations on. Default is 1,
4038
#' i.e. no parallel execution
4139
#' @param ruv residual error variability magnitude, specified as list.
@@ -67,7 +65,7 @@ run_eval <- function(
6765
incremental = FALSE,
6866
.stats_summ_options = stats_summ_options(),
6967
.vpc_options = vpc_options(),
70-
.fit_options = list(),
68+
.fit_options = fit_options(),
7169
threads = 1,
7270
progress = TRUE,
7371
verbose = TRUE
@@ -195,3 +193,26 @@ run_eval <- function(
195193
## 5. Return results
196194
out
197195
}
196+
197+
#' Options for controlling MAP Bayesian fit
198+
#'
199+
#' @param ... These dots are reserved for future extensibility and must be empty.
200+
#' @param reltol Relative convergence tolerance. `reltol = 1e-04` will perform a
201+
#' slightly coarser but more stable fit, which can be useful in some case.
202+
#'
203+
#' @returns A list.
204+
#' @export
205+
fit_options <- function(
206+
...,
207+
reltol = 1e-05
208+
) {
209+
rlang::check_dots_empty()
210+
out <- list(
211+
control = list(
212+
reltol = vctrs::vec_assert(
213+
reltol, ptype = numeric(), size = 1L, arg = "reltol"
214+
)
215+
)
216+
)
217+
structure(out, class = "mipdeval_fit_options")
218+
}

man/fit_options.Rd

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/run_eval.Rd

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/run_eval_core.Rd

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)