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

SCM filter result problem #64

Open
junmoxiao66 opened this issue Dec 27, 2023 · 17 comments
Open

SCM filter result problem #64

junmoxiao66 opened this issue Dec 27, 2023 · 17 comments

Comments

@junmoxiao66
Copy link

How can I solve this problem?I use the saem algorithm,
Error in covSearchRes[[which.min(resTable$pchisqr)]][[1]] :
wrong arguments for subsetting an environment
屏幕截图 2023-12-27 212749

@vsarsani
Copy link
Contributor

vsarsani commented Jan 1, 2024

@junmoxiao66 Can you Post the command you used?

@junmoxiao66
Copy link
Author

The following two pictures are, thank you
屏幕截图 2024-01-02 095504
屏幕截图 2024-01-02 095705

@junmoxiao66
Copy link
Author

@vsarsani How to solve the above problem?

@vsarsani
Copy link
Contributor

@junmoxiao66 Sorry for the delay. Let me look into this week.

@junmoxiao66
Copy link
Author

@vsarsani Thank you very much.

@vsarsani
Copy link
Contributor

vsarsani commented May 6, 2024

@junmoxiao66
Can you output following for your data

is.numeric(AIC(fit)
fit$objf

@junmoxiao66
Copy link
Author

@vsarsani I ran the new code again,This is found in all code, as long as the covariates are filtered out, this error will occur.
1715003395150(1)
1715003452794(1)
1715003519072
Finally, I have one more question: Why is the estimated value of tcl negative

@mattfidler
Copy link
Member

mattfidler commented May 6, 2024 via email

@junmoxiao66
Copy link
Author

@mattfidler Suddenly, thank you very much for your reply

@pippalf
Copy link

pippalf commented May 9, 2024

Hi all,

I am having the same issue. Here is some reproducible code with the warfarin dataset:

### From https://nlmixr2.org/articles/running_nlmixr.html

library(nlmixr2)

one.cmt <- function() {
  ini({
    tka <- 0.45 # Ka
    tcl <- log(c(0, 2.7, 100)) # Log Cl
    tv <- 3.45; label("log V")
    eta.ka ~ 0.6
    eta.cl ~ 0.3
    eta.v ~ 0.1
    add.sd <- 0.7
  })
  model({
    ka <- exp(tka + eta.ka)
    cl <- exp(tcl + eta.cl)
    v <- exp(tv + eta.v)
    linCmt() ~ add(add.sd)
  })
}

f <- nlmixr(one.cmt)

### Updated with warfarin dataset.

fit <- nlmixr(one.cmt, warfarin, est="focei", control=list(print=0))

print(fit)


### Error starts here:
# "Error in covSearchRes[[which.min(resTable$pchisqr)]][[1]] :
#   wrong arguments for subsetting an environment"

Fit.scm =
  covarSearchAuto(
    fit=fit,
    varsVec=c("ka","cl", "v"),
    covarsVec=c("wt", "age", "sex"),
    pVal=list(fwd=0.5, bck=0.1),
    searchType="scm" 
  )

rxode2::.rxWithWd(tempdir(), {
  Fit.scm =
    covarSearchAuto(
      fit=fit,
      varsVec=c("ka","cl", "v"),
      covarsVec=c("wt", "age", "sex"),
      pVal=list(fwd=0.5, bck=0.1),
      searchType="scm" 
    )
})

Any ideas on how to solve this or what it means?

@the-magister
Copy link

the-magister commented May 15, 2024

I can partially fix forwardSearch. The issue seems to be that the code assumes covSearchRes[[]] contains fitted objects, but it does not. It's a list of "prediction only" models. So, the next loop through pulls that object and it lacks and objective function (and many other things). The hack I came up with was to select the best model, then (RE)fit it. Very inefficient, but it does work:

mod <- covSearchRes[[which.min(resTable$pchisqr)]]
fit <- suppressWarnings(nlmixr2(mod,data,est=fit$est))

@junmoxiao66
Copy link
Author

@the-magister awesome

@junmoxiao66
Copy link
Author

@vsarsani Hello, can you fix this BUG? I am very eager to use all the functions of your package to build PPK models (including the function of covariate screening), and then to publish the article, I think your open source R package is too good, but everyone seems to be concerned about this package is not particularly high, but also want to publicize the nlmixr2 package through the article

@junmoxiao66
Copy link
Author

@vsarsani Hello, professor, I'm sorry to bother you again, and I want to ask if you have time to fix the BUG. I'm waiting to use your package to screen covariates. Thank you again, and I hope you can make a breakthrough!

@vsarsani
Copy link
Contributor

@junmoxiao66 Sorry, did not get a chance to look into this. Let me try to see if I can do it this weekend. Have you tried bayesian covariate selection in nlmixr2

@junmoxiao66
Copy link
Author

@vsarsani I haven't used Bayesian covariate selection, can you tell me specifically how to call this function?Which function is it?
1717089411716

@vsarsani
Copy link
Contributor

https://cran.r-project.org/web/packages/nlmixr2extra/nlmixr2extra.pdf

Try horseshoedf , covarSearchAuto and also lassoSummardf

Use library(nlmixr2extra)

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

5 participants