nlme.vpc | R Documentation |
Creates a VPC object of an nlme object ready for plotting
## S3 method for class 'vpc'
nlme(
object,
nrep = 10,
covariates,
fun = smedian.hilow,
newdata = NULL,
return.samp = FALSE
)
object |
an nlme object |
nrep |
number of samples (defaulting to 10) |
covariates |
covariates (like time and dose) to be used with the graph |
fun |
function used to summarize simulated output. Defaults to smedian.hilow from the Hmisc package. |
newdata |
if supplied allows simulating a VPC for another data set than the model data set. This dataset does need the dependent variable, independent variable, grouping variable, and any other covariate used in the model. |
return.samp |
if T returns the non-summarized predictions as well |
a list with
library(nlme)
pkpdData = example.pkpdData()
EFF.1comp.1abs <- function(dose, tob, cl, v, ka, keo)
{
# Effect-site concentration for 1-compartment model, 1st-order absorption
kel = cl / v
# Define coefficients
A = 1/(kel-ka) / (keo-ka)
B = 1/(ka-kel) / (keo-kel)
C = 1/(ka-keo) / (kel-keo)
# Return effect-site concentration
dose*ka*keo/v * (A*exp(-ka*tob) + B*exp(-kel*tob) + C*exp(-keo*tob))
}
fit.PD004.nlme = nlme.run(
model = value ~ base + EFF.1comp.1abs(dose, time, cl * exp(cl.eta), v, ka, keo),
data = pkpdData[pkpdData$type == "PD" & pkpdData$dose > 0 & pkpdData$value > 0.5, ],
fixed = base + cl + v + ka + keo ~ 1,
random = cl.eta ~ 1,
groups = ~ id,
start = c(base = 1, cl = 1, v = 10, ka = 1, keo = 0.01),
problem = "True Model",
reference = 4)
summary(fit.PD004.nlme$object)
nlme.extract(fit.PD004.nlme$object)$table
vpc.PD004.nlme = nlme.vpc(fit.PD004.nlme$object, nrep = 100)
nlme.vpcplot(fit.PD004.nlme$object, vpc.PD004.nlme)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.