nlme.diag | R Documentation |
Given an R nlme model object, create two diagnostic plots of the eta(s) in the model
## S3 method for class 'diag'
nlme(
obj,
subset.modeldata,
xvar = "time",
xvar.label = NULL,
nx = 8,
output = FALSE,
print.eta.norm = TRUE,
print.eta.v.var = TRUE,
asp.eta.norm = 1,
asp.eta.v.var = 1
)
obj |
nlme model object |
subset.modeldata |
character string to subset the data |
xvar |
the column name of the independent variable |
xvar.label |
label for independent variable, defaulting to NULL (no label) |
nx |
number of bins of |
output |
logical determining if the plotting data should be outputted |
print.eta.norm |
logical determining if a standard normal Q-Q plot of the eta estimates will be plotted print.eta.v.var |
print.eta.v.var |
logical determining if a distribution of etas by binned values of |
asp.eta.norm |
aspect value for the QQ plot |
asp.eta.v.var |
aspect vlaue of the plot for eta vs variables |
Diagnostic plots
nlme.run
, nlme.predict
## define modeling function
## adapted from pk.1comp.1abs to make it modeling-ready
library(nlme)
pkpdData = example.pkpdData()
PK.1comp.1abs =
function(dose, tob, cl, v, ka){
kel = cl / v
dose * ka/v/(ka-kel) * (exp(-kel*tob) - exp(-ka*tob))
}
## fit 1 comp PK with 1st order absorption
fit.nlme.1 = nlme.run(value ~ PK.1comp.1abs(dose, time, cl*exp(cl.eta), v*exp(v.eta), ka),
data = subset(pkpdData, type == "PK" & dose> 0 & value > 0.1),
groups = ~ id,
fixed = cl + v + ka ~ 1,
random = pdDiag(list(cl.eta~1,v.eta ~ 1)),
start = c(cl = 1, v = 5, ka = 1),
reference = 3,
problem = "1comp.1abs eta(CL)"
)
summary(fit.nlme.1$object)
nlme.diag(fit.nlme.1$object)
# note here we refer to the $object, given the model was created with nlme.run()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.