Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Covariate search issue, it seems for backward search it has to look for "fit" object #51

Open
snailittle opened this issue Feb 9, 2023 · 2 comments

Comments

@snailittle
Copy link

snailittle commented Feb 9, 2023

### Noticed the following error with the example model:

library(nlmixr2)
library(rxode2)
library(vpc)
library(xpose)
library(xpose.nlmixr2)
library(ggplot2)

pheno <- function() {
ini({
tcl <- log(0.008) # typical value of clearance
tv <- log(0.6) # typical value of volume
## var(eta.cl)
eta.cl + eta.v ~ c(1,
0.01, 1) ## cov(eta.cl, eta.v), var(eta.v)
# interindividual variability on clearance and volume
prop.err <- 0.1 # residual variability
})
model({
cl <- exp(tcl + eta.cl) # individual value of clearance
v <- exp(tv + eta.v) # individual value of volume
ke <- cl / v # elimination rate constant
d/dt(A1) = - ke * A1 # model differential equation
cp = A1 / v # concentration in plasma
cp ~ prop(prop.err) # define error model
})
}

fit_saem <- nlmixr(pheno, pheno_sd, "saem",
control=list(print=0),
table=list(cwres=TRUE, npde=TRUE))

rxode2::.rxWithWd(tempdir(), {# with temporary directory

auto3 <- covarSearchAuto(fit_saem, varsVec = c("v", "cl"), covarsVec = c("WT"),
catvarsVec = c("APGR"), restart = TRUE,
searchType = "backward", pVal=list(fwd=0.01,bck=0.001))
})
Error in inherits(fit, "nlmixr2FitCore") : object 'fit' not found

**However When I rename fit_saem to fit it seems to bypass this error. Is it a possible bug? This however ran into another error of "matrix multiplication: problem with matrix inverse;" So it seems whenever a model failed (probably due to over parameterization, an inherent process with most of covariate search models), the covariate search can not go on? **

fit=fit_saem
rxode2::.rxWithWd(tempdir(), {# with temporary directory

auto3 <- covarSearchAuto(fit, varsVec = c("v", "cl"), covarsVec = c("WT"),
catvarsVec = c("APGR"), restart = TRUE,
searchType = "backward", pVal=list(fwd=0.01,bck=0.001))
})

── starting backward search... ────────────────────────────────────────
ℹ use control from pipeline
→ loading into symengine environment...
→ pruning branches (if/else) of saem model...
✔ done
→ finding duplicate expressions in saem model...
[====|====|====|====|====|====|====|====|====|====] 0:00:00

✔ done
Error in .model$saem_mod(.cfg) :
matrix multiplication: problem with matrix inverse; suggest to use solve() instead
Error: matrix multiplication: problem with matrix inverse; suggest to use solve() instead

@mattfidler
Copy link
Member

Looks like a couple of issues here.

I will transfer the large one to nlmixr2extra where the covariate search is found.

@mattfidler mattfidler transferred this issue from nlmixr2/nlmixr2 Feb 10, 2023
@mattfidler
Copy link
Member

Thanks for the issue, I will look at it when I get a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants