Skip to content

Commit 7b8a385

Browse files
roninsightrxclaude
andcommitted
Merge master into add-cwres-foce
Resolves conflicts in R/calc_residuals.R and R/get_map_estimates.R where master removed `...` while this branch added new explicit parameters and used `...` to forward to the new CWRES code. Resolution: accept master's intent (drop `...` from the public signatures and all downstream sim_ode calls) while keeping the new explicit `nonfixed`, `as_eta`, `steady_state_analytic`, and `weight_prior_var` parameters of calc_residuals(). Also drop `...` from calc_cwres()/simulate_with_etas() since nothing flows in any more. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 parents ce54111 + ac36c53 commit 7b8a385

8 files changed

Lines changed: 21 additions & 40 deletions

R/calc_cwres.R

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#' Used to scale omega in the FOCE Hessian computation to match the
4343
#' estimation objective. CWRES uses the unscaled omega (model diagnostic).
4444
#' @param delta perturbation size for finite differences
45-
#' @param ... additional arguments passed to PKPDsim::sim_ode
4645
#'
4746
#' @return list with components:
4847
#' \item{cwres}{numeric vector of CWRES values}
@@ -73,8 +72,7 @@ calc_cwres <- function(
7372
t_init = 0,
7473
steady_state_analytic = NULL,
7574
weight_prior_var = 1,
76-
delta = 1e-4,
77-
...
75+
delta = 1e-4
7876
) {
7977
n_obs <- length(y)
8078
n_eta <- length(eta_hat)
@@ -98,13 +96,13 @@ calc_cwres <- function(
9896
eta_plus, parameters_population, nonfixed, as_eta,
9997
model, covariates, regimen, lagtime, t_obs, obs_type_sim,
10098
int_step_size, iov_bins, A_init, t_init,
101-
steady_state_analytic, ...
99+
steady_state_analytic
102100
)
103101
pred_minus <- simulate_with_etas(
104102
eta_minus, parameters_population, nonfixed, as_eta,
105103
model, covariates, regimen, lagtime, t_obs, obs_type_sim,
106104
int_step_size, iov_bins, A_init, t_init,
107-
steady_state_analytic, ...
105+
steady_state_analytic
108106
)
109107

110108
F_matrix[, j] <- (transf(pred_plus) - transf(pred_minus)) / (2 * delta)
@@ -194,8 +192,7 @@ simulate_with_etas <- function(
194192
iov_bins,
195193
A_init,
196194
t_init,
197-
steady_state_analytic,
198-
...
195+
steady_state_analytic
199196
) {
200197
# Compute individual parameters from etas
201198
par <- parameters_population
@@ -242,8 +239,7 @@ simulate_with_etas <- function(
242239
A_init = a_init,
243240
iov_bins = iov_bins,
244241
t_init = t_init,
245-
lagtime = lagtime,
246-
...
242+
lagtime = lagtime
247243
)
248244
})
249245

R/calc_residuals.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#' @param nonfixed character vector of non-fixed parameter names
1414
#' @param as_eta character vector of parameters estimated directly as eta
1515
#' @param steady_state_analytic steady state settings (or NULL)
16+
#' @param weight_prior_var prior weight variance scaling factor (default 1).
17+
#' Forwarded to `calc_cwres()` to scale omega in the FOCE Hessian.
1618
#'
1719
calc_residuals <- function(
1820
obj,
@@ -39,8 +41,7 @@ calc_residuals <- function(
3941
nonfixed = NULL,
4042
as_eta = c(),
4143
steady_state_analytic = NULL,
42-
weight_prior_var = 1,
43-
...
44+
weight_prior_var = 1
4445
) {
4546

4647
## Observation vectors
@@ -68,8 +69,7 @@ calc_residuals <- function(
6869
iov_bins = iov_bins,
6970
output_include = output_include,
7071
t_init = t_init,
71-
lagtime = lagtime,
72-
...
72+
lagtime = lagtime
7373
)
7474
})
7575
suppressMessages({
@@ -88,8 +88,7 @@ calc_residuals <- function(
8888
iov_bins = iov_bins,
8989
A_init = A_init_population,
9090
t_init = t_init,
91-
lagtime = lagtime,
92-
...
91+
lagtime = lagtime
9392
)
9493
})
9594

@@ -140,8 +139,7 @@ calc_residuals <- function(
140139
A_init = A_init_individual,
141140
t_init = t_init,
142141
steady_state_analytic = steady_state_analytic,
143-
weight_prior_var = weight_prior_var,
144-
...
142+
weight_prior_var = weight_prior_var
145143
),
146144
error = function(e) {
147145
warning("CWRES computation failed: ", e$message)

R/get_map_estimates.R

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@
6161
#'option is `TRUE`.
6262
#' @param skip_hessian skip calculation of Hessian
6363
#' @param verbose show more output
64-
#' @param ... parameters passed on to `sim_ode()` function
65-
#'
64+
#'
6665
#' @examples
6766
#' \dontrun{
6867
#' ## define parameters
@@ -134,8 +133,7 @@ get_map_estimates <- function(
134133
verbose = FALSE,
135134
A_init = NULL,
136135
skip_hessian = FALSE,
137-
output_include = list(covariates = FALSE, parameters = FALSE),
138-
...) {
136+
output_include = list(covariates = FALSE, parameters = FALSE)) {
139137

140138
## get prior weight for scaling of variance term
141139
weight_prior_var <- parse_weight_prior(weight_prior, type)
@@ -232,8 +230,7 @@ get_map_estimates <- function(
232230
t_max = tail(t_obs, 1) + t_init + 1,
233231
iov_bins = iov_bins,
234232
return_design = TRUE,
235-
t_init = t_init,
236-
...
233+
t_init = t_init
237234
)
238235
})
239236

@@ -434,8 +431,7 @@ get_map_estimates <- function(
434431
nonfixed = omega$nonfixed,
435432
as_eta = as_eta,
436433
steady_state_analytic = steady_state_analytic,
437-
weight_prior_var = weight_prior_var,
438-
...
434+
weight_prior_var = weight_prior_var
439435
)
440436
}
441437

man/calc_cwres.Rd

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

man/calc_residuals.Rd

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

man/get_map_estimates.Rd

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

man/map_shrinkage_control.Rd

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

man/simulate_with_etas.Rd

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

0 commit comments

Comments
 (0)