Skip to content

Commit

Permalink
Merge branch 'main' into rxode2ui-obj-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Dec 8, 2023
2 parents f41e179 + 2877ae6 commit d8c89fd
Show file tree
Hide file tree
Showing 86 changed files with 8,575 additions and 3,229 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: rxode2
Version: 2.0.13.9000
Version: 2.0.14.9000
Title: Facilities for Simulating from ODE-Based Models
Authors@R: c(
person("Matthew L.","Fidler",
role = c("aut", "cre"), email = "matthew.fidler@gmail.com",
comment=c(ORCID="0000-0001-8538-6691")),
person("Melissa", "Hallow",
role = "aut", email = "hallowkm@uga.edu"),
person("Wenping", "Wang",
person("Wenping", "Wang",
role = c("aut"), email = "wwang8198@gmail.com"),
person("Zufar", "Mulyukov", role="ctb", email="zufar.mulyukov@novartis.com"),
person("Alan", "Hindmarsh",role="ctb"),
Expand Down Expand Up @@ -77,7 +77,7 @@ Imports:
backports,
cli (>= 2.0.0),
checkmate,
ggplot2,
ggplot2 (>= 3.4.0),
inline,
lotri (>= 0.4.0),
magrittr,
Expand All @@ -104,16 +104,16 @@ Description: Facilities for running simulations from ordinary
Section 6.3, Appendix A, and Appendix D in the "R Administration and
Installation" manual. Also the code is mostly released under GPL. The
'VODE' and 'LSODA' are in the public domain. The information is available
in the inst/COPYRIGHTS.
in the inst/COPYRIGHTS.
BugReports: https://github.com/nlmixr2/rxode2/issues/
NeedsCompilation: yes
VignetteBuilder: knitr
License: GPL (>= 3)
License: GPL (>= 3)
URL: https://nlmixr2.github.io/rxode2/,
https://github.com/nlmixr2/rxode2/
RoxygenNote: 7.2.3
Biarch: true
LinkingTo:
LinkingTo:
rxode2parse (>= 2.0.12),
rxode2random,
PreciseSums (>= 0.3),
Expand Down
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ S3method("$",rxSymInvCholEnv)
S3method("$",rxUi)
S3method("$<-",rxSolve)
S3method("$<-",rxSymInvCholEnv)
S3method("$<-",rxUi)
S3method("+",rxSolve)
S3method("+",solveRxDll)
S3method("[",rxSolve)
Expand Down Expand Up @@ -41,6 +42,7 @@ S3method(as.rxUi,rxModelVars)
S3method(as.rxUi,rxUi)
S3method(as.rxUi,rxode2)
S3method(as.rxUi,rxode2tos)
S3method(binomProbs,default)
S3method(coef,rxode2)
S3method(confint,rxSolve)
S3method(dimnames,rxSolve)
Expand Down Expand Up @@ -138,6 +140,7 @@ S3method(rxUiGet,lhsTheta)
S3method(rxUiGet,lhsVar)
S3method(rxUiGet,lstChr)
S3method(rxUiGet,md5)
S3method(rxUiGet,model)
S3method(rxUiGet,modelDesc)
S3method(rxUiGet,modelFun)
S3method(rxUiGet,muRefTable)
Expand Down Expand Up @@ -194,6 +197,7 @@ export(.copyUi)
export(.expandPars)
export(.getLastIdLvl)
export(.handleSingleErrTypeNormOrTFoceiBase)
export(.iniGetAppendArg)
export(.iniHandleFixOrUnfix)
export(.iniHandleLine)
export(.malert)
Expand Down Expand Up @@ -246,6 +250,7 @@ export(assertRxUiPrediction)
export(assertRxUiRandomOnIdOnly)
export(assertRxUiSingleEndpoint)
export(assertRxUiTransformNormal)
export(binomProbs)
export(cvPost)
export(erf)
export(et)
Expand Down Expand Up @@ -469,6 +474,7 @@ export(scale_y_discrete)
export(setRxThreads)
export(stat_amt)
export(stat_cens)
export(toTrialDuration)
export(uppergamma)
export(waiver)
export(write.template.server)
Expand Down Expand Up @@ -529,6 +535,7 @@ importFrom(rxode2et,rxEvid)
importFrom(rxode2et,rxRateDur)
importFrom(rxode2et,rxReq)
importFrom(rxode2et,rxStack)
importFrom(rxode2et,toTrialDuration)
importFrom(rxode2parse,.getLastIdLvl)
importFrom(rxode2parse,forderForceBase)
importFrom(rxode2parse,rxDerived)
Expand Down
89 changes: 87 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@
- "dop853" now uses the `hmax`/`h0` values from the `rxControl()` or
`rxSolve()`. This may change some ODE solving using "dop853"

- When not specified (and xgxr is available), the x axis is no longer
assumed to be in hours

## New features

- User defined functions can now be R functions. For many of these R
functions they can be converted to C with `rxFun()` (you can see the
C code afterwards with `rxC("funName")`)

- Parallel solving of models that require sorting (like modeled lag
times, modeled duration etc) now solve in parallel instead of downgrading
to single threaded solving
Expand Down Expand Up @@ -90,18 +97,80 @@ mu-referencing style to run the optimization.
your own `ci=0.99` for instance

- A new function was introduced `meanProbs()` which calculates the
mean and expected quantiles under either the normal or t
mean and expected confidence bands under either the normal or t
distribution

- A related new function was introduced that calculates the mean and
confidence bands under the Bernoulli/Binomial distribution
(`binomProbs()`)

- When calculating the intervals for `rxode2` simulated objects you
can also use `mean=TRUE` to use the mean for the first level of
confidence using `meanProbs()`
confidence using `meanProbs()`. For this confidence interval you can
override the `n` used in the confidence interval by using `n=#`. You
can also change this to a prediction interval instead using
`pred=TRUE`.

- Also when calculating the intervals for `rxode2` simulated object
you can also use `mean="binom"` to use the binomial distributional
information (and ci) for the first level of confidence using
`binomProbs()`. For this confidence interval you can override the
`n` used in the confidence interval by using `n=#`. You can also
change this to a prediction interval instead using `pred=TRUE`. With
`pred=TRUE` you can override the number of predicted samples with
`m=#`

- When plotting the `confint` derived intervals from an `rxode2`
simulation, you can now subset based on a simulated value like
`plot(ci, Cc)` which will only plot the variable `Cc` that you
summarized even if you also summarized `eff` (for instance).

- When the rxode2 ui is a compressed ui object, you can modify the ini
block with `$ini <-` or modify the model block with `$model <-`.
These are equivalent to `ini(model) <-` and `model(model) <-`,
respectively. Otherwise, the object is added to the user defined
components in the function (ie `$meta`). When the object is
uncompressed, it simply assigns it to the environment instead (just
like before).

- When printing meta information that happens to be a `lotri`
compatible matrix, use `lotri` to express it instead of the default
R expression.

- Allow character vectors to be converted to expressions for piping
(#552)

- `rxAppendModel()` will now take an arbitrary number of models and
append them together; It also has better handling of models with
duplicate parameters and models without `ini()` blocks (#617 / #573
/ #575).

- `keep` will now also keep attributes of the input data (with special
handling for `levels`); This means a broader variety of classes will
be kept carrying more information with it (for example ordered
factors, data frame columns with unit information, etc)

- Piping arguments `append` for `ini()` and `model()` have been
aligned to perform similarly. Therefore `ini(append=)` now can take
expressions instead of simply strings and `model(append=)` can also
take strings. Also model piping now can specify the integer line
number to be modified just like the `ini()` could. Also
`model(append=FALSE)` has been changed to `model(append=NULL)`.
While the behavior is the same when you don't specify the argument,
the behavior has changed to align with `ini()` when piping. Hence
`model(append=TRUE)` will append and `model(append=FALSE)` will now
pre-pend to the model. `model(append=NULL)` will modify lines like
the behavior of `ini(append=NULL)`. The default of `model(line)`
modifying a line in-place still applies. While this is a breaking
change, most code will perform the same.

- Labels can now be dropped by `ini(param=label(NULL))`. Also
parameters can be dropped with the idiom `model(param=NULL)` or
`ini(param=NULL)` changes the parameter to a covariate to align with
this idiom of dropping parameters

- `rxRename` has been refactored to run faster

## Internal new features

- Add `as.model()` for list expressions, which implies `model(ui) <-
Expand All @@ -121,6 +190,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 All @@ -131,6 +203,19 @@ mu-referencing style to run the optimization.
- Bug fix for some covariate updates that may affect multiple compartment
models (like issue #581)

## Maintenance fixes

- Modify plot code to work with development `xgxr`

# rxode2 2.0.14

- CRAN requested that FORTRAN `kind` be changed as it was not portable;
This was commented code, and simply removed the comment.

- Bug-fix for `geom_amt()`; also now uses `linewidth` and at least `ggplot2 3.4.0`

- Some documentation was cleaned up from `rxode2` 2.0.13

# rxode2 2.0.13

## Bug fixes
Expand Down
25 changes: 17 additions & 8 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ etTrans <- function(inData, obj, addCmt = FALSE, dropUnits = FALSE, allTimeVar =
#' @param c1 character vector of items to be expanded
#' @param c2 second character vector of items to be expanded
#' @param type 0 for a typical data frame, 1 for symengine sensitivity expansion
#' @return data frame (when type = 0) or symengine string (when type=1)
#' @return data frame (when type = 0) or symengine string (when type=1)
#' @export
#' @keywords internal
rxExpandGrid_ <- function(c1, c2, type) {
Expand Down Expand Up @@ -74,17 +74,18 @@ rxExpandSens2_ <- function(state, s1, s2) {
#'
#' @param state is the state to expand
#' @param neta is the number of etas
#' @param pred type of prediction
#' @param pred type of prediction
#' @param isTheta logical, is the expansion actually for thetas instead of etas
#' @keywords internal
#' @return String of symengine expressions to evaluate to calculate df/deta
#' @export
rxExpandFEta_ <- function(state, neta, pred) {
.Call(`_rxode2_rxExpandFEta_`, state, neta, pred)
rxExpandFEta_ <- function(state, neta, pred, isTheta = FALSE) {
.Call(`_rxode2_rxExpandFEta_`, state, neta, pred, isTheta)
}

#' Rep R0 for foce
#'
#' @param number ETA to substitute
#' @param neta ETA to substitute
#'
#' @return Returns a string of R code to substitute the rx_r expression in the symengine environment .s
#'
Expand Down Expand Up @@ -260,7 +261,7 @@ rxSetupIni <- function(obj, inits = NULL) {
#'
#' @param obj rxode2 object
#'
#' @param inits A numeric vector of initial conditions.
#' @param scale A numeric vector scales
#'
#' @param extraArgs A list of extra args to parse for initial conditions.
#'
Expand Down Expand Up @@ -589,7 +590,15 @@ rxErf <- function(v) {
.Call(`_rxode2_rxErf`, v)
}

meanProbs_ <- function(x, probs, naRm, useT) {
.Call(`_rxode2_meanProbs_`, x, probs, naRm, useT)
binomProbsPredVec_ <- function(n, m, Y, M, doP = TRUE, tol = 1e-7) {
.Call(`_rxode2_binomProbsPredVec_`, n, m, Y, M, doP, tol)
}

binomProbs_ <- function(x, probs, naRm, nIn, cont) {
.Call(`_rxode2_binomProbs_`, x, probs, naRm, nIn, cont)
}

meanProbs_ <- function(x, probs, naRm, useT, pred, nIn) {
.Call(`_rxode2_meanProbs_`, x, probs, naRm, useT, pred, nIn)
}

Loading

0 comments on commit d8c89fd

Please sign in to comment.