| calccb | R Documentation |
The function calculates pointwice confidence bands based on Monte-Carlo simulations in DBSolveOptimum. The lower and upper confidence band calculated as lower and upper quantile for interpolated particular x point.
calccb(input, x.col, x.seq, y.col, factor.col = c(),
q.seq = c(0.025, 0.5, 0.975), nos.col = "nos",
par_calc = FALSE, cpu.cores = 4, silent = FALSE, include.nos = c(), ...)
input |
|
x.col |
number or name of column in |
x.seq |
numerical vector of points to interpolate values in |
y.col |
vector of column numbers or names in |
factor.col |
vector of column numbers or names in |
q.seq |
sequence of probabilities for calculation of lower and upper quantile. The default vector |
nos.col |
number or name of column in |
par_calc |
logical value to use parallel calculation for acceleration. It requires |
cpu.cores |
the number of CPU cores to use if |
silent |
logical value to suppress the messages during calculations. |
include.nos |
vector of number of samples to analyze the approximation in the chosed number of sample. |
... |
other arguments passed to |
The returned value is data.frame class object.
The columns describe:
names(x.col) |
free variable values passed from argument |
var_id |
names of simulated variables as passed from |
quant_ |
columns represent calculated quntiles for interpolated points. |
names(factor.col) |
condition variable values passed from argument |
group |
unique identifier for combination of |
The value has the additional attributes:
col.def |
definition of columns, type of data in columns. |
col.title |
titles for columns. May be usefull for visualization. |
var.title |
titles for simulated variables. May be usefull for visualization. |
group.title |
titles for condition groups. May be usefull for visualization. |
approx_nos_ |
column(or columns) represents interpolated points for chosed number of sample (presented only if |
foreach
quantile
approxfun
### calculation of confidence bands based on example4.slv
## Not run: example4_parset_bs.cond_res<-read.delim("example4_parset_bs.cond_res.txt") # read from DBSolve output simulated with MC parameters from bootstrapping
example4_cb<-calccb(input=example4_parset_bs.cond_res,
x.col="t",
x.seq=seq(0,96,by=0.5),
y.col=c("C0","C1"),
factor.col = c("Dose","T"))
## Not run: write.delim(example4_cb, "example4_cb.txt") # save results
### plot all results with lattice
library(lattice)
xyplot(quant_0.025+quant_0.5+quant_0.975~t|var_id+group,
data=example4_cb,
type="l",
lty=c(2,1,2),
xlab="Time, h",
ylab="Concentration of drug, ng/ml",
main="All CB simulations")
###You can also plot all results using ggplot2:
library(ggplot2)
ggplot(example4_cb,aes(t,quant_0.025))+
geom_line(linetype="dashed", color="blue")+
geom_line(aes(t,quant_0.5),color="black",linetype="solid")+
geom_line(aes(t,quant_0.975),color="blue",linetype="dashed")+
facet_wrap(~var_id+group)+
ggtitle("All CB simulations")+
scale_x_continuous(name="Time,h")+
scale_y_continuous(name="Concentration of drug, ng/ml")
### plot dbsolve output results
example4_cb<-calccb(input=example4_parset.cond_res,
x.col="t",
x.seq=seq(0,96,by=0.5),
y.col=c("C0","C1"),
factor.col = c("Dose","T"),
par_calc = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.