Skip to content

Commit

Permalink
prefer params over omega/sigma
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Dec 7, 2023
1 parent af801af commit 9bcbfd3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ mu-referencing style to run the optimization.

## Bug fixes

- Simulating/solving from functions/ui now prefers params over `omega`
and `sigma` in the model (#632)

- Piping does not add constants to the initial estimates

- When constants are specified in the `model({})` block (like `k <- 1`), they will not
Expand Down
26 changes: 26 additions & 0 deletions R/rxsolve.R
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,19 @@ rxSolve.function <- function(object, params = NULL, events = NULL, inits = NULL,
.rxControl$omega <- NULL
}
}
if (inherits(.rxControl$omega, "matrix")) {
.omega <- .rxControl$omega
.v <- vapply(dimnames(.omega)[[1]],
function(v) {
!(v %in% names(params))
}, logical(1), USE.NAMES = FALSE)
.omega <- .omega[.v, .v]
if (dim(.omega)[1] == 0) {
.rxControl$omega <- NULL
} else {
.rxControl$omega <- NULL
}
}
if (inherits(.rxControl$omega, "matrix") &&
all(dim(.rxControl$omega) == c(0,0))) {
.rxControl$omega <- NULL
Expand All @@ -1235,6 +1248,19 @@ rxSolve.function <- function(object, params = NULL, events = NULL, inits = NULL,
.rxControl$sigma <- NULL
}
}
if (inherits(.rxControl$sigma, "matrix")) {
.sigma <- .rxControl$sigma
.v <- vapply(dimnames(.sigma)[[1]],
function(v) {
!(v %in% names(params))
}, logical(1), USE.NAMES = FALSE)
.sigma <- .sigma[.v, .v]
if (dim(.sigma)[1] == 0) {
.rxControl$sigma <- NULL
} else {
.rxControl$sigma <- NULL
}
}
if (inherits(.rxControl$sigma, "matrix") &&
all(dim(.rxControl$sigma) == c(0,0))) {
.rxControl$sigma <- NULL
Expand Down

0 comments on commit 9bcbfd3

Please sign in to comment.