Skip to content

Commit 7481ffd

Browse files
authored
Merge pull request #504 from nlmixr2/503-covariate-and-babelmixr2
Try babelmixr2 back-transform
2 parents 0ff1bee + 7192a0d commit 7481ffd

File tree

15 files changed

+29
-3
lines changed

15 files changed

+29
-3
lines changed

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# nlmixr2est 3.0.3
22

33
- Moved data check for covariates and required data items to a
4-
pre-processing step. This fixes #499
4+
pre-processing step. This fixes #499. Each method that needs to
5+
have a covariate check needs to have a property `covPresent`. For
6+
example to apply the covariate data check to the `focei` method you
7+
need `attr(nlmixr2Est.focei, "covPresent") <- TRUE`.
58

69
- Bug fix for non-mu referenced etas when combined with mu referenced
710
covariate values. (See #498)

R/bobyqa.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,5 +421,6 @@ nlmixr2Est.bobyqa <- function(env, ...) {
421421
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
422422
.bobyqaFamilyFit(env, ...)
423423
}
424+
attr(nlmixr2Est.bobyqa, "covPresent") <- TRUE
424425

425426
#minqa::bobyqa()

R/focei.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,7 @@ nlmixr2Est.focei <- function(env, ...) {
18101810
})
18111811
.foceiFamilyReturn(env, .ui, ..., est="focei")
18121812
}
1813+
attr(nlmixr2Est.focei, "covPresent") <- TRUE
18131814

18141815

18151816
#'@rdname nlmixr2Est
@@ -1831,6 +1832,7 @@ nlmixr2Est.foce <- function(env, ...) {
18311832
env$est <- "foce"
18321833
.foceiFamilyReturn(env, .ui, ..., est="focei")
18331834
}
1835+
attr(nlmixr2Est.foce, "covPresent") <- TRUE
18341836

18351837
#'@rdname nlmixr2Est
18361838
#'@export
@@ -1849,6 +1851,7 @@ nlmixr2Est.posthoc <- function(env, ...) {
18491851
env$est <- "posthoc"
18501852
.foceiFamilyReturn(env, .ui, ..., est="posthoc")
18511853
}
1854+
attr(nlmixr2Est.posthoc, "covPresent") <- TRUE
18521855

18531856
#' Add objective function line to the return object
18541857
#'
@@ -1916,6 +1919,7 @@ nlmixr2Est.foi <- function(env, ...) {
19161919
.addObjDfToReturn(.ret, .objDf)
19171920
.ret
19181921
}
1922+
attr(nlmixr2Est.foi, "covPresent") <- TRUE
19191923

19201924

19211925
#'@rdname nlmixr2Est
@@ -1949,6 +1953,7 @@ nlmixr2Est.fo <- function(env, ...) {
19491953
.addObjDfToReturn(.ret, .objDf)
19501954
.ret
19511955
}
1956+
attr(nlmixr2Est.fo, "covPresent") <- TRUE
19521957

19531958
#'@rdname nlmixr2Est
19541959
#'@export

R/lbfgsb3c.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,3 +435,4 @@ nlmixr2Est.lbfgsb3c <- function(env, ...) {
435435
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
436436
.lbfgsb3cFamilyFit(env, ...)
437437
}
438+
attr(nlmixr2Est.lbfgsb3c, "covPresent") <- TRUE

R/n1qn1.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,4 @@ nlmixr2Est.n1qn1 <- function(env, ...) {
402402
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
403403
.n1qn1FamilyFit(env, ...)
404404
}
405+
attr(nlmixr2Est.n1qn1, "covPresent") <- TRUE

R/newuoa.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,5 +390,6 @@ nlmixr2Est.newuoa <- function(env, ...) {
390390
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
391391
.newuoaFamilyFit(env, ...)
392392
}
393+
attr(nlmixr2Est.newuoa, "covPresent") <- TRUE
393394

394395
#minqa::newuoa()

R/nlm.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,3 +918,4 @@ nlmixr2Est.nlm <- function(env, ...) {
918918
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
919919
.nlmFamilyFit(env, ...)
920920
}
921+
attr(nlmixr2Est.nlm, "covPresent") <- TRUE

