Compute and display percentiles of the empiricial distribution of longitudinal data.
prctilemlx(
r = NULL,
col = NULL,
project = NULL,
outputVariableName = NULL,
number = 8,
level = 80,
plot = TRUE,
color = NULL,
group = NULL,
facet = TRUE,
labels = NULL,
band = NULL
)
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
a data frame with a column id, a column time and a column with values. The times should be the same for each individual.
a vector with the three column indexes for id, time/x and y. Default = c(1, 2,3).
simulx project filename (with extension ".smlx")
name of the output to consider. By default the first output will be consider. You must define either a 'r' dataframe and the associated 'col' argument or a simulx project and the name of the output 'outputVariableName"
the number of intervals (i.e. the number of percentiles minus 1).
the largest interval (i.e. the difference between the lowest and the highest percentile).
if TRUE
the empirical distribution is displayed, if FALSE
the values are returned
colors to be used for the plots In case of one group or facet = TRUE, only the first color will be used
variable to be used for defining groups (by default, group is used when it exists)
makes subplots for different groups if TRUE
vector of strings
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).
See http://simulx.webpopix.org/mlxr/prctilemlx/ for more details.
if (FALSE) {
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,])
}
Run the code above in your browser using DataLab