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

Visual Predictive Check #66

Open
wds15 opened this issue Jan 26, 2017 · 9 comments
Open

Visual Predictive Check #66

wds15 opened this issue Jan 26, 2017 · 9 comments

Comments

@wds15
Copy link

wds15 commented Jan 26, 2017

It would be great to have a so-called visual predictive check. To exemplify it I include an example in the form of a simple R script.

This plot is very useful for models which have continuous regressors which are given by the design of the experiemnt at the same value for all the subjects in a data-set. For example, imagine I have many subjects in a clinical study and one measures at pre-defined time-points for all patients whatever is of interest. The plot then allows to compare the raw quantiles of the data at each time-point vs what the model predicts for these quantiles (with its uncertainty).

vpc_example_R.txt

vpc_mtcars.pdf

@dpastoor
Copy link

@wds15 are you aware of https://github.com/ronkeizer/vpc

@jgabry
Copy link
Member

jgabry commented Jan 27, 2017 via email

@dpastoor
Copy link

yeah, the basic functionality is really easy to implement, and could be nice stylistically.

The 3 'extras' this package offers are:

  • binning for non-uniform/nominal sampling times
  • prediction corrections - useful when data has wide range, eg ascending dose studies (more details here: https://www.ncbi.nlm.nih.gov/pubmed/21302010)
  • VPC's for categorical data

Happy to answer any questions, or help in some capacity. I think a 'built-in' VPC would be a valuable addition, and is a go-to plot in the pharmacometrics community.

@jgabry
Copy link
Member

jgabry commented Jan 27, 2017 via email

@wds15
Copy link
Author

wds15 commented Jan 27, 2017

@dpastoor no, I don't know that package, looks interesting.

However, having this plot in bayesplot would be great for the reasons Jonah raises. The plot is one of the standards in PK/PD modeling. However, I think this is useful elsewhere certainly. Given with what is there in bayesplot it should be straightforward; at least it looks like.

I am happy to review the feature branch (or even write one should I think adapting code from other plotting functions looks easily adaptable to me in a coherent design).

@jgabry
Copy link
Member

jgabry commented Feb 1, 2017

@wds15 In the example you sent which parts of the data processing (e.g. binning) do you envision the user performing before calling a bayesplot function?

@jgabry
Copy link
Member

jgabry commented Feb 1, 2017

Also, we should find a good way to write the code without using the plyr package. dplyr and reshape2 are ok since bayesplot already uses them.

@wds15
Copy link
Author

wds15 commented Feb 6, 2017

The user should be doing the binning himself. bayesplot should only need to know what refers to the bins. I suppose this can be mapped to the grouping facilities which are already there.

What would be useful is to allow the user to specify extra strata which are used to split things, e.g. by facets. So the bins always define the x-axis and a variable like sex may put male and female subjects on different facets.

Let me know if I should look at some branch and try things.

@jgabry
Copy link
Member

jgabry commented Feb 6, 2017

Ok cool. I think that makes sense. I'll try to put together a prototype soon.

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

No branches or pull requests

3 participants