R/nlme.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,3 +537,4 @@ nlmixr2Est.nlme <- function(env, ...) {
537537
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
538538
.uiFinalizeMu2(.nlmeFamilyFit(env, ...), .model)
539539
}
540+
attr(nlmixr2Est.nlme, "covPresent") <- TRUE

R/nlminb.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,4 @@ nlmixr2Est.nlminb <- function(env, ...) {
566566
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
567567
.nlminbFamilyFit(env, ...)
568568
}
569+
attr(nlmixr2Est.nlminb, "covPresent") <- TRUE

R/nls.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,3 +1079,4 @@ nlmixr2Est.nls <- function(env, ...) {
10791079
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
10801080
.nlsFamilyFit(env, ...)
10811081
}
1082+
attr(nlmixr2Est.nls, "covPresent") <- TRUE

R/optim.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,3 +625,4 @@ nlmixr2Est.optim <- function(env, ...) {
625625
on.exit({if (exists("control", envir=.ui)) rm("control", envir=.ui)}, add=TRUE)
626626
.optimFamilyFit(env, ...)
627627
}
628+
attr(nlmixr2Est.optim, "covPresent") <- TRUE

R/preProcessCovariatesPresent.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
.nlmixr0preProcessCovariatesPresent <- function(ui, est, data, control) {
99
# Could possibly use to stack data or use an DV or IDV different
1010
# than what is present in the data
11-
if (!missing(data)) {
11+
if (!missing(data) &&
12+
isTRUE(attr(utils::getS3method("nlmixr2Est", est), "covPresent"))) {
1213
.covNames <- ui$covariates
1314
colnames(data) <- vapply(names(data), function(x) {
1415
if (any(x == .covNames)) {

R/rxsolve.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ nlmixr2Est.rxSolve <- function(env, ...) {
152152
events = .events, inits = NULL), .rxSolveGetControlForNlmixr(env),
153153
list(theta = NULL, eta = NULL)))
154154
}
155+
attr(nlmixr2Est.rxSolve, "covPresent") <- TRUE
155156

156157
#'@rdname nlmixr2Est
157158
#'@export
@@ -162,6 +163,7 @@ nlmixr2Est.simulate <- function(env, ...) {
162163
events = .events, inits = NULL), .rxSolveGetControlForNlmixr(env),
163164
list(theta = NULL, eta = NULL)))
164165
}
166+
attr(nlmixr2Est.simulate, "covPresent") <- TRUE
165167

166168
#'@rdname nlmixr2Est
167169
#'@export
@@ -179,6 +181,8 @@ nlmixr2Est.simulation <- function(env, ...) {
179181
events = .events, inits = NULL), .rxControl,
180182
list(theta = NULL, eta = NULL)))
181183
}
184+
attr(nlmixr2Est.simulation, "covPresent") <- TRUE
185+
182186

183187
#'@rdname nlmixr2Est
184188
#'@export
@@ -199,6 +203,8 @@ nlmixr2Est.predict <- function(env, ...) {
199203
nlmixr2(object=get("ui", envir=env), data=.events,
200204
est="rxSolve", control=.rxControl)
201205
}
206+
attr(nlmixr2Est.predict, "covPresent") <- TRUE
207+
202208
#' Get new data
203209
#'
204210
#'

R/saem.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,8 @@ nlmixr2Est.saem <- function(env, ...) {
805805
}, add=TRUE)
806806
.uiFinalizeMu2(.saemFamilyFit(env, ...), .doMu2)
807807
}
808+
attr(nlmixr2Est.saem, "covPresent") <- TRUE
809+
808810

809811
#' @rdname nmObjGet
810812
#' @export

R/uobyqa.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,5 +397,5 @@ nlmixr2Est.uobyqa <- function(env, ...) {
397397
}, add=TRUE)
398398
.uobyqaFamilyFit(env, ...)
399399
}
400-
400+
attr(nlmixr2Est.uobyqa, "covPresent") <- TRUE
401401
#minqa::uobyqa()

0 commit comments

Comments
 (0)