# prctilemlx: Percentiles of the empiricial distribution of longitudinal... In mlxR: Simulation of Longitudinal Data

## Description

Compute and display percentiles of the empiricial distribution of longitudinal data.

## Usage

 ```1 2 3``` ```prctilemlx(r, col = NULL, number = 8, level = 80, plot = TRUE, color = "#9a35ff", group = NULL, facet = TRUE, labels = NULL, band = NULL) ```

## Arguments

 `r` a data frame with a column id, a column time and a column with values. The times should be the same for each individual. `col` a vector of 3 column numbers: (id, time/x, y. Default = c(1, 2,3). `number` the number of intervals (i.e. the number of percentiles minus 1). `level` the largest interval (i.e. the difference between the lowest and the highest percentile). `plot` if `TRUE` the empirical distribution is displayed, if `FALSE` the values are returned `color` a color to be used for the plots (default="#9a35ff") `group` variable to be used for defining groups (by default, group is used when it exists) `facet` makes subplots for different groups if `TRUE` `labels` vector of strings `band` is deprecated (use number and level instead) ; a list with two fields `number` the number of intervals (i.e. the number of percentiles minus 1). `level` the largest interval (i.e. the difference between the lowest and the highest percentile).

## Details

See http://simulx.webpopix.org/mlxr/prctilemlx/ for more details.

## Value

a ggplot object if `plot=TRUE` ; otherwise, a list with fields:

• proba a vector of probabilities of length `band\$number+1`

• color a vector of colors used for the plot of length `band\$number`

• y a data frame with the values of the empirical percentiles computed at each time point

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50``` ```## Not run: myModel <- inlineModel(" [LONGITUDINAL] input = {ka, V, Cl} EQUATION: C = pkmodel(ka,V,Cl) [INDIVIDUAL] input = {ka_pop, V_pop, Cl_pop, omega_ka, omega_V, omega_Cl} DEFINITION: ka = {distribution=lognormal, reference=ka_pop, sd=omega_ka} V = {distribution=lognormal, reference=V_pop, sd=omega_V } Cl = {distribution=lognormal, reference=Cl_pop, sd=omega_Cl} ") N=2000 pop.param <- c( ka_pop = 1, omega_ka = 0.5, V_pop = 10, omega_V = 0.4, Cl_pop = 1, omega_Cl = 0.3) res <- simulx(model = myModel, parameter = pop.param, treatment = list(time=0, amount=100), group = list(size=N, level='individual'), output = list(name='C', time=seq(0,24,by=0.1))) # res\$C is a data.frame with 2000x241=482000 rows and 3 columns head(res\$C) # we can display the empirical percentiles of C using the default # settings (i.e. percentiles of order 10%, 20%, ... 90%) prctilemlx(res\$C) # The 3 quartiles (i.e. percentiles of order 25%, 50% and 75%) are displayed by # selecting a 50% interval splitted into 2 subintervals prctilemlx(res\$C, number=2, level=50) # A one 90% interval can be displayed using only one interval prctilemlx(res\$C, number=1, level=90) # or 75 subintervals in order to better represent the continuous distribution # of the data within this interval prctilemlx(res\$C, number=75, level=90) # prctilemlx produces a ggplot object that can be modified pl <- prctilemlx(res\$C, number=4, level=80) pl + ylab("concentration") + ggtitle("predictive distribution") # The percentiles are not plotted by setting plot=FALSE pr.out <- prctilemlx(res\$C, number=4, level=80, plot=FALSE) print(pr.out\$proba) print(pr.out\$color) print(pr.out\$y[1:5,]) ## End(Not run) ```

mlxR documentation built on Feb. 20, 2018, 5:03 p.m.