nlmixrdevelopment / RxODE

RxODE is an R package that facilitates easy simulations in R
https://nlmixrdevelopment.github.io/RxODE/
GNU General Public License v3.0
54 stars 14 forks source link

Documentation Request: Example for geom_cens #367

Open billdenney opened 3 years ago

billdenney commented 3 years ago

I just learned about geom_cens(), but I can't figure out how to use it. I tried a simple example below, but it didn't work the way that I expected.

I thought that values <2 would somehow be censored and values >2 would not. But I got bars from 2 to infinity. Also, the help says that "lower represents the lower bound of the censoring (could be -Inf)" and "upper represents the upper bound of the censoring (cound be Inf)", but I got a warning that they were unknown aesthetics.

(And while in the doc, there is a typo with "cound" which should be "could".)

library(ggplot2)
library(nlmixr)

ggplot(data.frame(x=1:10), aes(x=x, y=x)) +
  nlmixr::geom_cens(aes(lower=2, upper=Inf))
#> Warning: Ignoring unknown aesthetics: lower, upper

Created on 2021-01-12 by the reprex package (v0.3.0)

mattfidler commented 3 years ago

Example given here:

https://nlmixrdevelopment.github.io/nlmixr/articles/xgxr-nlmixr-ggpmx.html#concentration-over-time-faceted-by-dose-mean---95-ci-overlaid-on-gray-spaghetti-plots

mattfidler commented 3 years ago

The censoring geom should take care of left and right censoring values, which are described in in the document you helped create here:

https://github.com/nlmixrdevelopment/RxODE/blob/master/man/rmdhunks/RxODE-datasets.Rmd

The main way to explore this is in the context of nlmixr datasets, or monolix datasets that implement CENS and LIMIT. The lower and upper show the censoring within the nlmixr datasets.

mattfidler commented 3 years ago

This wasn't reflected in the manual page so I updated it; Obviously limit works, though it does give a warning of an unknown aesthetic.

mattfidler commented 3 years ago

Transferred geom_cens and therefore this issue to RxODE