nlmixrdevelopment / nlmixr

nlmixr: an R package for population PKPD modeling
https://nlmixrdevelopment.github.io/nlmixr/
GNU General Public License v2.0
115 stars 45 forks source link

Feature Request: Improved VPC Simulation Datasets #247

Open billdenney opened 4 years ago

billdenney commented 4 years ago

One of the features that I always want to overcome with VPCs is the discretized nature of the independent variable axis. It has historically been limited by the fact that simulations are performed on the basis of the original dataset rather than an augmented dataset. I have always interpreted the reason for this as simplicity: Running a VPC on the original dataset is easier than generating a new one, running the simulation on that, and then summarizing.

With that preamble...

Summary: At least for the single-endpoint model, I think that an expanded VPC dataset would improve the visualizations and precision of VPCs. For multi-endpoint models, that may become difficult or (near) impossible to include all endpoints.

I would love it if nlmixr would have an option to expand the dataset so that all individuals have all independent variable values. (For example, with actual time post dose, some subjects will have samples at 0.99, 1, and 1.01 hours-- so, ensure that all subjects have all three of those time points.)

There are some complexities that immediately come to mind:

mattfidler commented 4 years ago

Hi @billdenney

This should be doable; However, to me I don't know if it is a vpc any longer.

To me you simply need to:

I will keep it on a feature request list. I am also open to pull requests.

mattfidler commented 4 years ago

With RxODE

You would simply have to insert NA on these new observations and can apply this without any more modifications.

mattfidler commented 4 years ago

For multiple endpoints, the vpc already works, so simply extracting the vpc RxODE model should suffice. The new data is the key.

You can also use locf with RxODE

billdenney commented 4 years ago

This is something that I often struggle with because I tend to dislike automatic binning algorithms (I do understand that it's hard to automatically make bins good). And, to me, this is taking the concept of VPC from a discrete, binned group which could have bias at bin corners to a continuous unbinned group (since every subject has every independent variable observation, it is technically binned at all unique values). To me, it is like going from 8- to 64-bit in processing-- still the same thing in concept, but you can do a lot more.

My fingers are crossed that I'll be able to make a PR for it. (But I won't be foolish and promise a time scale for that.)

Thanks for the RxODE pointers which will help with implementation.

mattfidler commented 4 years ago

I also dislike binning.

I suppose that my solution didn't even include it (whoops)

mattfidler commented 4 years ago

If you want to go to a low level information, each nlmixr object has $simInfo which has the RxODE model, data, and options needed to continue.

mattfidler commented 4 years ago

One note -- augPred acutally may already do this with data; Perhaps it is closer to being complete. Now have to separate into another function.