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

Question about #84 Simulating models with uncertainty that have covariates  #619

Open
Chickenlover0908 opened this issue Sep 10, 2022 · 3 comments

Comments

@Chickenlover0908
Copy link

Hello, nlmixr team, thank you for solved my many questions before. I have fitted my model after your help, and have known more about this great package. Now I am simulating different dose with my model, but i have included one covariate “AGE”, which increase the difficulty of dose simulation. #84 has given a good method, but when I use “rxSolve”, there is one error --Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column.
I did not know how to solve the error, i need your help. Here is my syntax, I have tried two form:

sim.day4 <- rxSolve(fit1801, events = day4ev_75ppm, nSub = 100, iCov = data.frame(AGE = 1))

Compiling model...done
Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column

“fit1801” is my nlmixr fit result and my event table is below:

day4ev_75ppm <- eventTable(amount.units = "mg/L", time.units = "hours") %>%
  add.dosing(dose = 75, nbr.doses = 5, start.time = 0, dosing.interval = 24, 
             dosing.to = "depot", dur = 24) %>%
  add.sampling(96:120) 

And when i use your syntax, there still this error:

> fit1801 %>% 
>   et(amt=75,ii=5,until=96) %>% 
>   rxSolve(nSub=100, iCov=data.frame(AGE=1))
>             confint() %>%
>             plot() 
> Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column

How can I solve this error? Thank you very much!!!!

@mattfidler
Copy link
Contributor

I would add it to the events data frame directly.

I'm unsure if you are having an issue with the rxSolve(), confint() or plot() function.

@Chickenlover0908
Copy link
Author

Thank you, I have tried to add "age“ in event table, simulation works very smooth.

@mattfidler
Copy link
Contributor

Great!

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