Skip to content

Commit

Permalink
<20 imports; version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Mar 7, 2020
1 parent dac66e1 commit 9e6dae9
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 29 deletions.
32 changes: 24 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,33 @@ Type: Package
Title: Nonlinear Mixed Effects Models in Population Pharmacokinetics
and Pharmacodynamics
Depends: R (>= 3.5)
Imports: Rcpp (>= 0.12.3), brew, lattice, parallel, lbfgs,
dparser, methods, ggplot2, memoise, rex, minqa, Matrix,
n1qn1, fastGHQuad,
crayon, cli, RcppArmadillo (>= 0.5.600.2.0), vpc (>= 1.0.0),
RxODE(>= 0.9.1-9), nlme, magrittr, tidyr, sys, generics,
huxtable, digest, flextable, stringr, yaml
Imports: Rcpp (>= 0.12.3),
brew,
parallel,
methods,
ggplot2,
memoise,
Matrix,
n1qn1,
fastGHQuad,
cli,
RcppArmadillo (>= 0.5.600.2.0),
vpc (>= 1.0.0),
RxODE(>= 0.9.1-9),
nlme,
magrittr,
tidyr,
generics,
huxtable,
flextable,
stringr,
yaml
Suggests: knitr, rmarkdown, dplyr, data.table, lbfgsb3c, testthat,
madness, devtools, expm, matrixcalc, reshape2, nloptr, ucminf,
Rvmmin, broom.mixed, dotwhisker, officer, pkgdown, gridExtra,
xpose, lotri
Version: 1.1.1-5
xpose, lotri, rex, minqa, lattice, digest, sys, crayon,
lbfgs, dparser
Version: 1.1.1-6
Authors@R: c(person("Matthew","Fidler",
role = "aut", email = "[email protected]",
comment=c(ORCID="0000-0001-8538-6691")),
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ importFrom(RxODE,rxPermissive)
importFrom(RxODE,rxSolve)
importFrom(RxODE,rxSymPySetupPred)
importFrom(brew,brew)
importFrom(dparser,dparse)
importFrom(generics,augment)
importFrom(generics,glance)
importFrom(generics,tidy)
Expand All @@ -286,9 +285,6 @@ importFrom(graphics,title)
importFrom(huxtable,as_hux)
importFrom(huxtable,as_huxtable)
importFrom(huxtable,number_format)
importFrom(lattice,trellis.par.get)
importFrom(lattice,xyplot)
importFrom(lbfgs,lbfgs)
importFrom(magrittr,"%>%")
importFrom(methods,is)
importFrom(n1qn1,n1qn1)
Expand Down
17 changes: 9 additions & 8 deletions R/000.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
#' @return NULL
#' @export
nlme_gof <- function(fit, ...){
df <- getData(fit)
df <- rbind(
cbind(df[,c("ID", "TIME", "DV")], grp=0),
cbind(df[,c("ID", "TIME")], DV=fit$fitted[,1], grp=1),
cbind(df[,c("ID", "TIME")], DV=fit$fitted[,2], grp=2)
)
RxODE::rxReq("lattice")
df <- getData(fit)
df <- rbind(
cbind(df[,c("ID", "TIME", "DV")], grp=0),
cbind(df[,c("ID", "TIME")], DV=fit$fitted[,1], grp=1),
cbind(df[,c("ID", "TIME")], DV=fit$fitted[,2], grp=2)
)

p = xyplot(DV~TIME|ID, df, group=grp, type="b", lwd=c(NA, 1, 1), pch=c(1,NA,NA), col=trellis.par.get("superpose.line")$col[c(1,1,2)], ...)
p
p = lattice::xyplot(DV~TIME|ID, df, group=grp, type="b", lwd=c(NA, 1, 1), pch=c(1,NA,NA), col=lattice::trellis.par.get("superpose.line")$col[c(1,1,2)], ...)
p
}
1 change: 1 addition & 0 deletions R/foceiFit.R
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ foceiControl <- function(sigdig=3,...,
outerOpt <- match.arg(outerOpt);
.outerOptTxt <- outerOpt;
if (outerOpt == "bobyqa"){
RxODE::rxReq("minqa")
outerOptFun <- .bobyqa;
outerOpt <- -1L;
} else if (outerOpt == "nlminb"){
Expand Down
5 changes: 3 additions & 2 deletions R/gnlmm.R
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ gnlmm <- function(llik, data, inits, syspar=NULL,
data.sav = data
names(data) <- tolower(names(data)) #needed in ev

#model
##model
RxODE::rxReq("lbfgs")
if (is.null(system)) {}
else if (class(system) == "RxODE") {}
else if (class(system) == "character") {
Expand Down Expand Up @@ -525,7 +526,7 @@ gnlmm <- function(llik, data, inits, syspar=NULL,
}

pvd = NULL; nfcall = 0
..fit.inner = lbfgs(f, g, starts[.wh,], invisible=T, epsilon=10000*con$reltol.inner)
..fit.inner = lbfgs::lbfgs(f, g, starts[.wh,], invisible=T, epsilon=10000*con$reltol.inner)
..fit.inner$hessian = optimHess(..fit.inner$par, f, g)
} else {
..fit.inner = optim(par=starts[.wh,], ..g.fn, method=con$optim.inner,
Expand Down
4 changes: 0 additions & 4 deletions R/nlmixr.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ nlmixrForget <- function(){
##' @importFrom stats predict logLik na.fail pchisq
##' @importFrom n1qn1 n1qn1
##' @importFrom brew brew
##' @importFrom lattice xyplot
##' @importFrom lattice trellis.par.get
##' @importFrom nlme nlme fixed.effects random.effects
##' @importFrom nlme groupedData
##' @importFrom nlme getData
Expand All @@ -64,10 +62,8 @@ nlmixrForget <- function(){
##' @importFrom stats as.formula nlminb optimHess rnorm terms predict anova optim sd var AIC BIC asOneSidedFormula coef end fitted resid setNames start simulate nobs qnorm quantile time
##' @importFrom utils assignInMyNamespace getFromNamespace head stack sessionInfo tail str
##' @importFrom parallel mclapply
##' @importFrom lbfgs lbfgs
##' @importFrom methods is
##' @importFrom Rcpp evalCpp
##' @importFrom dparser dparse
##' @importFrom vpc vpc
##' @importFrom ggplot2 ggplot aes geom_point facet_wrap geom_line geom_abline xlab geom_smooth aes_string
##' @importFrom RcppArmadillo armadillo_version
Expand Down
4 changes: 2 additions & 2 deletions R/simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ nlmixrSim <- function(object, ...){
.dataName <- ifelse(is.null(object$uif$data.name),"",paste0(object$uif$data.name,"-"));
if (.dataName==".-") .dataName <- ""
.digest <- digest::digest(list(gsub("<-","=",gsub(" +","",object$uif$fun.txt)),
as..data.frame(object$uif$ini),
as.data.frame(object$uif$ini),
.xtra,
as.character(utils::packageVersion("nlmixr")),
as.character(utils::packageVersion("RxODE"))))
Expand Down Expand Up @@ -483,7 +483,7 @@ nlmixrAugPred <- function(object, ..., covsInterpolation = c("linear", "locf", "
.dataName <- ifelse(is.null(object$uif$data.name),"",paste0(object$uif$data.name,"-"));
if (.dataName==".-") .dataName <- ""
.digest <- digest::digest(list(gsub("<-","=",gsub(" +","",object$uif$fun.txt)),
as..data.frame(object$uif$ini),
as.data.frame(object$uif$ini),
covsInterpolation,
primary, minimum, maximum, length.out,
as.character(utils::packageVersion("nlmixr")),
Expand Down
3 changes: 2 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ dynmodel = function(system, model, evTable, inits, data, fixPars=NULL,
fit = mymin(as.vector(inits), obj, control=control)
fit$message=c("NON-CONVERGENCE", "NELDER_FTOL_REACHED")[1+fit$convergence]
} else if (method=="L-BFGS-B") {
fit = lbfgs(as.vector(inits), obj, control=control)
RxODE::rxReq("lbfgs")
fit = lbfgs::lbfgs(as.vector(inits), obj, control=control)
} else {
if ("ftol_rel" %in% names(control)) {
control$rel.tol = control$ftol_rel
Expand Down

0 comments on commit 9e6dae9

Please sign in to comment.