nlme.diag: Diagnostic plots for nlme

View source: R/nlme.diag.r

nlme.diagR Documentation

Diagnostic plots for nlme

Description

Given an R nlme model object, create two diagnostic plots of the eta(s) in the model

Usage

## 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
)

Arguments

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 xvar to bin across

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 xvar will be plotted

asp.eta.norm

aspect value for the QQ plot

asp.eta.v.var

aspect vlaue of the plot for eta vs variables

Value

Diagnostic plots

See Also

nlme.run, nlme.predict

Examples

## 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()

qPharmetra/qpToolkit documentation built on May 24, 2023, 8:52 a.m.